Folders and files are now deleted more comprehensively
This commit is contained in:
parent
7147f16042
commit
ace4bed0c6
13 changed files with 253 additions and 103 deletions
|
|
@ -25,7 +25,7 @@ pub struct InMemoryExampleStorageFactory {}
|
|||
impl StorageFactory for InMemoryExampleStorageFactory {
|
||||
type Storage = InMemoryExampleStorage;
|
||||
|
||||
fn init_storage(
|
||||
fn create(
|
||||
&self,
|
||||
info: &crate::torrent_state::ManagedTorrentInfo,
|
||||
) -> anyhow::Result<InMemoryExampleStorage> {
|
||||
|
|
@ -110,4 +110,12 @@ impl TorrentStorage for InMemoryExampleStorage {
|
|||
file_infos: self.file_infos.clone(),
|
||||
}))
|
||||
}
|
||||
|
||||
fn init(&mut self, _meta: &crate::ManagedTorrentInfo) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn remove_directory_if_empty(&self, _path: &Path) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ pub struct MmapStorage {
|
|||
impl StorageFactory for MmapStorageFactory {
|
||||
type Storage = MmapStorage;
|
||||
|
||||
fn init_storage(&self, info: &ManagedTorrentInfo) -> anyhow::Result<Self::Storage> {
|
||||
fn create(&self, info: &ManagedTorrentInfo) -> anyhow::Result<Self::Storage> {
|
||||
Ok(MmapStorage {
|
||||
mmap: RwLock::new(
|
||||
MmapOptions::new()
|
||||
|
|
@ -62,4 +62,12 @@ impl TorrentStorage for MmapStorage {
|
|||
fn take(&self) -> anyhow::Result<Box<dyn TorrentStorage>> {
|
||||
anyhow::bail!("not implemented")
|
||||
}
|
||||
|
||||
fn init(&mut self, _meta: &ManagedTorrentInfo) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn remove_directory_if_empty(&self, _path: &std::path::Path) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue