mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-27 17:51:20 +00:00
* Add `Kademlia::put_record_to` for storing a record at specific nodes, e.g. for write-back caching after a successful read. In that context, peers that were queried in a successful `Kademlia::get_record` operation but did not return a record are now returned in the `GetRecordOk::no_record` list of peer IDs. Closes https://github.com/libp2p/rust-libp2p/issues/1577. * Update protocols/kad/src/behaviour.rs Co-authored-by: Max Inden <mail@max-inden.de> * Refine implementation. Rather than returning the peers that are cache candidates in a `Vec` in an arbitrary order, use a `BTreeMap`. Furthermore, make the caching configurable, being enabled by default with `max_peers` of 1. By configuring it with `max_peers` > 1 it is now also possible to control at how many nodes the record is cached automatically after a lookup with quorum 1. When enabled, successful lookups will always return `cache_candidates`, which can be used explicitly with `Kademlia::put_record_to` after lookups with a quorum > 1. * Re-export KademliaCaching * Update protocols/kad/CHANGELOG.md Co-authored-by: Max Inden <mail@max-inden.de> * Clarify changelog. Co-authored-by: Max Inden <mail@max-inden.de>