MCPcopy Create free account
hub / github.com/dfinity/orbit / remove

Method remove

core/control-panel/impl/src/repositories/user.rs:79–96  ·  view source on GitHub ↗
(&self, key: &UserKey)

Source from the content-addressed store, hash-verified

77 }
78
79 fn remove(&self, key: &UserKey) -> Option<User> {
80 DB.with(|m| {
81 let prev = m.borrow_mut().remove(key);
82
83 // Update metrics when a user is removed.
84 if let Some(prev) = &prev {
85 USER_METRICS.with(|metrics| {
86 metrics
87 .iter()
88 .for_each(|metric| metric.borrow_mut().sub(prev))
89 });
90
91 self.remove_entry_indexes(prev);
92 }
93
94 prev
95 })
96 }
97}
98
99impl UserRepository {

Callers 7

test_user_metricsFunction · 0.45
remove_by_idMethod · 0.45
remove_userMethod · 0.45
deleteMethod · 0.45
remove_entry_indexesMethod · 0.45
check_user_removalFunction · 0.45

Calls 3

iterMethod · 0.80
subMethod · 0.45
remove_entry_indexesMethod · 0.45

Tested by 3

test_user_metricsFunction · 0.36
check_user_removalFunction · 0.36