Documentation
¶
Overview ¶
Package merkledag is a generated protocol buffer package.
It is generated from these files:
data.proto
It has these top-level messages:
PBData Package merkledag is a generated protocol buffer package. It is generated from these files: node.proto It has these top-level messages: PBLink PBNode
Index ¶
- Variables
- func FilePBData(data []byte) []byte
- func FolderPBData() []byte
- func NewDagReader(n *Node, serv *DAGService) (io.Reader, error)
- func WrapData(b []byte) []byte
- type DAGService
- type DagReader
- type Link
- type Node
- func (n *Node) AddNodeLink(name string, that *Node) error
- func (n *Node) Encoded(force bool) ([]byte, error)
- func (n *Node) Key() (u.Key, error)
- func (n *Node) Marshal() ([]byte, error)
- func (n *Node) MarshalTo(encoded []byte) error
- func (n *Node) Multihash() (mh.Multihash, error)
- func (n *Node) Size() (uint64, error)
- func (n *Node) Unmarshal(encoded []byte) error
- type NodeMap
- type PBData
- type PBData_DataType
- type PBLink
- func (this *PBLink) Equal(that interface{}) bool
- func (m *PBLink) GetHash() []byte
- func (m *PBLink) GetName() string
- func (m *PBLink) GetTsize() uint64
- func (this *PBLink) GoString() string
- func (m *PBLink) Marshal() (data []byte, err error)
- func (m *PBLink) MarshalTo(data []byte) (n int, err error)
- func (*PBLink) ProtoMessage()
- func (m *PBLink) Reset()
- func (m *PBLink) Size() (n int)
- func (this *PBLink) String() string
- func (m *PBLink) Unmarshal(data []byte) error
- func (this *PBLink) VerboseEqual(that interface{}) error
- type PBNode
- func (this *PBNode) Equal(that interface{}) bool
- func (m *PBNode) GetData() []byte
- func (m *PBNode) GetLinks() []*PBLink
- func (this *PBNode) GoString() string
- func (m *PBNode) Marshal() (data []byte, err error)
- func (m *PBNode) MarshalTo(data []byte) (n int, err error)
- func (*PBNode) ProtoMessage()
- func (m *PBNode) Reset()
- func (m *PBNode) Size() (n int)
- func (this *PBNode) String() string
- func (m *PBNode) Unmarshal(data []byte) error
- func (this *PBNode) VerboseEqual(that interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ErrIsDir = errors.New("this dag node is a directory")
var PBData_DataType_name = map[int32]string{
0: "Raw",
1: "Directory",
2: "File",
}
var PBData_DataType_value = map[string]int32{
"Raw": 0,
"Directory": 1,
"File": 2,
}
Functions ¶
func FilePBData ¶
func FolderPBData ¶
func FolderPBData() []byte
func NewDagReader ¶
func NewDagReader(n *Node, serv *DAGService) (io.Reader, error)
Types ¶
type DAGService ¶
type DAGService struct {
Blocks *bserv.BlockService
}
DAGService is an IPFS Merkle DAG service. - the root is virtual (like a forest) - stores nodes' data in a BlockService TODO: should cache Nodes that are in memory, and be
able to free some of them when vm pressure is high
func (*DAGService) Add ¶
func (n *DAGService) Add(nd *Node) (u.Key, error)
Add adds a node to the DAGService, storing the block in the BlockService
func (*DAGService) AddRecursive ¶
func (n *DAGService) AddRecursive(nd *Node) error
type DagReader ¶
type DagReader struct {
// contains filtered or unexported fields
}
DagReader provides a way to easily read the data contained in a dag.
type Link ¶
type Link struct { // utf string name. should be unique per object Name string // utf8 // cumulative size of target object Size uint64 // multihash of the target object Hash mh.Multihash // a ptr to the actual node for graph manipulation Node *Node }
Link represents an IPFS Merkle DAG Link between Nodes.
type Node ¶
Node represents a node in the IPFS Merkle DAG. nodes have opaque data and a set of navigable links.
func (*Node) AddNodeLink ¶
AddNodeLink adds a link to another node.
func (*Node) Encoded ¶
Encoded returns the encoded raw data version of a Node instance. It may use a cached encoded version, unless the force flag is given.
func (*Node) Marshal ¶
Marshal encodes a *Node instance into a new byte slice. The conversion uses an intermediate PBNode.
func (*Node) MarshalTo ¶
MarshalTo encodes a *Node instance into a given byte slice. The conversion uses an intermediate PBNode.
type NodeMap ¶
NodeMap maps u.Keys to Nodes. We cannot use []byte/Multihash for keys :( so have to convert Multihash bytes to string (u.Key)
type PBData ¶
type PBData struct { Type *PBData_DataType `protobuf:"varint,1,req,enum=merkledag.PBData_DataType" json:"Type,omitempty"` Data []byte `protobuf:"bytes,2,opt" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` }
func (*PBData) GetType ¶
func (m *PBData) GetType() PBData_DataType
func (*PBData) ProtoMessage ¶
func (*PBData) ProtoMessage()
type PBData_DataType ¶
type PBData_DataType int32
const ( PBData_Raw PBData_DataType = 0 PBData_Directory PBData_DataType = 1 PBData_File PBData_DataType = 2 )
func (PBData_DataType) Enum ¶
func (x PBData_DataType) Enum() *PBData_DataType
func (PBData_DataType) String ¶
func (x PBData_DataType) String() string
func (*PBData_DataType) UnmarshalJSON ¶
func (x *PBData_DataType) UnmarshalJSON(data []byte) error
type PBLink ¶
type PBLink struct { // multihash of the target object Hash []byte `protobuf:"bytes,1,opt" json:"Hash,omitempty"` // utf string name. should be unique per object Name *string `protobuf:"bytes,2,opt" json:"Name,omitempty"` // cumulative size of target object Tsize *uint64 `protobuf:"varint,3,opt" json:"Tsize,omitempty"` XXX_unrecognized []byte `json:"-"` }
An IPFS MerkleDAG Link
func NewPopulatedPBLink ¶
func (*PBLink) ProtoMessage ¶
func (*PBLink) ProtoMessage()
func (*PBLink) VerboseEqual ¶
type PBNode ¶
type PBNode struct { // refs to other objects Links []*PBLink `protobuf:"bytes,2,rep" json:"Links,omitempty"` // opaque user data Data []byte `protobuf:"bytes,1,opt" json:"Data,omitempty"` XXX_unrecognized []byte `json:"-"` }
An IPFS MerkleDAG Node
func NewPopulatedPBNode ¶
func (*PBNode) ProtoMessage ¶
func (*PBNode) ProtoMessage()