merkledag

package
v0.0.0-...-dc1a0b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2014 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAGService

type DAGService struct {
	Blocks *blocks.BlockService
}

An IPFS Merkle DAG service. the root is virtual (like a forest) stores nodes' data in a blockService

func (*DAGService) Get

func (n *DAGService) Get(k u.Key) (*Node, error)

func (*DAGService) Put

func (n *DAGService) Put(nd *Node) (u.Key, error)
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
}

An IPFS Merkle DAG Link

type Node

type Node struct {
	Links []*Link
	Data  []byte
	// contains filtered or unexported fields
}

A node in the IPFS Merkle DAG. nodes have opaque data and a set of navigable links.

func Decoded

func Decoded(encoded []byte) (*Node, error)
func (n *Node) AddNodeLink(name string, that *Node) error

func (*Node) Encoded

func (n *Node) Encoded(force bool) ([]byte, error)

func (*Node) Key

func (n *Node) Key() (u.Key, error)

func (*Node) Marshal

func (n *Node) Marshal() ([]byte, error)

func (*Node) MarshalTo

func (n *Node) MarshalTo(encoded []byte) error

func (*Node) Multihash

func (n *Node) Multihash() (mh.Multihash, error)

func (*Node) Size

func (n *Node) Size() (uint64, error)

func (*Node) Unmarshal

func (n *Node) Unmarshal(encoded []byte) error

type NodeMap

type NodeMap map[u.Key]*Node

can't use []byte/Multihash for keys :( so have to convert Multihash bytes to string

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(r randyNode, easy bool) *PBLink

func (*PBLink) Equal

func (this *PBLink) Equal(that interface{}) bool

func (*PBLink) GetHash

func (m *PBLink) GetHash() []byte

func (*PBLink) GetName

func (m *PBLink) GetName() string

func (*PBLink) GetTsize

func (m *PBLink) GetTsize() uint64

func (*PBLink) GoString

func (this *PBLink) GoString() string

func (*PBLink) Marshal

func (m *PBLink) Marshal() (data []byte, err error)

func (*PBLink) MarshalTo

func (m *PBLink) MarshalTo(data []byte) (n int, err error)

func (*PBLink) ProtoMessage

func (*PBLink) ProtoMessage()

func (*PBLink) Reset

func (m *PBLink) Reset()

func (*PBLink) Size

func (m *PBLink) Size() (n int)

func (*PBLink) String

func (this *PBLink) String() string

func (*PBLink) Unmarshal

func (m *PBLink) Unmarshal(data []byte) error

func (*PBLink) VerboseEqual

func (this *PBLink) VerboseEqual(that interface{}) error

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 NewPopulatedPBNode(r randyNode, easy bool) *PBNode

func (*PBNode) Equal

func (this *PBNode) Equal(that interface{}) bool

func (*PBNode) GetData

func (m *PBNode) GetData() []byte
func (m *PBNode) GetLinks() []*PBLink

func (*PBNode) GoString

func (this *PBNode) GoString() string

func (*PBNode) Marshal

func (m *PBNode) Marshal() (data []byte, err error)

func (*PBNode) MarshalTo

func (m *PBNode) MarshalTo(data []byte) (n int, err error)

func (*PBNode) ProtoMessage

func (*PBNode) ProtoMessage()

func (*PBNode) Reset

func (m *PBNode) Reset()

func (*PBNode) Size

func (m *PBNode) Size() (n int)

func (*PBNode) String

func (this *PBNode) String() string

func (*PBNode) Unmarshal

func (m *PBNode) Unmarshal(data []byte) error

func (*PBNode) VerboseEqual

func (this *PBNode) VerboseEqual(that interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL