Documentation ¶
Index ¶
- Constants
- func ErrorAtPath(base ipld.Path, baseError error) error
- func ErrorAtPathSegment(seg ipld.PathSegment, base ipld.Path, baseError error) error
- type Decoder
- type LegacyNode
- func (ln *LegacyNode) Copy() format.Node
- func (ln *LegacyNode) Links() []*format.Link
- func (ln *LegacyNode) MarshalJSON() ([]byte, error)
- func (ln *LegacyNode) Resolve(path []string) (interface{}, []string, error)
- func (ln *LegacyNode) ResolveLink(path []string) (*format.Link, []string, error)
- func (ln *LegacyNode) Size() (uint64, error)
- func (ln *LegacyNode) Stat() (*format.NodeStat, error)
- func (ln *LegacyNode) Tree(path string, depth int) []string
- type NodeConverter
- type UniversalNode
Constants ¶
const ( // ErrNonLink is returned when ResolveLink is called on a node that is not a link ErrNonLink = errorType("non-link found at given path") // ErrNoSuchLink is returned when ResolveLink is called on a path that does not exist ErrNoSuchLink = errorType("no such link found") // ErrArrayOutOfRange is returned when Resolve link is called on a list that where the index is out of range ErrArrayOutOfRange = errorType("array index out of range") // ErrNoLinks is returned when we try to traverse through a terminal ErrNoLinks = errorType("tried to resolve through object that had no links") )
Variables ¶
This section is empty.
Functions ¶
func ErrorAtPathSegment ¶
Types ¶
type Decoder ¶ added in v0.2.0
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶ added in v0.2.0
func NewDecoder() *Decoder
func NewDecoderWithLS ¶ added in v0.2.1
func NewDecoderWithLS(ls ipld.LinkSystem) *Decoder
func (*Decoder) DecodeNode ¶ added in v0.2.0
DecodeNode builds a UniversalNode from a block
func (*Decoder) RegisterCodec ¶ added in v0.2.0
func (d *Decoder) RegisterCodec(codec uint64, prototype ipld.NodePrototype, converter NodeConverter)
RegisterCodec registers a specialized prototype & converter for a specific codec
type LegacyNode ¶
LegacyNode wraps a go-ipld-prime node & a block so that it can be treated as a legacy ipld format node
func (*LegacyNode) Copy ¶
func (ln *LegacyNode) Copy() format.Node
Copy returns a deep copy of this node
func (*LegacyNode) Links ¶
func (ln *LegacyNode) Links() []*format.Link
Links is a helper function that returns all links within this object
func (*LegacyNode) MarshalJSON ¶ added in v0.1.1
func (ln *LegacyNode) MarshalJSON() ([]byte, error)
MarshalJSON implements a JSON Marshaller interface for objects that expect marshalled json
func (*LegacyNode) Resolve ¶
func (ln *LegacyNode) Resolve(path []string) (interface{}, []string, error)
Resolve resolves a path through this node, stopping at any link boundary and returning the object found as well as the remaining path to traverse
func (*LegacyNode) ResolveLink ¶
ResolveLink is a helper function that calls resolve and asserts the output is a link
func (*LegacyNode) Size ¶
func (ln *LegacyNode) Size() (uint64, error)
Size returns the size in bytes of the serialized object
type NodeConverter ¶
type NodeConverter func(b blocks.Block, nd ipld.Node) (UniversalNode, error)
NodeConverter converts a go-ipld-prime node + block combination to a UniversalNode that satisfies both current and legacy ipld formats
type UniversalNode ¶
UniversalNode satisfies both go-ipld-prime interfaces and legacy interfaces