@@ -19,16 +22,28 @@ type AdvVisitFn func(TraversalProgress, ipld.Node, TraversalReason) error
typeTraversalReasonbyte// enum = SelectionMatch | SelectionParent | SelectionCandidate // probably only pointful for block edges?
typeTraversalProgressstruct{
*TraversalConfig
Cfg*TraversalConfig
Pathipld.Path// Path is how we reached the current point in the traversal.
LastBlockstruct{// LastBlock stores the Path and Link of the last block edge we had to load. (It will always be zero in traversals with no linkloader.)
ipld.Path
ipld.Link
Pathipld.Path
Linkipld.Link
}
}
typeTraversalConfigstruct{
Ctxcontext.Context// Context carried through a traversal. Optional; use it if you need cancellation.
LinkLoaderipld.Loader// Loader used for automatic link traversal.
LinkStoreripld.Storer// Storer used if any mutation features (e.g. traversal.Transform) are used.
Ctxcontext.Context// Context carried through a traversal. Optional; use it if you need cancellation.
LinkLoaderipld.Loader// Loader used for automatic link traversal.
LinkNodeBuilderChooserNodeBuilderChooser// Chooser for Node implementations to produce during automatic link traversal.
LinkStoreripld.Storer// Storer used if any mutation features (e.g. traversal.Transform) are used.
}
// NodeBuilderChooser is a function that returns a NodeBuilder based on
// the information in a Link its LinkContext.
//
// A NodeBuilderChooser can be used in a TraversalConfig to be clear about
// what kind of Node implementation to use when loading a Link.
// In a simple example, it could constantly return an `ipldfree.NodeBuilder`.
// In a more complex example, a program using `bind` over native Go types
// could decide what kind of native type is expected, and return a
// `bind.NodeBuilder` for that specific concrete native type.