Use actual BitV and factory everywhere

This commit is contained in:
Igor Katson 2024-08-20 20:42:24 +01:00
parent a55dfc6e0e
commit bc9e72df60
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
7 changed files with 57 additions and 53 deletions

View file

@ -1,14 +1,12 @@
use bitvec::{order::Lsb0, vec::BitVec};
use crate::{api::TorrentIdOrHash, bitv::BitV};
use crate::{api::TorrentIdOrHash, bitv::BitV, type_aliases::BF};
#[async_trait::async_trait]
pub trait BitVFactory: Send {
pub trait BitVFactory: Send + Sync {
async fn load(&self, id: TorrentIdOrHash) -> anyhow::Result<Option<Box<dyn BitV>>>;
async fn store_initial_check(
&self,
id: TorrentIdOrHash,
b: BitVec<u8, Lsb0>,
b: BF,
) -> anyhow::Result<Box<dyn BitV>>;
}
@ -21,8 +19,8 @@ impl BitVFactory for NonPersistentBitVFactory {
}
async fn store_initial_check(
&self,
id: TorrentIdOrHash,
b: BitVec<u8, Lsb0>,
_id: TorrentIdOrHash,
b: BF,
) -> anyhow::Result<Box<dyn BitV>> {
Ok(Box::new(b))
}