• Eric Myhre's avatar
    traversal.Focus implemented and tests: links go! · d7be1f27
    Eric Myhre authored
    NodeBuilderChooser returned -- sorry.  There are some cases where it's
    unavoidable.  (If we have schemas / typed nodes, we can do feature
    detection on the node to see if it can recommend an appropriate
    NodeBuilder for the far side of its link.  If we're fine using Node
    implementations that have 'any' storage support, it's not an issue.
    If we're using *bind* implementation Nodes -- which are constrained
    by the Golang native type system, and yet not perfectly mapped onto
    our own typed.Node constraint declarations -- then we need some way
    to choose the NodeBuilder.  So.  NodeBuilderChooser.  Again: sorry.)
    
    We can probably still expect the NodeBuilderChooser to be fixed
    (probably returning one of the 'any' storage supporting Node impls)
    in practice, since these traversal systems are generally for either
    "low context" usage (e.g., dunno what the data is) or will be used
    on typed/schema nodes, in which case we're again free of these issues.
    And the default values will indeed do this, using our new helpful
    default initialization for TraversalConfig.
    
    TraversalConfig will now always be initialized to sensible default
    values when using any of the traversal methods.  That means you can
    always assume `tp.Ctx`, etc, are going to be set -- no nil checks
    necssary -- even though they're optional to the caller.
    
    Error messages from traversal.Focus are touched up a bit for both
    consistency and clearer information.  There's more work to do here:
    we want these to be full-on typed errors before we call it "done".
    This work will probably begin soon, but be spread over quite a few
    commits (we also need to go back up to the *main* ipld package and
    make types for Node-level errors, and make sure tests exist to
    standardize those errors across Node implementations as well).
    Signed-off-by: default avatarEric Myhre <hash@exultant.us>
    d7be1f27
focus.go 4.77 KB