-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Eliminate GetOfflineLinkService method from LinkService interface #4152
Conversation
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
I'm not sure about replacing that interface with a concrete type; I believe we want the dag service to remain replacable. Also, I've run into the need for an offline NodeGetter/DAGService elsewhere (pubsub) so we'll probably want some form of "don't go online" switch anyways. |
The idea behind this p.r. is to get things moving until we can figure out a better interface. If the time comes when we want to swap out the DAGService with something else in an IPFS node (as that is the only place the concrete type is used) we can worry about it then. |
Also specific examples of where an offline NodeGetter/DAGService is used in pubsub will be helpful. |
So, for background:
I'd like to be able to validate received DAGs using both blocks attached to the messages and blocks already present on the local node but I do not want nodes to start bitswaping for blocks during validation; otherwise, peers could trivially trick other peers into downloading arbitrary data. Really, on thinking about this, fetching these nodes isn't the primary issue, it's persisting and providing them. This brings us back to that issue about adding hints to contexts. |
@Stebalien another option is to do what is done within IPFS and get an offline NodeGetter via out of band means. |
I won't have access to that from within pubsub. When the pubsub is constructed, it will be passed a DAGService (or something like that depending on how that refactor falls out) and it won't really have access to the rest of the system. This problem actually extends past just pubsub/offline. Any library operating over IPLD will want access to a DAGService and will need to be able to pass hints like:
That's one of the nice things about stuffing this stuff in a context. Actually, one way to do this could be to pass a "dead" (already canceled) context (and fix everything to check if the context has been canceled before performing any network requests). Really, this should already work. |
Superseded by #4610. |
This eliminates the GetOfflineLinkService method to make ipfs/go-ipld-format#8 easier and also avoid the need for #4009, at least for now.
It does it by keeping the method but instead exposing the type create by
NewDAGService
so that implementation specific methods can be called, with one of them beingGetOfflineLinkService
. The GC function now expects an offline LinkService. To help reinforce this notion a trivial typeOfflineLinkService
is used.