MCPcopy Create free account
hub / github.com/apache/datafusion / remove

Method remove

datafusion/execution/src/cache/lru_queue.rs:155–192  ·  view source on GitHub ↗

Removes a specific entry from the queue, if it exists.

(&mut self, key: &K)

Source from the content-addressed store, hash-verified

153
154 /// Removes a specific entry from the queue, if it exists.
155 pub fn remove(&mut self, key: &K) -> Option<V> {
156 if let Some((old_node, old_value)) = self.data.remove(key) {
157 let LruNode { key: _, prev, next } = &*old_node.lock();
158 match (prev, next) {
159 // single node in the queue
160 (None, None) => {
161 self.queue.head = None;
162 self.queue.tail = None;
163 }
164 // removed the head node
165 (None, Some(n)) => {
166 let n_strong =
167 n.upgrade().expect("value has been unexpectedly dropped");
168 n_strong.lock().prev = None;
169 self.queue.head = Some(Weak::clone(n));
170 }
171 // removed the tail node
172 (Some(p), None) => {
173 let p_strong =
174 p.upgrade().expect("value has been unexpectedly dropped");
175 p_strong.lock().next = None;
176 self.queue.tail = Some(Weak::clone(p));
177 }
178 // removed a middle node
179 (Some(p), Some(n)) => {
180 let n_strong =
181 n.upgrade().expect("value has been unexpectedly dropped");
182 let p_strong =
183 p.upgrade().expect("value has been unexpectedly dropped");
184 n_strong.lock().prev = Some(Weak::clone(p));
185 p_strong.lock().next = Some(Weak::clone(n));
186 }
187 };
188 Some(old_value)
189 } else {
190 None
191 }
192 }
193
194 /// Returns the number of entries in the queue.
195 pub fn len(&self) -> usize {

Callers 15

plan_unpivotFunction · 0.45
deregister_tableMethod · 0.45
remove_planMethod · 0.45
remove_resultMethod · 0.45
is_expr_partial_constMethod · 0.45
remove_scopeFunction · 0.45
f_upMethod · 0.45
only_exprMethod · 0.45
only_inputMethod · 0.45
only_two_inputsMethod · 0.45

Calls

no outgoing calls