Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arbor ¶
type Arbor struct{}
Arbor serializes forest types using the safe arbor serialization that validates the data.
type Codec ¶
type Codec interface { Encode(v interface{}) ([]byte, error) Decode(b []byte, v interface{}) error }
Codec can encode and decode forest types.
type Default ¶
Default initializes to the safe Arbor codec, unless overriden by internal code such as test code.
type Unsafe ¶
type Unsafe struct{}
Unsafe serializes forest types without validating them for the purposes of fast testing.
This avoids branches within the orchard code that could lead to nodes not being validated.
NOTE(jfm) msgpack is used because stdlib encodings have coincidental issues:
- Gob calls into encoding.BinaryMarshaler method set, which calls the node validation code paths.
- JSON encodes types like fields.Version into an escaped hexidecimal string, but refuses to decode back into fields.Version without some help.
In an attempt to avoid touching the fields types, I've opted to go with a encoding that works "out of the box".