-
Notifications
You must be signed in to change notification settings - Fork 233
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
feat: allow disabling value and provider storage/messages #400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a little funky.
One question wrt correctness is that the local option affects the propagation of messages to the network.
Ie if we disable values/providers, then GetValue
and FindProviders
will short-circuit and not send any messages to the network.
However, we might have peers that are able to answer these queries because they have these options enabled.
Is this intended?
@@ -110,6 +114,10 @@ type RecvdVal struct { | |||
|
|||
// GetValue searches for the value corresponding to given Key. | |||
func (dht *IpfsDHT) GetValue(ctx context.Context, key string, opts ...routing.Option) (_ []byte, err error) { | |||
if !dht.enableValues { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct behaviour? We might know a peer that supports GetValue
and so on.
@@ -477,6 +495,9 @@ func (dht *IpfsDHT) makeProvRecord(skey cid.Cid) (*pb.Message, error) { | |||
|
|||
// FindProviders searches until the context expires. | |||
func (dht *IpfsDHT) FindProviders(ctx context.Context, c cid.Cid) ([]peer.AddrInfo, error) { | |||
if !dht.enableProviders { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
Yes. This feature is intended to be used in private/forked DHTs with custom protocol names (e.g., the Filecoin DHT). |
@Stebalien Could this get documented in the code? Maybe on the struct values: |
@lanzafame I'm documenting the options. |
d43ce3c
to
c2b72b2
Compare
(eh, I did it in both places) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides inline comments, two overall notes:
- Let's document that
GetPublicKey()
will also stop to operate properly if values are disabled. Do we expect any major impact? - How will the routing helpers behave when we start returning errors?
None. It was only ever used for validating IPNS records and:
They'll continue to work:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
fixes #274