Documentation
¶
Overview ¶
Package codec is the ontos canonical binary codec — ontos-codec-v1 (frozen).
Atom(bytes) = 0x00 || uvarint(len(bytes)) || bytes Tuple(values) = 0x01 || uvarint(arity) || encode(each child)
uvarint is unsigned LEB128 in shortest/canonical form over the u64 domain [0, 2^64-1] (spec: docs/spec/ontos-codec.md §3.1). The decoder rejects unknown tags, trailing bytes, non-canonical uvarints, uvarints whose value is >= 2^64 (uvarint_overflow), and inputs exceeding the configured safety limits or this implementation's native materialization width (limit_exceeded).
This codec is kept beside the model (it imports core, never the reverse). Conformance is pinned by vectors/codec.json (codec id: ontos-codec-v1) and specified normatively in docs/spec/ontos-codec.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeWithLimits ¶
DecodeWithLimits decodes one value with explicit limits, rejecting trailing bytes.
func EncodeUvarint ¶
EncodeUvarint returns the shortest-form LEB128 encoding of n. It is part of the public codec API (the canonical uvarint exposed for callers and pinned by the uvarint conformance vectors); the encoder internals use the private appendUvarint.
Types ¶
type DecodeError ¶
DecodeError carries a stable, cross-language rejection Code (matching vectors/codec.json). The Message is diagnostic only.
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string