|
70 | 70 | }
|
71 | 71 |
|
72 | 72 | /// 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() |
74 | 73 | /// # Arguments
|
75 | 74 | /// - `assignment_key` - The key for which the client is to be fetched
|
76 | 75 | /// # Returns
|
@@ -117,26 +116,6 @@ where
|
117 | 116 | self.node_name_to_client.read().get(node_name).cloned()
|
118 | 117 | }
|
119 | 118 |
|
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 |
| - |
140 | 119 | pub fn all(&self) -> Vec<T> {
|
141 | 120 | let node_name_to_client_guard = self.node_name_to_client.read();
|
142 | 121 | node_name_to_client_guard.values().cloned().collect()
|
@@ -574,36 +553,4 @@ mod test {
|
574 | 553 | );
|
575 | 554 | assert!(assigner.client_for_node("missing").is_none());
|
576 | 555 | }
|
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 |
| - } |
609 | 556 | }
|
0 commit comments