Skip to content

Commit

Permalink
chore(kad): update changelog for PR and other cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuef committed Oct 22, 2024
1 parent c812dd4 commit b85f20b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/distributed-key-value-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license = "MIT"
release = false

[dependencies]
bytes = "1.5"
async-std = { version = "1.12", features = ["attributes"] }
async-trait = "0.1"
futures = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions examples/distributed-key-value-store/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#![doc = include_str!("../README.md")]

use async_std::io;
use bytes::Bytes;
use futures::{prelude::*, select};
use libp2p::bytes::Bytes;
use libp2p::kad;
use libp2p::kad::store::MemoryStore;
use libp2p::kad::Mode;
Expand Down Expand Up @@ -187,7 +187,7 @@ fn handle_input_line(kademlia: &mut kad::Behaviour<MemoryStore>, line: String) {
};
let value = {
match args.next() {
Some(value) => Bytes::from(value.as_bytes().to_owned()),
Some(value) => Bytes::copy_from_slice(value.as_bytes()),
None => {
eprintln!("Expected value");
return;
Expand Down
4 changes: 2 additions & 2 deletions protocols/kad/src/behaviour/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ fn disjoint_query_does_not_finish_before_all_paths_did() {
Multihash::<64>::wrap(SHA_256_MH, &thread_rng().gen::<[u8; 32]>())
.expect("32 array to fit into 64 byte multihash"),
);
let record_bob = Record::new(key.clone(), Bytes::from(b"bob".to_vec()));
let record_trudy = Record::new(key.clone(), Bytes::from(b"trudy".to_vec()));
let record_bob = Record::new(key.clone(), Bytes::copy_from_slice(b"bob"));
let record_trudy = Record::new(key.clone(), Bytes::copy_from_slice(b"trudy"));

// Make `bob` and `trudy` aware of their version of the record searched by
// `alice`.
Expand Down

0 comments on commit b85f20b

Please sign in to comment.