Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Are "upcalls" supported? #65

Open
chris-asl opened this issue Dec 24, 2018 · 3 comments
Open

Are "upcalls" supported? #65

chris-asl opened this issue Dec 24, 2018 · 3 comments
Labels
help wanted Seeking public contribution on this issue kind/support A question or request for support P3 Low: Not priority right now status/ready Ready to be worked

Comments

@chris-asl
Copy link

I want to use libp2p-kad-dht as a DHT for an application.
I am wondering if there's a way to inform this application for new keys about to be saved (or even saved already), i.e. if upcalls are supported.

Example:
Given 3 nodes, A, B and C, that run my application which uses libp2p-kad-dht.

Given a put(keyX, valueY) issued by the application of node A and that the value should be stored in node C, is there a way for informing the application of node C, that a <key, value> is about to be stored?

@vasco-santos
Copy link
Member

Hello @chris-asl

Thanks for reaching out. We currently do not support that use case with upcalls. However, I am willing to discuss a proposal for implementing it.

@vasco-santos vasco-santos added help wanted Seeking public contribution on this issue kind/support A question or request for support status/ready Ready to be worked P3 Low: Not priority right now labels Dec 28, 2018
@chris-asl
Copy link
Author

chris-asl commented Dec 28, 2018

@vasco-santos thanks for the reply!
In the meantime I have been digging around the code, and was thinking whether the validators, which if I got this right, run at each node that stores the value, can be used as upcalls.

Thus, allowing the application on top of libp2p-kad-dht decide whether or not to save the value (probably by cb(Error('no store')) from the validator).

@vasco-santos
Copy link
Member

So, the validator is responsible for validating if the record is valid under certain conditions (we receive a function). The selector is responsible for selecting which occurrence from a record is the best one.

At a first glimpse, I believe that we could add a new function parameter, such as the validator and selector that could notice upwards that a key was stored (I am not sure about a good naming yet). This sounds a reasonable approach as we would only notice if the application adds that function, and consequently, only who wants to use this will use.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Seeking public contribution on this issue kind/support A question or request for support P3 Low: Not priority right now status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

2 participants