kad: Implement put_record_to and try_put_record_to (#77) #82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the
put_record_to
andtry_put_record_to
to selectively pick peers to update their records.The main use-case from substrate would be the following:
This PR provided peers to the engine if the peers are part of the kBucket. The first step of the discovery in substrate motivates this assumption. We can probably do things a bit more optimally since we know the peers part of the kBucket were discovered previously (or currently connected):
PutNodeContext
which circumvents the need to discover the peers and just forwards a kadPUT_VALUE
to those peers We'd have to double check that with libp2p as well (my brief looking over code points to this direction).To unblock paritytech/polkadot-sdk#3786 we can merge this and then come back with a better / optimal solution for this
Builds on top of: #76
cc @paritytech/networking