Move around storage into folders

This commit is contained in:
Igor Katson 2024-05-02 18:58:54 +01:00
parent 6233cc9d12
commit 2c500049e8
10 changed files with 18 additions and 14 deletions

View file

@ -1,7 +1,7 @@
use std::time::Duration;
use librqbit::{
storage::{mmap::MmapStorageFactory, StorageFactoryExt},
storage::{examples::mmap::MmapStorageFactory, StorageFactoryExt},
SessionOptions,
};
use tracing::info;

View file

@ -6,7 +6,7 @@ use parking_lot::RwLock;
use crate::type_aliases::FileInfos;
use super::{StorageFactory, TorrentStorage};
use crate::storage::{StorageFactory, TorrentStorage};
struct InMemoryPiece {
bytes: Box<[u8]>,

View file

@ -2,9 +2,10 @@ use anyhow::Context;
use memmap2::{MmapMut, MmapOptions};
use parking_lot::RwLock;
use crate::{FileInfos, ManagedTorrentInfo};
use super::{StorageFactory, TorrentStorage};
use crate::{
storage::{StorageFactory, TorrentStorage},
FileInfos, ManagedTorrentInfo,
};
#[derive(Default)]
pub struct MmapStorageFactory {}

View file

@ -0,0 +1,2 @@
pub mod inmemory;
pub mod mmap;

View file

@ -0,0 +1,2 @@
pub mod slow;
pub mod timing;

View file

@ -2,7 +2,7 @@ use std::time::Duration;
use rand_distr::Distribution;
use super::{StorageFactory, TorrentStorage};
use crate::storage::{StorageFactory, TorrentStorage};
pub struct SlowStorageFactory<U> {
underlying_factory: U,

View file

@ -1,4 +1,4 @@
use super::{StorageFactory, TorrentStorage};
use crate::storage::{StorageFactory, TorrentStorage};
pub struct TimingStorageFactory<U> {
name: String,

View file

@ -1,8 +1,6 @@
pub mod example;
pub mod examples;
pub mod filesystem;
pub mod mmap;
pub mod slow;
pub mod timing;
pub mod middleware;
use std::{
any::{Any, TypeId},

View file

@ -6,7 +6,7 @@ use tracing::info;
use crate::{
create_torrent,
storage::{example::InMemoryExampleStorageFactory, StorageFactoryExt},
storage::{examples::inmemory::InMemoryExampleStorageFactory, StorageFactoryExt},
AddTorrent, CreateTorrentOptions, Session,
};

View file

@ -8,8 +8,9 @@ use librqbit::{
http_api::{HttpApi, HttpApiOptions},
http_api_client, librqbit_spawn,
storage::{
filesystem::FilesystemStorageFactory, slow::SlowStorageFactory,
timing::TimingStorageFactory, StorageFactoryExt,
filesystem::FilesystemStorageFactory,
middleware::{slow::SlowStorageFactory, timing::TimingStorageFactory},
StorageFactoryExt,
},
tracing_subscriber_config_utils::{init_logging, InitLoggingOptions},
AddTorrent, AddTorrentOptions, AddTorrentResponse, Api, ListOnlyResponse,