Documentation ¶
Overview ¶
Package wire contains a few basic types that can be composed to serialize graph information for the state package. This package defines the wire protocol.
Note that these types are careful about how they implement the relevant interfaces (either value receiver or pointer receiver), so that native-sized types, such as integers and simple pointers, can fit inside the interface object.
This package also uses panic as control flow, so called should be careful to wrap calls in appropriate handlers.
Testing for this package is driven by the state test package.
Index ¶
- func LoadUint(r Reader) uint64
- func Save(w Writer, obj Object)
- func SaveUint(w Writer, v uint64)
- type Array
- type Bool
- type Complex128
- type Complex64
- type Dot
- type FieldName
- type Float32
- type Float64
- type Index
- type Int
- type Interface
- type Map
- type Nil
- type Object
- type Reader
- type Ref
- type Slice
- type String
- type Struct
- type Type
- type TypeID
- type TypeSpec
- type TypeSpecArray
- type TypeSpecMap
- type TypeSpecNil
- type TypeSpecPointer
- type TypeSpecSlice
- type Uint
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dot ¶
type Dot interface {
// contains filtered or unexported methods
}
Dot is a kind of reference: one of Index and FieldName.
type Object ¶
type Object interface {
// contains filtered or unexported methods
}
Object is a generic object.
type Ref ¶
type Ref struct { // Root is the root object. Root Uint // Dots is the set of traversals required from the Root object above. // Note that this will be stored in reverse order for efficiency. Dots []Dot // Type is the base type for the root object. This is non-nil iff Dots // is non-zero length (that is, this is a complex reference). This is // not *strictly* necessary, but can be used to simplify decoding. Type TypeSpec }
Ref is a reference to an object.
type Struct ¶
type Struct struct { TypeID TypeID // contains filtered or unexported fields }
Struct is a basic composite value.
func (*Struct) Alloc ¶
Alloc allocates the given number of fields.
This must be called before Add and Save.
Precondition: slots must be positive.
type TypeSpec ¶
type TypeSpec interface {
// contains filtered or unexported methods
}
TypeSpec is a type dereference.
type TypeSpecArray ¶
TypeSpecArray is an array type.
type TypeSpecMap ¶
TypeSpecMap is a map type.
type TypeSpecPointer ¶
type TypeSpecPointer struct {
Type TypeSpec
}
TypeSpecPointer is a pointer type.