Documentation ¶
Index ¶
- type Dag
- func (d *Dag) AddNodes(ctx context.Context, nodes ...format.Node) error
- func (d *Dag) CreateNode(ctx context.Context, obj interface{}) (format.Node, error)
- func (d *Dag) Delete(ctx context.Context, path []string) (*Dag, error)
- func (d *Dag) Dump(ctx context.Context) string
- func (d *Dag) Get(ctx context.Context, id cid.Cid) (format.Node, error)
- func (d *Dag) Nodes(ctx context.Context) ([]format.Node, error)
- func (d *Dag) NodesForPath(ctx context.Context, path []string) ([]format.Node, error)
- func (d *Dag) NodesForPathWithDecendants(ctx context.Context, path []string) ([]format.Node, error)
- func (d *Dag) Resolve(ctx context.Context, path []string) (interface{}, []string, error)
- func (d *Dag) ResolveAt(ctx context.Context, tip cid.Cid, path []string) (val interface{}, remaining []string, err error)
- func (d *Dag) ResolveInto(ctx context.Context, path []string, obj interface{}) error
- func (d *Dag) Set(ctx context.Context, pathAndKey []string, val interface{}) (*Dag, error)
- func (d *Dag) SetAsLink(ctx context.Context, pathAndKey []string, val interface{}) (*Dag, error)
- func (d *Dag) Update(ctx context.Context, path []string, newObj interface{}) (*Dag, error)
- func (d *Dag) WithNewTip(tip cid.Cid) *Dag
- type NodeMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dag ¶
Dag is a convenience wrapper around a node store for setting and pruning
func NewDagWithNodes ¶
func NewDagWithNodes(ctx context.Context, store nodestore.DagStore, nodes ...format.Node) (*Dag, error)
NewDagWithNodes creates a new Dag, and imports the passed in nodes, the first node is set as the tip
func (*Dag) CreateNode ¶
CreateNode adds an object to the Dags underlying storage (doesn't change the tip) and returns the cbornode
func (*Dag) NodesForPath ¶
func (*Dag) NodesForPathWithDecendants ¶
func (*Dag) Resolve ¶
Resolve takes a path (as a string slice) and returns the value, remaining path and any error.
func (*Dag) ResolveAt ¶
func (d *Dag) ResolveAt(ctx context.Context, tip cid.Cid, path []string) (val interface{}, remaining []string, err error)
ResolveAt takes a tip and a path (as a string slice) and returns the value, remaining path and any error.
func (*Dag) ResolveInto ¶
func (*Dag) Set ¶
Set sets a value at a path and returns a new dag with a new tip that reflects the new state
func (*Dag) SetAsLink ¶
SetAsLink sets a value at a path and returns a new dag with a new tip that reflects the new state
func (*Dag) Update ¶
Update returns a new Dag with the old node at path swapped out for the new object
func (*Dag) WithNewTip ¶
WithNewTip returns a new Dag, but with the Tip set to the argument