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

Method get

nodedb/src/engine/sparse/btree.rs:229–247  ·  view source on GitHub ↗

Point lookup: retrieve a document by collection + document_id (tenant-scoped).

(
        &self,
        tenant_id: u64,
        collection: &str,
        document_id: &str,
    )

Source from the content-addressed store, hash-verified

227
228 /// Point lookup: retrieve a document by collection + document_id (tenant-scoped).
229 pub fn get(
230 &self,
231 tenant_id: u64,
232 collection: &str,
233 document_id: &str,
234 ) -> crate::Result<Option<Vec<u8>>> {
235 with_tenant_key(tenant_id, collection, document_id, |key| {
236 let read_txn = self.db.begin_read().map_err(|e| redb_err("read txn", e))?;
237 let table = read_txn
238 .open_table(DOCUMENTS)
239 .map_err(|e| redb_err("open table", e))?;
240
241 match table.get(key) {
242 Ok(Some(value)) => Ok(Some(value.value().to_vec())),
243 Ok(None) => Ok(None),
244 Err(e) => Err(redb_err("get", e)),
245 }
246 })
247 }
248
249 /// Approximate byte count for all documents in a single
250 /// `(tenant_id, collection)` pair. Sums the raw value sizes via a

Callers 15

index_documentMethod · 0.45
lookupMethod · 0.45
exists_in_txnMethod · 0.45
get_rawMethod · 0.45
index_documentMethod · 0.45
searchMethod · 0.45
write_index_dataMethod · 0.45
update_stats_in_txnMethod · 0.45
remove_documentMethod · 0.45
phrase_searchMethod · 0.45
readFunction · 0.45
readFunction · 0.45

Calls 3

with_tenant_keyFunction · 0.85
redb_errFunction · 0.70
to_vecMethod · 0.45

Tested by

no test coverage detected