Skip to content

Commit

Permalink
Remove BIGSI and SBT code (#2732)
Browse files Browse the repository at this point in the history
(spun off #2230, might help with #2665)

BIGSI and SBT are prototype-level code (and some of the first Rust code
I wrote...), and mostly makes it harder to change/refactor other parts
of the codebase.

Can bring it back later in the future if needed, but `mastiff` cover
many of the same use cases.
  • Loading branch information
luizirber committed Aug 27, 2023
1 parent d0e3726 commit ba581ea
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 1,787 deletions.
4 changes: 0 additions & 4 deletions src/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ proptest = { version = "1.2.0", default-features = false, features = ["std"]}
rand = "0.8.2"
tempfile = "3.7.1"

[[bench]]
name = "index"
harness = false

[[bench]]
name = "compute"
harness = false
Expand Down
83 changes: 0 additions & 83 deletions src/core/benches/index.rs

This file was deleted.

218 changes: 0 additions & 218 deletions src/core/src/index/bigsi.rs

This file was deleted.

36 changes: 20 additions & 16 deletions src/core/src/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
//! An index organizes signatures to allow for fast similarity search.
//! Some indices also support containment searches.

pub mod bigsi;
pub mod linear;
pub mod revindex;
pub mod sbt;

pub mod search;

Expand All @@ -18,27 +16,13 @@ use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;

use crate::errors::ReadDataError;
use crate::index::sbt::{Node, SBT};
use crate::index::search::{search_minhashes, search_minhashes_containment};
use crate::prelude::*;
use crate::signature::SigsTrait;
use crate::sketch::nodegraph::Nodegraph;
use crate::sketch::Sketch;
use crate::storage::{InnerStorage, Storage};
use crate::Error;

pub type MHBT = SBT<Node<Nodegraph>, Signature>;

/* FIXME: bring back after MQF works on macOS and Windows
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(not(target_arch = "wasm32"))] {
use mqf::MQF;
pub type MHMT = SBT<Node<MQF>, Signature>;
}
}
*/

pub trait Index<'a> {
type Item: Comparable<Self::Item>;
//type SignatureIterator: Iterator<Item = Self::Item>;
Expand Down Expand Up @@ -188,6 +172,26 @@ impl ReadData<Signature> for SigStore<Signature> {
}
}

impl<T> SigStore<T>
where
T: ToWriter,
{
pub fn save(&self, path: &str) -> Result<String, Error> {
if let Some(storage) = &self.storage {
if let Some(data) = self.data.get() {
let mut buffer = Vec::new();
data.to_writer(&mut buffer)?;

Ok(storage.save(path, &buffer)?)
} else {
unimplemented!()
}
} else {
unimplemented!()
}
}
}

impl SigStore<Signature> {
pub fn count_common(&self, other: &SigStore<Signature>) -> u64 {
let ng: &Signature = self.data().unwrap();
Expand Down
Loading

0 comments on commit ba581ea

Please sign in to comment.