MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / scan_prefix

Method scan_prefix

graphlite/src/storage/persistent/memory.rs:71–82  ·  view source on GitHub ↗
(
        &self,
        prefix: &[u8],
    )

Source from the content-addressed store, hash-verified

69 }
70
71 fn scan_prefix(
72 &self,
73 prefix: &[u8],
74 ) -> StorageResult<Box<dyn Iterator<Item = StorageResult<(Vec<u8>, Vec<u8>)>> + '_>> {
75 let data = self.data.read();
76 let items: Vec<_> = data
77 .iter()
78 .filter(|(k, _)| k.starts_with(prefix))
79 .map(|(k, v)| Ok((k.clone(), v.clone())))
80 .collect();
81 Ok(Box::new(items.into_iter()))
82 }
83
84 fn batch_get(&self, keys: &[&[u8]]) -> StorageResult<Vec<Option<Vec<u8>>>> {
85 let data = self.data.read();

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected