Documentation ¶
Index ¶
- Variables
- func Marshal(cell Cell) (body []byte, err error)
- func MarshalJSON(cell Cell) (_ []byte, err error)
- func ToHex(cell Cell) (body []byte, err error)
- func Unmarshal(cell MutableCell, body []byte) error
- type BinaryCell
- func (cell *BinaryCell) AddChildren(children ...Cell)
- func (cell *BinaryCell) CID() (_ CID)
- func (cell *BinaryCell) Checksum() (_ ID, err error)
- func (cell *BinaryCell) Child(n int) Cell
- func (cell *BinaryCell) ChildrenSize() int
- func (cell *BinaryCell) Marshal() (_ []byte, err error)
- func (cell *BinaryCell) MarshalJSON() (_ []byte, err error)
- func (cell *BinaryCell) Memory() []byte
- func (cell *BinaryCell) OpCode() ID
- func (cell *BinaryCell) SetChildren(children []Cell)
- func (cell *BinaryCell) SetMemory(memory []byte)
- func (cell *BinaryCell) SetOpCode(opCode ID)
- func (cell *BinaryCell) String() string
- type CID
- func DecodeCID(v string) (_ CID, err error)
- func NewCID(codecType uint64, mhash mh.Multihash) CID
- func NewCIDFromHash(codecType uint64, hash []byte, hashType uint64) CID
- func ParseCID(v interface{}) (_ CID, err error)
- func SumCID(prefix cid.Prefix, body []byte) (_ CID, err error)
- func WrapCID(c cid.Cid) CID
- type Cell
- type CellPrinter
- type ID
- type MutableCell
Constants ¶
This section is empty.
Variables ¶
var CellPrefix = cid.Prefix{ Version: 1, Codec: 0x70bc, MhType: mh.SHA2_256, MhLength: 32, }
CellPrefix - Binary cell CID prefix.
var UndefCID = CID{}
UndefCID - Alias to an empty content ID.
Functions ¶
func MarshalJSON ¶
MarshalJSON - Marshals cell as JSON.
func Unmarshal ¶
func Unmarshal(cell MutableCell, body []byte) error
Unmarshal - Unmarshals cell from byte array.
Types ¶
type BinaryCell ¶
type BinaryCell struct {
// contains filtered or unexported fields
}
BinaryCell - Binary representation of cell.
func New ¶
func New(op ID, memory []byte, children ...Cell) *BinaryCell
New - Creates new binary cell.
func UnmarshalBinary ¶
func UnmarshalBinary(body []byte) (c *BinaryCell, err error)
UnmarshalBinary - Unmarshals new binary cell.
func (*BinaryCell) AddChildren ¶
func (cell *BinaryCell) AddChildren(children ...Cell)
AddChildren - Appends new children operation.
func (*BinaryCell) Checksum ¶
func (cell *BinaryCell) Checksum() (_ ID, err error)
Checksum - Computes marshalled xxhash64 of cell content id.
func (*BinaryCell) ChildrenSize ¶
func (cell *BinaryCell) ChildrenSize() int
ChildrenSize - Amount of children.
func (*BinaryCell) Marshal ¶
func (cell *BinaryCell) Marshal() (_ []byte, err error)
Marshal - Marshals cell.
func (*BinaryCell) MarshalJSON ¶
func (cell *BinaryCell) MarshalJSON() (_ []byte, err error)
MarshalJSON - Marshals cell as JSON.
func (*BinaryCell) SetChildren ¶
func (cell *BinaryCell) SetChildren(children []Cell)
SetChildren - Set operation children.
func (*BinaryCell) SetMemory ¶
func (cell *BinaryCell) SetMemory(memory []byte)
SetMemory - Set operation memory.
func (*BinaryCell) SetOpCode ¶
func (cell *BinaryCell) SetOpCode(opCode ID)
SetOpCode - Sets operation ID.
type CID ¶
CID - Content ID wrapper.
func NewCIDFromHash ¶
NewCIDFromHash - Creates new wrapped content ID v1 for codec and hash.
func (CID) MarshalJSON ¶
MarshalJSON - Marshals the cid as string.
func (*CID) UnmarshalJSON ¶
UnmarshalJSON - Parses the JSON string representation of a cid.
type Cell ¶
type Cell interface { // CID - Operation CID. CID() CID // OpCode - Operation ID. OpCode() ID // Memory - Operation memory. Memory() []byte // Child - Child cell by index. Child(int) Cell // ChildrenSize - Amount of children. ChildrenSize() int // Marshal - Marshals cell. Marshal() ([]byte, error) fmt.Stringer }
Cell - Operation cell interface.
func FromHexString ¶
FromHexString - Decodes cell from hex encoded binary cell.
type CellPrinter ¶
type CellPrinter struct {
Cell
}
CellPrinter - Cell pretty printer.
func NewChildrenPrinter ¶
func NewChildrenPrinter(cell Cell) (res []*CellPrinter)
NewChildrenPrinter - Creates new cell pretty printer.
func NewPrinter ¶
func NewPrinter(cell Cell) *CellPrinter
NewPrinter - Creates new cell pretty printer.
func (*CellPrinter) MarshalJSON ¶
func (p *CellPrinter) MarshalJSON() (_ []byte, err error)
MarshalJSON - Marshals cell as JSON.
type ID ¶
type ID uint64
ID - Cell of an ID registered on-chain.
func NewIDFromString ¶
NewIDFromString - Creates new cell ID from string.
func (ID) MarshalJSON ¶
MarshalJSON - Marshals ID as JSON string.
type MutableCell ¶
type MutableCell interface { Cell // AddChildren - Adds children. AddChildren(...Cell) // SetOpCode - Sets operation ID. SetOpCode(ID) // SetMemory - Set operation memory. SetMemory([]byte) // SetChildren - Set operation children. SetChildren([]Cell) }
MutableCell - Mutable cell interface.