Skip to content

Commit 204379b

Browse files
authored
[CHORE] Remove unneeded assigned_node method (#5479)
## Description of changes Remove unused `assigned_node` method. We almost always want the pair of host and client. ## Test plan - These are test using rust tests
1 parent 702afa5 commit 204379b

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

rust/memberlist/src/client_manager.rs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ where
7070
}
7171

7272
/// Get a map of assigned node names to their clients for the given key in a single lock acquisition
73-
/// This avoids race conditions between separate calls to assigned_nodes() and clients()
7473
/// # Arguments
7574
/// - `assignment_key` - The key for which the client is to be fetched
7675
/// # Returns
@@ -117,26 +116,6 @@ where
117116
self.node_name_to_client.read().get(node_name).cloned()
118117
}
119118

120-
/// Returns the assigned node names for a given key.
121-
///
122-
/// This method uses the configured assignment policy to determine which nodes
123-
/// are responsible for the given key.
124-
///
125-
/// # Arguments
126-
///
127-
/// * `assignment_key` - The key to assign to nodes.
128-
///
129-
/// # Errors
130-
///
131-
/// Returns `ClientAssignmentError` if the assignment policy fails.
132-
pub fn assigned_nodes(
133-
&mut self,
134-
assignment_key: &str,
135-
) -> Result<Vec<String>, ClientAssignmentError> {
136-
self.assigned_clients(assignment_key)
137-
.map(|assigned_clients| assigned_clients.into_keys().collect())
138-
}
139-
140119
pub fn all(&self) -> Vec<T> {
141120
let node_name_to_client_guard = self.node_name_to_client.read();
142121
node_name_to_client_guard.values().cloned().collect()
@@ -574,36 +553,4 @@ mod test {
574553
);
575554
assert!(assigner.client_for_node("missing").is_none());
576555
}
577-
578-
#[tokio::test]
579-
async fn test_client_assigner_assigned_nodes() {
580-
use std::collections::HashSet;
581-
582-
let mut assigner: ClientAssigner<String> = ClientAssigner::new(
583-
Box::new(chroma_config::assignment::assignment_policy::RendezvousHashingAssignmentPolicy::default()),
584-
3,
585-
);
586-
{
587-
let mut guard = assigner.node_name_to_client.write();
588-
for i in 0..5 {
589-
guard.insert(format!("node{}", i), format!("client{}", i));
590-
}
591-
}
592-
// Test nodes that do not exist
593-
let assigned = assigner
594-
.assigned_nodes("some-key")
595-
.expect("assignment succeeds");
596-
597-
assert!(!assigned.is_empty());
598-
assert!(assigned.len() <= 3);
599-
600-
let assigned_set: HashSet<_> = assigned.iter().cloned().collect();
601-
assert_eq!(assigned.len(), assigned_set.len(), "no duplicates");
602-
603-
// Find each node in our assigner
604-
let all_names: HashSet<_> = assigner.node_names().into_iter().collect();
605-
for n in assigned {
606-
assert!(all_names.contains(&n), "assigned node must be in members");
607-
}
608-
}
609556
}

0 commit comments

Comments
 (0)