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

Method get_versions

src/models/versioning.rs:316–334  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

314 }
315
316 pub fn get_versions(&self) -> lmdb::Result<Vec<VersionInfo>> {
317 let txn = self.env.begin_ro_txn()?;
318 let mut cursor = txn.open_ro_cursor(self.db)?;
319 let current_version = self.get_current_version_inner(&txn)?;
320 let mut versions = Vec::with_capacity(*current_version as usize);
321 for (k, v) in cursor.iter_from(&key!(v:VersionNumber(0))) {
322 if k.len() != 5 {
323 break;
324 }
325
326 if k[0] != 0 {
327 break;
328 }
329
330 versions.push(VersionInfo::deserialize(v).map_err(|_| lmdb::Error::Corrupted)?);
331 }
332 versions.sort_unstable_by_key(|v| *v.version);
333 Ok(versions)
334 }
335
336 pub fn get_versions_starting_from_exclusive(
337 &self,

Callers 4

list_versionsFunction · 0.80
get_current_versionFunction · 0.80
indexing_statusMethod · 0.80

Calls 3

lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected