rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

refactor(kad): Add `Key` to `InboundRequest::{AddProvider, PutRecord}`.

Open dariusc93 opened this issue 6 months ago • 1 comments

Description

This PR introduces Key to InboundRequest::AddProvider and InboundRequest::PutRecord to provide the record key when it is inserted into the RecordStore.

Resolves #6048.

Notes & open questions

While one could just enable filtering, check the record for the key and then insert it into the store, I do feel this would provide information without requiring one to enable filtering and be responsible for inserting into the store.

Question:

  1. Should we instead have it as Option<Key> so when if filtering is enabled, the field would return None and with it being . disabled, it would return Some(_)?

Change checklist

  • [ ] I have performed a self-review of my own code
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] A changelog entry has been made in the appropriate crates

dariusc93 avatar Jun 05 '25 20:06 dariusc93

This pull request has merge conflicts. Could you please resolve them @dariusc93? 🙏

mergify[bot] avatar Jun 26 '25 08:06 mergify[bot]