ipld

package
v0.0.0-...-ee0e00b Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExpectedByteString = errors.New("expected byte string")
View Source
var ErrWrongCborTagNumber = errors.New("wrong CBOR tag for CID")

Functions

This section is empty.

Types

type Block

type Block struct {
	node.Node
}

Block wraps the node.Node interface, adding some extra methods to interface with the carmirror code base.

func TryBlockFromCBOR

func TryBlockFromCBOR(cborData any) (*Block, error)

func WrapBlock

func WrapBlock(node node.Node) *Block

WrapBlock wraps a node.Node in a Block.

func (*Block) Children

func (blk *Block) Children() []Cid

GetChildren returns the Cids of the children of the block.

func (*Block) Id

func (blk *Block) Id() Cid

Id returns the Cid of the block.

func (*Block) Size

func (blk *Block) Size() int64

Size returns the size of the block.

func (*Block) Unwrap

func (blk *Block) Unwrap() node.Node

Unwrap returns the underlying node.

type Cid

type Cid struct{ cid.Cid }

Cid wraps cid.Cid, in order to add CBOR serialization and deserialization.

func WrapCid

func WrapCid(cid cid.Cid) Cid

WrapCid wraps a cid.Cid in a Cid.

func (Cid) MarshalCBOR

func (ipfsCid Cid) MarshalCBOR() ([]byte, error)

MarshalCBOR implements the CBOR marshaler interface.

func (*Cid) Read

func (ipfsCid *Cid) Read(reader core.ByteAndBlockReader) (int, error)

Read reads the CID from the reader into the Cid.

func (*Cid) UnmarshalCBOR

func (ipfsCid *Cid) UnmarshalCBOR(bytes []byte) error

UnmarshalCBOR implements the CBOR unmarshaler interface.

func (Cid) Unwrap

func (ipfsCid Cid) Unwrap() cid.Cid

Unwrap returns the underlying cid.Cid.

type RawBlock

type RawBlock struct {
	block.Block
}

RawBlock wraps the block.Block interface, allowing it to interface with the carmirror code base.

func WrapRawBlock

func WrapRawBlock(block block.Block) *RawBlock

WrapRawBlock wraps a block.Block in a RawBlock.

func (*RawBlock) Id

func (blk *RawBlock) Id() Cid

Id returns the Cid of the block.

func (*RawBlock) Size

func (blk *RawBlock) Size() int64

Size returns the size of the block.

func (*RawBlock) Unwrap

func (blk *RawBlock) Unwrap() block.Block

Unwrap returns the underlying block.

Jump to

Keyboard shortcuts

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