Renames
This commit is contained in:
parent
b4512e4809
commit
451debedbb
19 changed files with 127 additions and 114 deletions
|
|
@ -6,7 +6,7 @@ use std::{
|
|||
use anyhow::Context;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{storage::StorageFactoryExt, torrent_state::ManagedTorrentInfo};
|
||||
use crate::{storage::StorageFactoryExt, torrent_state::ManagedTorrentShared};
|
||||
|
||||
use crate::storage::{StorageFactory, TorrentStorage};
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ pub struct FilesystemStorageFactory {}
|
|||
impl StorageFactory for FilesystemStorageFactory {
|
||||
type Storage = FilesystemStorage;
|
||||
|
||||
fn create(&self, meta: &ManagedTorrentInfo) -> anyhow::Result<FilesystemStorage> {
|
||||
fn create(&self, meta: &ManagedTorrentShared) -> anyhow::Result<FilesystemStorage> {
|
||||
Ok(FilesystemStorage {
|
||||
output_folder: meta.options.output_folder.clone(),
|
||||
opened_files: Default::default(),
|
||||
|
|
@ -149,7 +149,7 @@ impl TorrentStorage for FilesystemStorage {
|
|||
}
|
||||
}
|
||||
|
||||
fn init(&mut self, meta: &ManagedTorrentInfo) -> anyhow::Result<()> {
|
||||
fn init(&mut self, meta: &ManagedTorrentShared) -> anyhow::Result<()> {
|
||||
let mut files = Vec::<OpenedFile>::new();
|
||||
for file_details in meta.info.iter_file_details(&meta.lengths)? {
|
||||
let mut full_path = self.output_folder.clone();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use anyhow::Context;
|
|||
use memmap2::{MmapMut, MmapOptions};
|
||||
use parking_lot::RwLock;
|
||||
|
||||
use crate::torrent_state::ManagedTorrentInfo;
|
||||
use crate::torrent_state::ManagedTorrentShared;
|
||||
|
||||
use crate::storage::{StorageFactory, StorageFactoryExt, TorrentStorage};
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ fn dummy_mmap() -> anyhow::Result<MmapMut> {
|
|||
impl StorageFactory for MmapFilesystemStorageFactory {
|
||||
type Storage = MmapFilesystemStorage;
|
||||
|
||||
fn create(&self, meta: &ManagedTorrentInfo) -> anyhow::Result<Self::Storage> {
|
||||
fn create(&self, meta: &ManagedTorrentShared) -> anyhow::Result<Self::Storage> {
|
||||
let fs_storage = FilesystemStorageFactory::default().create(meta)?;
|
||||
|
||||
Ok(MmapFilesystemStorage {
|
||||
|
|
@ -97,7 +97,7 @@ impl TorrentStorage for MmapFilesystemStorage {
|
|||
}))
|
||||
}
|
||||
|
||||
fn init(&mut self, meta: &ManagedTorrentInfo) -> anyhow::Result<()> {
|
||||
fn init(&mut self, meta: &ManagedTorrentShared) -> anyhow::Result<()> {
|
||||
self.fs.init(meta)?;
|
||||
let mut mmaps = Vec::new();
|
||||
for (idx, file) in self.fs.opened_files.iter().enumerate() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue