Split out TorrentMetadata
This commit is contained in:
parent
e440f03970
commit
100b7116df
20 changed files with 411 additions and 225 deletions
|
|
@ -4,6 +4,7 @@ A storage middleware that logs the time underlying storage operations took.
|
|||
|
||||
use crate::{
|
||||
storage::{StorageFactory, StorageFactoryExt, TorrentStorage},
|
||||
torrent_state::TorrentMetadata,
|
||||
ManagedTorrentShared,
|
||||
};
|
||||
|
||||
|
|
@ -25,10 +26,14 @@ impl<U> TimingStorageFactory<U> {
|
|||
impl<U: StorageFactory + Clone> StorageFactory for TimingStorageFactory<U> {
|
||||
type Storage = TimingStorage<U::Storage>;
|
||||
|
||||
fn create(&self, info: &crate::ManagedTorrentShared) -> anyhow::Result<Self::Storage> {
|
||||
fn create(
|
||||
&self,
|
||||
shared: &crate::ManagedTorrentShared,
|
||||
metadata: &TorrentMetadata,
|
||||
) -> anyhow::Result<Self::Storage> {
|
||||
Ok(TimingStorage {
|
||||
name: self.name.clone(),
|
||||
underlying: self.underlying_factory.create(info)?,
|
||||
underlying: self.underlying_factory.create(shared, metadata)?,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +109,11 @@ impl<U: TorrentStorage> TorrentStorage for TimingStorage<U> {
|
|||
self.underlying.remove_directory_if_empty(path)
|
||||
}
|
||||
|
||||
fn init(&mut self, meta: &ManagedTorrentShared) -> anyhow::Result<()> {
|
||||
self.underlying.init(meta)
|
||||
fn init(
|
||||
&mut self,
|
||||
shared: &ManagedTorrentShared,
|
||||
metadata: &TorrentMetadata,
|
||||
) -> anyhow::Result<()> {
|
||||
self.underlying.init(shared, metadata)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue