Use actual BitV and factory everywhere
This commit is contained in:
parent
a55dfc6e0e
commit
bc9e72df60
7 changed files with 57 additions and 53 deletions
|
|
@ -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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue