Closed ctb closed 5 days ago
what do you think about (1) fixing scaled for a database when constructing, and (2) provide a scaled() on the RevIndex?
luiz:
Yes for both, and I’m OK stuffing more into METADATA because this is at the db level, not sig
feels like this gels a bit with #3387, which is updating Manifest
records with scaled
from select
.
I think the idea would be to make sure that RocksDB-revindex are built only from CollectionSet
(which I think is already the case) and then upgrade CollectionSet
to make sure there is only one scaled (it already checks ksize, moltype, etc.)
Looking at the code, we might want to introduce an explicit select
in the try_from
, since with the updates from #3387 that would update the scaled.
impl TryFrom<Collection> for CollectionSet {
type Error = crate::Error;
fn try_from(collection: Collection) -> Result<Self> {
let first = if let Some(first) = collection.manifest.first() {
first
} else {
// empty collection is consistent ¯\_(ツ)_/¯
return Ok(Self { collection });
};
collection
.manifest
.iter()
.skip(1)
.try_for_each(|c| first.check_compatible(c))?;
Ok(Self { collection })
}
}
impl CollectionSet {
pub fn into_inner(self) -> Collection {
self.collection
}
pub fn selection(&self) -> Selection {
todo!("Extract selection from first sig")
}
...
}
ok, I'm hesitating to run a select
as that will change the function signature - we'd either need to do a clone or change the collection.
In #3397, I add min_max_scaled()
and enforce that they are the same when converting a Collection
into a CollectionSet
.
from slack -
me:
luizirber:
me:
code in
manysearch_rocksdb.rs
over insourmash_plugin_branchwater
: