Clone storage factories...
This commit is contained in:
parent
07a5b69a25
commit
427f490a61
10 changed files with 62 additions and 21 deletions
|
|
@ -6,13 +6,13 @@ use std::{
|
|||
|
||||
use anyhow::Context;
|
||||
|
||||
use crate::torrent_state::ManagedTorrentInfo;
|
||||
use crate::{storage::StorageFactoryExt, torrent_state::ManagedTorrentInfo};
|
||||
|
||||
use crate::storage::{StorageFactory, TorrentStorage};
|
||||
|
||||
use super::opened_file::OpenedFile;
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Clone, Copy)]
|
||||
pub struct FilesystemStorageFactory {}
|
||||
|
||||
impl StorageFactory for FilesystemStorageFactory {
|
||||
|
|
@ -59,6 +59,10 @@ impl StorageFactory for FilesystemStorageFactory {
|
|||
opened_files: files,
|
||||
})
|
||||
}
|
||||
|
||||
fn clone_box(&self) -> crate::storage::BoxStorageFactory {
|
||||
self.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FilesystemStorage {
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ use parking_lot::RwLock;
|
|||
|
||||
use crate::torrent_state::ManagedTorrentInfo;
|
||||
|
||||
use crate::storage::{StorageFactory, TorrentStorage};
|
||||
use crate::storage::{StorageFactory, StorageFactoryExt, TorrentStorage};
|
||||
|
||||
use super::{FilesystemStorage, FilesystemStorageFactory};
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Clone, Copy)]
|
||||
pub struct MmapFilesystemStorageFactory {}
|
||||
|
||||
type OpenedMmap = RwLock<MmapMut>;
|
||||
|
|
@ -36,6 +36,10 @@ impl StorageFactory for MmapFilesystemStorageFactory {
|
|||
fs: fs_storage,
|
||||
})
|
||||
}
|
||||
|
||||
fn clone_box(&self) -> crate::storage::BoxStorageFactory {
|
||||
self.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MmapFilesystemStorage {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue