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

Method deserialize

src/models/inverted_index.rs:337–366  ·  view source on GitHub ↗
(root_path: PathBuf, quantization_bits: u8)

Source from the content-addressed store, hash-verified

335 }
336
337 pub fn deserialize(root_path: PathBuf, quantization_bits: u8) -> Result<Self, BufIoError> {
338 let dim_file = OpenOptions::new()
339 .read(true)
340 .write(true)
341 .create(true)
342 .truncate(false)
343 .open(root_path.join("index-tree.dim"))?;
344 let node_size = InvertedIndexNode::get_serialized_size(quantization_bits);
345 let dim_bufman = Arc::new(BufferManager::new(dim_file, node_size as usize * 1000)?);
346 let offset_counter = AtomicU32::new(dim_bufman.file_size() as u32);
347 let data_bufmans = Arc::new(BufferManagerFactory::new(
348 root_path.into(),
349 |root, version: &VersionNumber| root.join(format!("{}.idat", **version)),
350 8192,
351 ));
352 let cache = InvertedIndexCache::new(dim_bufman, data_bufmans);
353
354 Ok(Self {
355 root: InvertedIndexNode::deserialize(
356 &cache.dim_bufman,
357 &cache.data_bufmans,
358 FileOffset(0),
359 VersionNumber::from(u32::MAX), // not used
360 &cache,
361 )?,
362 cache,
363 offset_counter,
364 node_size,
365 })
366 }
367}

Callers

nothing calls this directly

Calls 3

FileOffsetClass · 0.85
file_sizeMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected