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 std::time::Duration;
use librqbit::{ use librqbit::{
storage::{mmap::MmapStorageFactory, StorageFactoryExt}, storage::{examples::mmap::MmapStorageFactory, StorageFactoryExt},
SessionOptions, SessionOptions,
}; };
use tracing::info; use tracing::info;

View file

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

View file

@ -2,9 +2,10 @@ use anyhow::Context;
use memmap2::{MmapMut, MmapOptions}; use memmap2::{MmapMut, MmapOptions};
use parking_lot::RwLock; use parking_lot::RwLock;
use crate::{FileInfos, ManagedTorrentInfo}; use crate::{
storage::{StorageFactory, TorrentStorage},
use super::{StorageFactory, TorrentStorage}; FileInfos, ManagedTorrentInfo,
};
#[derive(Default)] #[derive(Default)]
pub struct MmapStorageFactory {} 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 rand_distr::Distribution;
use super::{StorageFactory, TorrentStorage}; use crate::storage::{StorageFactory, TorrentStorage};
pub struct SlowStorageFactory<U> { pub struct SlowStorageFactory<U> {
underlying_factory: U, underlying_factory: U,

View file

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

View file

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

View file

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

View file

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