Documentation ¶
Overview ¶
Package nodesproto is a generated protocol buffer package.
It is generated from these files:
nodes.proto
It has these top-level messages:
GraphHeader Node
Index ¶
- Variables
- func ReadTree(r io.Reader) (nodes.Node, error)
- func WriteTo(w io.Writer, n nodes.Node) error
- type GraphHeader
- func (*GraphHeader) Descriptor() ([]byte, []int)
- func (m *GraphHeader) GetLastId() uint64
- func (m *GraphHeader) GetMetadata() uint64
- func (m *GraphHeader) GetRoot() uint64
- func (m *GraphHeader) Marshal() (dAtA []byte, err error)
- func (m *GraphHeader) MarshalTo(dAtA []byte) (int, error)
- func (*GraphHeader) ProtoMessage()
- func (m *GraphHeader) ProtoSize() (n int)
- func (m *GraphHeader) Reset()
- func (m *GraphHeader) String() string
- func (m *GraphHeader) Unmarshal(dAtA []byte) error
- type Node
- func (*Node) Descriptor() ([]byte, []int)
- func (m *Node) GetBool() bool
- func (m *Node) GetFloat() float64
- func (m *Node) GetId() uint64
- func (m *Node) GetInt() int64
- func (m *Node) GetIsObject() bool
- func (m *Node) GetKeys() []uint64
- func (m *Node) GetKeysFrom() uint64
- func (m *Node) GetString_() string
- func (m *Node) GetUint() uint64
- func (m *Node) GetValue() isNode_Value
- func (m *Node) GetValues() []uint64
- func (m *Node) GetValuesOffs() uint64
- func (m *Node) Kind() nodes.Kind
- func (m *Node) Marshal() (dAtA []byte, err error)
- func (m *Node) MarshalTo(dAtA []byte) (int, error)
- func (*Node) ProtoMessage()
- func (m *Node) ProtoSize() (n int)
- func (m *Node) Reset()
- func (m *Node) String() string
- func (m *Node) Unmarshal(dAtA []byte) error
- func (*Node) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type Node_Bool
- type Node_Float
- type Node_Int
- type Node_String_
- type Node_Uint
- type RawGraph
- type RawNode
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthNodes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowNodes = fmt.Errorf("proto: integer overflow") )
Functions ¶
Types ¶
type GraphHeader ¶
type GraphHeader struct { // LastID is a last node ID used by ID allocator for this graph. Implementation may reserve some // IDs space by setting LastID > max(nodes.ID). If not set, max(nodes.ID) is assumed. // Tools that manipulate the graph, but want to preserve IDs of the nodes should allocate IDs // starting from LastID+1. LastId uint64 `protobuf:"varint,1,opt,name=last_id,json=lastId,proto3" json:"last_id,omitempty"` // Root is an optional ID of a global root for this graph. This field is used to preserve // compatibility with tools that expect a tree-shaped data. // Implementation may also store multiple roots by referencing an Array node, or may store // multiple named roots by referencing an Object node. // If not set explicitly, implementations that expect a tree should search the graph for // unused nodes of type Object or Array and treat them as an array of roots. Root uint64 `protobuf:"varint,2,opt,name=root,proto3" json:"root,omitempty"` // Metadata is an optional ID for a metadata node for this file. Should reference an Object. // If set, implementations that expect a tree should exclude it from the list of roots. Metadata uint64 `protobuf:"varint,3,opt,name=metadata,proto3" json:"metadata,omitempty"` }
GraphHeader is the first message written over the wire before transfering graph nodes.
It should be preceded by the magic number "\x00bgr" (4 bytes) and the version number 0x1 written as a little-endian 4 byte integer. Next, the length of the header message should be written in varint encoding, directly followed by the message itself.
func (*GraphHeader) Descriptor ¶
func (*GraphHeader) Descriptor() ([]byte, []int)
func (*GraphHeader) GetLastId ¶
func (m *GraphHeader) GetLastId() uint64
func (*GraphHeader) GetMetadata ¶
func (m *GraphHeader) GetMetadata() uint64
func (*GraphHeader) GetRoot ¶
func (m *GraphHeader) GetRoot() uint64
func (*GraphHeader) Marshal ¶
func (m *GraphHeader) Marshal() (dAtA []byte, err error)
func (*GraphHeader) ProtoMessage ¶
func (*GraphHeader) ProtoMessage()
func (*GraphHeader) ProtoSize ¶
func (m *GraphHeader) ProtoSize() (n int)
func (*GraphHeader) Reset ¶
func (m *GraphHeader) Reset()
func (*GraphHeader) String ¶
func (m *GraphHeader) String() string
func (*GraphHeader) Unmarshal ¶
func (m *GraphHeader) Unmarshal(dAtA []byte) error
type Node ¶
type Node struct { // ID is a unique file-local ID of the node. // To implement global IDs, application should write additional data to the graph // or keep a mapping from file-local IDs to global ones. Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Value is a union for primitive value types. // These values are always leaf nodes, they should never store any references to other nodes, // or other graph-specific information. // It is assumed that encoded Value can be copied to a different Graph without any changes. // // Types that are valid to be assigned to Value: // *Node_String_ // *Node_Int // *Node_Uint // *Node_Float // *Node_Bool Value isNode_Value `protobuf_oneof:"value"` // Keys is an ordered set of Object keys. Coresponding values are stored in Values field. Keys []uint64 `protobuf:"varint,7,rep,packed,name=keys" json:"keys,omitempty"` // KeysFrom can refer to a node ID previously seen on wire. In this case, Keys from that node // are copied to Keys field of current node. Thus, full list of Keys can be omited. KeysFrom uint64 `protobuf:"varint,10,opt,name=keys_from,json=keysFrom,proto3" json:"keys_from,omitempty"` // Values stores an ordered list of node IDs. Zero ID represents a null node. // For Array node this field represent an array itself, and for Object nodes // this field is a set of values that coresponds to keys defined by Keys or KeysFrom. Values []uint64 `protobuf:"varint,8,rep,packed,name=values" json:"values,omitempty"` // IsObject is a helper field to distinguish between empty arrays and empty objects. IsObject bool `protobuf:"varint,9,opt,name=is_object,json=isObject,proto3" json:"is_object,omitempty"` // ValuesOffs is an offset added to all value IDs. Used for compression. ValuesOffs uint64 `protobuf:"varint,11,opt,name=values_offs,json=valuesOffs,proto3" json:"values_offs,omitempty"` }
Node represents any node that can be stored in the graph.
A list of Node messages follows directly after GraphHeader and each such message should be preceded by its length written in varint encoding. Nodes in the list should always be sorted by ID (ascending). ID of a node can be zero, in this case ID will be assigned automatically as prevNode.ID+1 (starting from 1).
In general there is 3 kinds of nodes: Values, Arrays, Objects. If Value oneof field is set, all other fields are ignored, and node is decoded as a value node (leaf). If any of Keys or KeysFrom fields are set, the node is an Object (set of key-value pairs). Only Keys/KeysFrom and Values fields are considered in this case. In other cases a node is an Array, and only Values field is considered.
func (*Node) Descriptor ¶
func (*Node) GetIsObject ¶
func (*Node) GetKeysFrom ¶
func (*Node) GetString_ ¶
func (*Node) GetValuesOffs ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
type Node_Bool ¶
type Node_Bool struct {
Bool bool `protobuf:"varint,6,opt,name=bool,proto3,oneof"`
}
type Node_Float ¶
type Node_Float struct {
Float float64 `protobuf:"fixed64,5,opt,name=float,proto3,oneof"`
}
func (*Node_Float) ProtoSize ¶
func (m *Node_Float) ProtoSize() (n int)
type Node_String_ ¶
type Node_String_ struct {
String_ string `protobuf:"bytes,2,opt,name=string,proto3,oneof"`
}
func (*Node_String_) ProtoSize ¶
func (m *Node_String_) ProtoSize() (n int)
type Node_Uint ¶
type Node_Uint struct {
Uint uint64 `protobuf:"varint,4,opt,name=uint,proto3,oneof"`
}