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

Method get_entry_meta

nodedb/src/engine/kv/hash_table/api.rs:56–76  ·  view source on GitHub ↗

Get entry metadata without returning the value. Returns the TTL state and expiry timestamp for a key, used by the KV engine to cancel old expiry entries before updates. Does NOT check expiry — returns metadata even for expired keys, since the caller needs the original `expire_at_ms` for cancellation.

(&self, key: &[u8])

Source from the content-addressed store, hash-verified

54 /// Does NOT check expiry — returns metadata even for expired keys,
55 /// since the caller needs the original `expire_at_ms` for cancellation.
56 pub fn get_entry_meta(&self, key: &[u8]) -> Option<EntryMeta> {
57 let h = hash_key(key);
58
59 if let Some(entry) = self.probe_find(&self.slots, h, key) {
60 return Some(EntryMeta {
61 has_ttl: entry.has_ttl(),
62 expire_at_ms: entry.expire_at_ms,
63 });
64 }
65
66 if let Some(old) = &self.rehash_source
67 && let Some(entry) = self.probe_find(old, h, key)
68 {
69 return Some(EntryMeta {
70 has_ttl: entry.has_ttl(),
71 expire_at_ms: entry.expire_at_ms,
72 });
73 }
74
75 None
76 }
77
78 /// Insert or update a key-value pair. Returns the old value bytes if overwritten.
79 ///

Callers 7

atomic_putMethod · 0.80
get_ttl_msMethod · 0.80
putMethod · 0.80
deleteMethod · 0.80
expireMethod · 0.80
persistMethod · 0.80

Calls 3

hash_keyFunction · 0.85
probe_findMethod · 0.80
has_ttlMethod · 0.45

Tested by 1