cid

package module
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2016 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Protobuf = 0x70
	CBOR     = 0x71
	Raw      = 0x72
	JSON     = 0x73

	EthereumBlock = 0x90
	EthereumTx    = 0x91
	BitcoinBlock  = 0xb0
	BitcoinTx     = 0xb1
	ZcashBlock    = 0xc0
	ZcashTx       = 0xc1
)
View Source
const UnsupportedVersionString = "<unsupported cid version>"

Variables

View Source
var (
	ErrVarintBuffSmall = errors.New("reading varint: buffer to small")
	ErrVarintTooBig    = errors.New("reading varint: varint bigger than 64bits" +
		" and not supported")
)

Functions

This section is empty.

Types

type Cid

type Cid struct {
	// contains filtered or unexported fields
}

func Cast

func Cast(data []byte) (*Cid, error)

func Decode

func Decode(v string) (*Cid, error)

func NewCidV0

func NewCidV0(h mh.Multihash) *Cid

func NewCidV1

func NewCidV1(c uint64, h mh.Multihash) *Cid

func Parse

func Parse(v interface{}) (*Cid, error)

func (*Cid) Bytes

func (c *Cid) Bytes() []byte

func (*Cid) Equals

func (c *Cid) Equals(o *Cid) bool

func (*Cid) Hash

func (c *Cid) Hash() mh.Multihash

func (*Cid) KeyString

func (c *Cid) KeyString() string

func (*Cid) Loggable

func (c *Cid) Loggable() map[string]interface{}

func (*Cid) MarshalJSON

func (c *Cid) MarshalJSON() ([]byte, error)

func (*Cid) Prefix

func (c *Cid) Prefix() Prefix

func (*Cid) String

func (c *Cid) String() string

func (*Cid) Type

func (c *Cid) Type() uint64

func (*Cid) UnmarshalJSON

func (c *Cid) UnmarshalJSON(b []byte) error

type Prefix

type Prefix struct {
	Version  uint64
	Codec    uint64
	MhType   int
	MhLength int
}

Prefix represents all the metadata of a cid, minus any actual content information

func PrefixFromBytes

func PrefixFromBytes(buf []byte) (Prefix, error)

func (Prefix) Bytes

func (p Prefix) Bytes() []byte

func (Prefix) Sum

func (p Prefix) Sum(data []byte) (*Cid, error)

type Set

type Set struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(c *Cid)

func (*Set) ForEach

func (s *Set) ForEach(f func(c *Cid) error) error

func (*Set) Has

func (s *Set) Has(c *Cid) bool

func (*Set) Keys

func (s *Set) Keys() []*Cid

func (*Set) Len

func (s *Set) Len() int

func (*Set) Remove

func (s *Set) Remove(c *Cid)

func (*Set) Visit

func (s *Set) Visit(c *Cid) bool

Jump to

Keyboard shortcuts

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