Open whyrusleeping opened 7 years ago
Also make Link
an interface
Let's do this now while we're making Link part of the coreapi?
Link
s, those have name/size fields and are IPFS specific.Copy()
method. Generic nodes are supposed to be immutable so it only really makes sense to copy them once they've been downcast to a concrete node type.Stat()
to an IPFSNode
type (not in this package).Size()
to Block
or remove it. It currently means two different things in different places (`ProtoNode.Size() computes the size of the dag, current node + linked nodes).Size()
, it shouldn't be able to return an error (given that one can compute it with uint64(len(node.RawData()))
.I've moved these into their own issues.
Move dagservice interface definition here
Standardize errors from implementation packages into here (ErrNoSuchLink, ErrNotLink, etc)
Remove ResolveLink method from interface. Add helper function to this package instead
Having a ResolveLink
method on the interface could be useful optimizing link traversal. However, a better way to do this would be specialization (or whatever go calls it): Define the helper function, define a NodeWithResolveLink
interface, and then try to cast to NodeWithResolveLink
in the helper function. This way, implementers can optimize multi-hop link resolution by implementing this interface but they don't need to.
Also make Link an interface
Or just use CIDs (#9)?
For context, I'm trying break this issue into actionable smaller issues and close it.
Need some orientation. What are the use cases for ResolveLink
?
ResolveLink
method from interface. Add helper function to this package instead