Skip to content
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

Bugfix. API uses ToString instead of Into<String> #93

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chitchat-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "chitchat-test"
version = "0.6.0"
version = "0.7.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
chitchat = { version = "0.6.0", path = "../chitchat" }
chitchat = { version = "0.7.0", path = "../chitchat" }
poem = "1"
poem-openapi = {version="1.3", features = ["swagger-ui"] }
structopt = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion chitchat/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chitchat"
version = "0.6.0"
version = "0.7.0"
edition = "2021"
license = "MIT"
authors = ["Quickwit, Inc. <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions chitchat/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ impl NodeState {
/// Setting a new value automatically increments the
/// version of the entire NodeState regardless of whether the
/// value is really changed or not.
pub fn set<K: Into<String>, V: Into<String>>(&mut self, key: K, value: V) {
pub fn set(&mut self, key: impl ToString, value: impl ToString) {
let new_version = self.max_version + 1;
self.set_with_version(key.into(), value.into(), new_version);
self.set_with_version(key.to_string(), value.to_string(), new_version);
}

/// Marks key for deletion and sets the value to an empty string.
Expand Down
10 changes: 2 additions & 8 deletions chitchat/src/transport/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,9 @@ impl ChannelTransport {

pub async fn remove_link(&self, from_addr: SocketAddr, to_addr: SocketAddr) {
let mut inner_lock = self.inner.lock().unwrap();
let from_addr_entry = inner_lock
.removed_links
.entry(from_addr)
.or_insert_with(HashSet::new);
let from_addr_entry = inner_lock.removed_links.entry(from_addr).or_default();
from_addr_entry.insert(to_addr);
let to_addr_entry = inner_lock
.removed_links
.entry(to_addr)
.or_insert_with(HashSet::new);
let to_addr_entry = inner_lock.removed_links.entry(to_addr).or_default();
to_addr_entry.insert(from_addr);
}

Expand Down
2 changes: 1 addition & 1 deletion chitchat/tests/cluster_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ async fn test_simple_simulation_heavy_insert_delete() {
keys_values.push((key.to_string(), value.to_string()));
let keys_entry = keys_values_inserted_per_chitchat_id
.entry(chitchat_id.clone())
.or_insert_with(HashSet::new);
.or_default();
keys_entry.insert(key.to_string());
}
simulator
Expand Down
Loading