Documentation
¶
Overview ¶
Package encoding implements compact binary codecs for EasyVCS metadata and trees. It replaces the previous JSON-text/line-text representations, which dominated the SQLite database size (metadata was ~99% of the store). These codecs are dependency-free (standard library) and produce much smaller, faster-to-decode payloads.
To avoid a dependency cycle (store needs encoding to serialize snapshots, while encoding needs store types to encode them), the encode/decode functions operate on primitive/alias types and return the store types only through the store package's own integration layer. Here we define local value types.
Index ¶
- func DecodeRevisionBody(body []byte) (current object.ID, forkFrom string, err error)
- func DecodeTree(payload []byte) (*object.Tree, error)
- func EncodeRevisionBody(current object.ID, forkFrom string) []byte
- func EncodeSnapshotMeta(s BaseSnapshot) []byte
- func EncodeTree(t *object.Tree) []byte
- type Author
- type BaseSnapshot
- type SnapshotMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeRevisionBody ¶
DecodeRevisionBody decodes a revision body.
func DecodeTree ¶
DecodeTree decodes a binary tree.
func EncodeRevisionBody ¶
EncodeRevisionBody encodes a revision's current snapshot id and fork_from.
func EncodeSnapshotMeta ¶
func EncodeSnapshotMeta(s BaseSnapshot) []byte
EncodeSnapshotMeta packs parents, author, and description into a compact binary blob (varints + length-prefixed strings).
func EncodeTree ¶
EncodeTree binary-encodes a tree: count, then per entry (name, kind, id). This replaces the previous line-text format (name\nkind\nsha\n), which bloat for trees with many files.
Types ¶
type BaseSnapshot ¶
BaseSnapshot is a minimal snapshot view used by encode (id-independent).
type SnapshotMeta ¶
SnapshotMeta is the decoded compact snapshot metadata.
func DecodeSnapshotMeta ¶
func DecodeSnapshotMeta(payload []byte) (SnapshotMeta, error)
DecodeSnapshotMeta is the inverse of EncodeSnapshotMeta.