Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge the Resolver interface into the Node interface #24

Open
Stebalien opened this issue Aug 17, 2017 · 11 comments
Open

Merge the Resolver interface into the Node interface #24

Stebalien opened this issue Aug 17, 2017 · 11 comments

Comments

@Stebalien
Copy link
Member

Stebalien commented Aug 17, 2017

It's entirely useless (and we have way to many useless interfaces) on its own.

@Stebalien Stebalien mentioned this issue Aug 17, 2017
13 tasks
@Stebalien Stebalien changed the title Get rid of separate Resolver interface Merge the Resolver interface into the Node interface Aug 17, 2017
@whyrusleeping
Copy link
Member

FINE

@whyrusleeping
Copy link
Member

Actually wait no, This interface is still useful. It represents the abstract 'merkle graph' element. Something implementing resolver could be a single object that represents many sub-objects (one example would be sharding, in the abstract).

@whyrusleeping
Copy link
Member

cc @diasdavid

@Stebalien
Copy link
Member Author

Good point. Although I'd like to rename it and document why it's useful. Currently, it's just a sub-interface of Node.

@whyrusleeping
Copy link
Member

Be careful changing the names of things. @diasdavid knows where you sleep...

@daviddias
Copy link
Member

:D

There has to be an interface that you can give to a developer, external or internal to IPFS and say "Take this and implement this interface over that Merkle Format" and once he does, it is fully an IPLD format that is resolvable through IPFS.

In JS land, we call it ipld-format, we actually have a repo just to declare that interface spec which is interface-ipld-format.

Is it possible to match that in Go (I believe this is what this repo is, but I'm avoiding assumptions)?

@Stebalien
Copy link
Member Author

It is. That's why I brought this up at the IPLD deep dive.

@whyrusleeping

FYI: In the JS version of this, resolve can't operate over abstract merkle graph elements (it expects a concrete node (binary blob)). Instead, I believe there are higher-level "path resolvers" that can operate over a graph.

@daviddias
Copy link
Member

I believe there are higher-level "path resolvers" that can operate over a graph.

That is correct. A format implementation operates at the individual node level (can do resolves to a single node), the IPLD Service/Resolver (https://github.com/ipld/js-ipld-resolver) uses all of those IPLD Format implementations to traverse over any graph.

@whyrusleeping
Copy link
Member

whyrusleeping commented Sep 2, 2017 via email

@daviddias
Copy link
Member

daviddias commented Sep 2, 2017

I didn't change how js-ipld works either. Or we are misunderstanding something right now or we missed something then. Either way, we can reach one solution.

The rationale behind js-ipld Main Resolver and Local Resolvers is that the code that touches the Block Service and knows how to jump from one format to another is just written once in the Main Resolver. This also saves the burden from IPLD Format implementors to have to think about and implement more things.

@Stebalien
Copy link
Member Author

The code, as-is (in go, at least), is right. That is, there's a higher-level path resolution interface that can resolve over a DAG and a lower-level resolver interface that resolves over individual nodes.

However, using format resolvers to resolve over abstract (e.g., sharded) objects as per your comment (#24 (comment)) would deviate from this.

The abstract resolver is defined in go-ipfs/path/resolver.go and takes a special ResolveOnce function:

type Resolver struct {
	DAG dag.DAGService

	ResolveOnce func(ctx context.Context, ds dag.DAGService, nd node.Node, names []string) (*node.Link, []string, error)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants