MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / add

Method add

code/chapter09/conshash.rs:59–64  ·  view source on GitHub ↗
(&mut self, node: &T)

Source from the content-addressed store, hash-verified

57 }
58
59 fn add(&mut self, node: &T) {
60 for i in 0..self.replicas {
61 let key = hash(&format!("{}{}", node.to_string(), i.to_string()));
62 self.ring.insert(key, node.clone());
63 }
64 }
65
66 // 批量删除结点
67 fn remove_multi(&mut self, nodes: &[T]) {

Callers 2

add_multiMethod · 0.45
mainFunction · 0.45

Calls 2

hashFunction · 0.70
insertMethod · 0.45

Tested by

no test coverage detected