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

Method remove

core/station/impl/src/repositories/user.rs:163–188  ·  view source on GitHub ↗
(&self, key: &UserKey)

Source from the content-addressed store, hash-verified

161 }
162
163 fn remove(&self, key: &UserKey) -> Option<User> {
164 DB.with(|m| {
165 CACHE.with(|cache| cache.borrow_mut().remove(&key.id));
166
167 let prev = m.borrow_mut().remove(key);
168
169 // Update metrics when a user is removed.
170 if let Some(prev) = &prev {
171 USER_METRICS.with(|metrics| {
172 metrics
173 .iter()
174 .for_each(|metric| metric.borrow_mut().sub(prev))
175 });
176 }
177
178 if let Some(prev) = &prev {
179 self.remove_entry_indexes(prev);
180 }
181
182 if let Some(prev) = &prev {
183 self.remove_observer.notify(prev);
184 }
185
186 prev
187 })
188 }
189}
190
191impl UserRepository {

Callers 1

remove_entry_indexesMethod · 0.45

Calls 4

iterMethod · 0.80
subMethod · 0.45
remove_entry_indexesMethod · 0.45
notifyMethod · 0.45

Tested by

no test coverage detected