MCPcopy Create free account
hub / github.com/cosdata/cosdata / get

Method get

src/models/buffered_io.rs:112–129  ·  view source on GitHub ↗
(&self, key: K)

Source from the content-addressed store, hash-verified

110 }
111
112 pub fn get(&self, key: K) -> Result<Arc<BufferManager>, BufIoError> {
113 self.bufmans
114 .entry(key.clone())
115 .or_try_insert_with(|| {
116 let path = (self.path_function)(&self.root_path, &key);
117
118 let file = OpenOptions::new()
119 .read(true)
120 .write(true)
121 .create(true)
122 .truncate(false)
123 .open(&path)?;
124 let bufman = Arc::new(BufferManager::new(file, self.buffer_size)?);
125
126 Ok(bufman)
127 })
128 .map(|bufman_ref| bufman_ref.value().clone())
129 }
130
131 pub fn flush_all(&self) -> Result<(), BufIoError> {
132 for bufman in self.bufmans.iter() {

Callers 5

cursor_positionMethod · 0.45
read_with_cursorMethod · 0.45
write_with_cursorMethod · 0.45
from_versionedMethod · 0.45
test_seek_with_cursorFunction · 0.45

Calls 2

cloneMethod · 0.80
readMethod · 0.45

Tested by 1

test_seek_with_cursorFunction · 0.36