Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
aot
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
- Exception
- NoOptionalValueException
- NotProvidedException
- RecoverableException
- ScopedBuildFailedException
- ScopeNotActiveException
- Throwable
- UnrecoverableException
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
SchemaEncoder<T>
cajeta.wire.SchemaEncoder — schema-carrying wire codec for values of type
T. Identical in spirit to Encoder<T>, but every call also
takes a Schema: it is the contract for untagged formats (e.g.
Avro) whose bytes are undecodable without the schema that produced them.
Tagged formats that carry their own structure (Protobuf, MessagePack) use the
thinner Encoder<T> instead. The two halves are inverses —
decode(encode(value, s), s) yields a value equal to the original — and both
directions transfer ownership of their heap result (#) to the caller.
import cajeta.wire.Schema;
import cajeta.wire.SchemaEncoder;
// Toy single-byte codec; a real untagged format (Avro) resolves `schema`.
public final class ByteCodec implements SchemaEncoder<int8> {
public ByteCodec() { }
public #int8[] encode(int8 value, Schema schema) {
int8[] out = heap int8[1];
out[0] = value;
return #out;
}
public #int8 decode(int8[] bytes, Schema schema) {
int8 v = bytes[0];
return #v;
}
}
Methods
| Signature | |
|---|---|
#int8[] encode(T value, Schema schema) ⚑ | Serialize value under schema into a caller-owned byte buffer |
#T decode(int8[] bytes, Schema schema) ⚑ | Reconstruct a T from bytes under schema; inverse of encode |
⚑ = @EntryPoint
See also
- Schema — the schema carrier every call takes
- Encoder — the schema-free codec for tagged formats
- Source:
runtime/src/cajeta/wire/SchemaEncoder.cajeta