graftabledag

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathsContainPrefix

func PathsContainPrefix(haystack []chaintree.Path, needle chaintree.Path) bool

PathsContainPrefix is used for loop detection (these are DAGs after all). If any element of haystack has needle as a prefix, or if any haystack item is a prefix of needle, then this returns true, otherwise false.

Types

type DagGetter

type DagGetter interface {
	GetTip(ctx context.Context, did string) (*cid.Cid, error)
	GetLatest(ctx context.Context, did string) (*chaintree.ChainTree, error)
}

type GraftableDag

type GraftableDag interface {
	GlobalResolve(ctx context.Context, path chaintree.Path) (value interface{}, remaining chaintree.Path, err error)
	OriginDag() *dag.Dag
	DagGetter() DagGetter
}

type GraftedDag

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

func New

func New(origin *dag.Dag, dagGetter DagGetter) (*GraftedDag, error)

func (*GraftedDag) DagGetter

func (gd *GraftedDag) DagGetter() DagGetter

func (*GraftedDag) GlobalResolve

func (gd *GraftedDag) GlobalResolve(ctx context.Context, path chaintree.Path) (value interface{}, remaining chaintree.Path, err error)

GlobalResolve works like dag.Resolve but will resolve across multiple chaintrees when it encounters string values that start with `did:tupelo:` (i.e. chaintree DIDs).

func (*GraftedDag) OriginDag

func (gd *GraftedDag) OriginDag() *dag.Dag

Jump to

Keyboard shortcuts

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