expose the number of database in the index-scheduler and rewrite the lib.rs to use the value provided in the options instead of a magic number

This commit is contained in:
Tamo 2025-01-22 15:23:07 +01:00 committed by Louis Dureuil
parent 705d31e8bd
commit e41ebd3047
No known key found for this signature in database
8 changed files with 105 additions and 54 deletions

View file

@ -197,6 +197,10 @@ impl IndexScheduler {
}
}
pub(crate) const fn nb_db() -> u32 {
Queue::nb_db() + IndexMapper::nb_db() + features::FeatureData::nb_db()
}
/// Create an index scheduler and start its run loop.
#[allow(private_interfaces)] // because test_utils is private
pub fn new(
@ -232,7 +236,7 @@ impl IndexScheduler {
let env = unsafe {
heed::EnvOpenOptions::new()
.max_dbs(19)
.max_dbs(Self::nb_db())
.map_size(budget.task_db_size)
.open(&options.tasks_path)
}?;