MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / get

Method get

nodedb/src/control/server/pgwire/handler/prepared/plan_cache.rs:99–116  ·  view source on GitHub ↗

Look up cached physical tasks for the given SQL. On a hit returns both the cached tasks and the `DescriptorVersionSet` they were built against — the caller feeds the set into `SharedState::acquire_plan_lease_scope` so cache hits and fresh plans share the same lease-acquisition path. Returns `None` if not cached or if any recorded descriptor version has bumped / been dropped. Stale entries are ev

(
        &mut self,
        sql: &str,
        current_version: F,
    )

Source from the content-addressed store, hash-verified

97 /// descriptor version has bumped / been dropped. Stale
98 /// entries are evicted automatically.
99 pub fn get<F>(
100 &mut self,
101 sql: &str,
102 current_version: F,
103 ) -> Option<(Vec<PhysicalTask>, DescriptorVersionSet)>
104 where
105 F: Fn(&DescriptorId) -> Option<u64>,
106 {
107 let key = hash_sql(sql);
108 let entry = self.entries.get(&key)?;
109 if entry.versions.all_fresh(&current_version) {
110 return Some((entry.tasks.clone(), entry.versions.clone()));
111 }
112 // Stale — evict.
113 self.entries.remove(&key);
114 self.order.retain(|k| *k != key);
115 None
116 }
117
118 /// Store compiled physical tasks in the cache along with
119 /// the descriptor version set they were built against.

Callers 15

handle_commitMethod · 0.45
handle_rollbackMethod · 0.45
is_listeningMethod · 0.45
channels_forMethod · 0.45
should_deliverMethod · 0.45
execute_single_sqlMethod · 0.45
reproject_responseFunction · 0.45
reproject_star_responseFunction · 0.45
dispatch_task_innerMethod · 0.45
parse_fetchFunction · 0.45
extract_affected_countFunction · 0.45
retry_on_schema_changeFunction · 0.45

Calls 4

all_freshMethod · 0.80
hash_sqlFunction · 0.70
cloneMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected