Clear have_bitfield on error

This commit is contained in:
Igor Katson 2024-08-21 18:21:15 +01:00
parent b7ed850918
commit c697809e50
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
8 changed files with 88 additions and 32 deletions

View file

@ -3,6 +3,7 @@ use crate::{api::TorrentIdOrHash, bitv::BitV, type_aliases::BF};
#[async_trait::async_trait]
pub trait BitVFactory: Send + Sync {
async fn load(&self, id: TorrentIdOrHash) -> anyhow::Result<Option<Box<dyn BitV>>>;
async fn clear(&self, id: TorrentIdOrHash) -> anyhow::Result<()>;
async fn store_initial_check(
&self,
id: TorrentIdOrHash,
@ -18,6 +19,10 @@ impl BitVFactory for NonPersistentBitVFactory {
Ok(None)
}
async fn clear(&self, _id: TorrentIdOrHash) -> anyhow::Result<()> {
Ok(())
}
async fn store_initial_check(
&self,
_id: TorrentIdOrHash,