use brk_error::Result;
use brk_indexer::Indexer;
use vecdb::Exit;

use super::Vecs;
use crate::indexes;

impl Vecs {
    pub(crate) fn compute(
        &mut self,
        indexer: &Indexer,
        indexes: &indexes::Vecs,
        exit: &Exit,
    ) -> Result<()> {
        let starting_lengths = indexer.safe_lengths();

        self.weight.derive_from(
            indexer,
            indexes,
            &starting_lengths,
            &indexer.vecs.transactions.weight,
            exit,
        )?;

        Ok(())
    }
}
