Skip to content

Commit

Permalink
impl load for memstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Jul 25, 2024
1 parent 600915a commit 347029e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sourmash"
version = "0.14.1"
version = "0.15.0"
authors = ["Luiz Irber <luiz@sourmash.bio>", "N. Tessa Pierce-Ward <tessa@sourmash.bio>"]
description = "tools for comparing biological sequences with k-mer sketches"
repository = "https://github.com/sourmash-bio/sourmash"
Expand Down
7 changes: 5 additions & 2 deletions src/core/src/index/revindex/disk_revindex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl RevIndex {
}
self.db.put_cf(&cf_metadata, MANIFEST, &wtr[..])?;

// write storage specdisk_re
// write storage spec
let spec = self.collection.storage().spec();

// TODO: check if spec if memstorage, would probably have to
Expand Down Expand Up @@ -459,7 +459,10 @@ impl RevIndexOps for RevIndex {
}

fn internalize_storage(&mut self) -> Result<()> {
// TODO: check if collection is already internal, if so return
// check if collection is already internal, if so return
if self.collection.storage().spec() == "rocksdb://" {
return Ok(())
}

// build new rocksdb storage from db
let new_storage = RocksDBStorage::from_db(self.db.clone());
Expand Down
12 changes: 10 additions & 2 deletions src/core/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,16 @@ impl Storage for MemStorage {
unimplemented!()
}

fn load(&self, _path: &str) -> Result<Vec<u8>> {
unimplemented!()
fn load(&self, path: &str) -> Result<Vec<u8>> {
let store = self.sigs.read().unwrap();
let sig = store.get(path).unwrap();

let mut buffer = vec![];
{
sig.to_writer(&mut buffer).unwrap();
}

Ok(buffer)
}

fn args(&self) -> StorageArgs {
Expand Down

0 comments on commit 347029e

Please sign in to comment.