-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[kad] Store addresses of provider records. #1708
Conversation
So far, provider records are stored without their addresses and the addresses of provider records are obtained from the routing table on demand. This has two shortcomings: 1. We can only return provider records whose provider peers happen to currently be in the local routing table. 2. The local node never returns itself as a provider for a key, even if it is indeed a provider. These issues are addressed here by storing the addresses together with the provider records, falling back to addresses from the routing table only for backward-compatibility with existing implementations of `RecordStore` using persistent storage. Resolves libp2p#1526.
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.
We can only return provider records whose provider peers happen to currently be in the local routing table.
Good catch. I have missed this to be honest.
Wouldn't the ProviderRecord
s need to be updated in inject_addr_failure
and inject_address_change
?
I don't think that is necessary as provider records are regularly re-published. It may not even be desirable. As for As for Does that sound reasonable or do you have more serious concerns? |
Co-authored-by: Max Inden <[email protected]>
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.
Following up on the discussion above (#1708 (comment)):
it is the job of the provider to tell others which addresses to store and advertise to others.
That sounds plausible. Thank you for the detailed explanation.
So far, provider records are stored without their addresses and the addresses of providers are obtained from the routing table on demand. I don't remember whether this was ever done on purpose or just an oversight as part of a larger amount of work. In any case, this approach has two shortcomings:
We can only return provider records whose provider peers happen to currently be in the local routing table.
The local node never returns itself as a provider for a key, even if it is indeed a provider.
These issues are addressed here by storing the addresses together with the provider records, falling back to
addresses from the routing table only for backward-compatibility with existing implementations of
RecordStore
that use persistent storage and may thus have records that persist across restarts.Closes #1526.