sdk.v2: gopkg.in/bblfsh/sdk.v2/uast/nodes/nodesproto Index | Files | Directories

package nodesproto

import "gopkg.in/bblfsh/sdk.v2/uast/nodes/nodesproto"

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

Package Files

nodes.pb.go nodesproto.go

Variables

var (
    ErrInvalidLengthNodes = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowNodes   = fmt.Errorf("proto: integer overflow")
)
var (
    MapSize   int
    ArrSize   int
    ValSize   int
    DelimSize int

    KeysCnt     int
    KeysFromCnt int
    DupsCnt     int
)

func ReadTree Uses

func ReadTree(r io.Reader) (nodes.Node, error)

ReadTree reads a binary graph from r and tries to decode it as a tree. If the graph is cyclic, an error is returned.

func WriteTo Uses

func WriteTo(w io.Writer, n nodes.Node) error

type GraphHeader Uses

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 Uses

func (*GraphHeader) Descriptor() ([]byte, []int)

func (*GraphHeader) GetLastId Uses

func (m *GraphHeader) GetLastId() uint64

func (*GraphHeader) GetMetadata Uses

func (m *GraphHeader) GetMetadata() uint64

func (*GraphHeader) GetRoot Uses

func (m *GraphHeader) GetRoot() uint64

func (*GraphHeader) Marshal Uses

func (m *GraphHeader) Marshal() (dAtA []byte, err error)

func (*GraphHeader) MarshalTo Uses

func (m *GraphHeader) MarshalTo(dAtA []byte) (int, error)

func (*GraphHeader) ProtoMessage Uses

func (*GraphHeader) ProtoMessage()

func (*GraphHeader) ProtoSize Uses

func (m *GraphHeader) ProtoSize() (n int)

func (*GraphHeader) Reset Uses

func (m *GraphHeader) Reset()

func (*GraphHeader) String Uses

func (m *GraphHeader) String() string

func (*GraphHeader) Unmarshal Uses

func (m *GraphHeader) Unmarshal(dAtA []byte) error

type Node Uses

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 Uses

func (*Node) Descriptor() ([]byte, []int)

func (*Node) GetBool Uses

func (m *Node) GetBool() bool

func (*Node) GetFloat Uses

func (m *Node) GetFloat() float64

func (*Node) GetId Uses

func (m *Node) GetId() uint64

func (*Node) GetInt Uses

func (m *Node) GetInt() int64

func (*Node) GetIsObject Uses

func (m *Node) GetIsObject() bool

func (*Node) GetKeys Uses

func (m *Node) GetKeys() []uint64

func (*Node) GetKeysFrom Uses

func (m *Node) GetKeysFrom() uint64

func (*Node) GetString_ Uses

func (m *Node) GetString_() string

func (*Node) GetUint Uses

func (m *Node) GetUint() uint64

func (*Node) GetValue Uses

func (m *Node) GetValue() isNode_Value

func (*Node) GetValues Uses

func (m *Node) GetValues() []uint64

func (*Node) GetValuesOffs Uses

func (m *Node) GetValuesOffs() uint64

func (*Node) Kind Uses

func (m *Node) Kind() nodes.Kind

func (*Node) Marshal Uses

func (m *Node) Marshal() (dAtA []byte, err error)

func (*Node) MarshalTo Uses

func (m *Node) MarshalTo(dAtA []byte) (int, error)

func (*Node) ProtoMessage Uses

func (*Node) ProtoMessage()

func (*Node) ProtoSize Uses

func (m *Node) ProtoSize() (n int)

func (*Node) Reset Uses

func (m *Node) Reset()

func (*Node) String Uses

func (m *Node) String() string

func (*Node) Unmarshal Uses

func (m *Node) Unmarshal(dAtA []byte) error

func (*Node) XXX_OneofFuncs Uses

func (*Node) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type Node_Bool Uses

type Node_Bool struct {
    Bool bool `protobuf:"varint,6,opt,name=bool,proto3,oneof"`
}

func (*Node_Bool) MarshalTo Uses

func (m *Node_Bool) MarshalTo(dAtA []byte) (int, error)

func (*Node_Bool) ProtoSize Uses

func (m *Node_Bool) ProtoSize() (n int)

type Node_Float Uses

type Node_Float struct {
    Float float64 `protobuf:"fixed64,5,opt,name=float,proto3,oneof"`
}

func (*Node_Float) MarshalTo Uses

func (m *Node_Float) MarshalTo(dAtA []byte) (int, error)

func (*Node_Float) ProtoSize Uses

func (m *Node_Float) ProtoSize() (n int)

type Node_Int Uses

type Node_Int struct {
    Int int64 `protobuf:"varint,3,opt,name=int,proto3,oneof"`
}

func (*Node_Int) MarshalTo Uses

func (m *Node_Int) MarshalTo(dAtA []byte) (int, error)

func (*Node_Int) ProtoSize Uses

func (m *Node_Int) ProtoSize() (n int)

type Node_String_ Uses

type Node_String_ struct {
    String_ string `protobuf:"bytes,2,opt,name=string,proto3,oneof"`
}

func (*Node_String_) MarshalTo Uses

func (m *Node_String_) MarshalTo(dAtA []byte) (int, error)

func (*Node_String_) ProtoSize Uses

func (m *Node_String_) ProtoSize() (n int)

type Node_Uint Uses

type Node_Uint struct {
    Uint uint64 `protobuf:"varint,4,opt,name=uint,proto3,oneof"`
}

func (*Node_Uint) MarshalTo Uses

func (m *Node_Uint) MarshalTo(dAtA []byte) (int, error)

func (*Node_Uint) ProtoSize Uses

func (m *Node_Uint) ProtoSize() (n int)

type RawGraph Uses

type RawGraph struct {
    Root  uint64             `json:"root,omitempty"`
    Meta  uint64             `json:"meta,omitempty"`
    Last  uint64             `json:"last,omitempty"`
    Nodes map[uint64]RawNode `json:"nodes"`
}

func ReadRaw Uses

func ReadRaw(r io.Reader) (*RawGraph, error)

ReadRaw reads a graph from a binary stream, returning a flat list of all nodes.

type RawNode Uses

type RawNode struct {
    ID     uint64      `json:"id"`
    Kind   nodes.Kind  `json:"kind"`
    Value  nodes.Value `json:"val,omitempty"`
    Keys   []uint64    `json:"keys,omitempty"`
    Values []uint64    `json:"values,omitempty"`
}

Directories

PathSynopsis
pio

Package nodesproto imports 10 packages (graph) and is imported by 6 packages. Updated 2019-05-27. Refresh now. Tools for package owners.