Move around storage into folders
This commit is contained in:
parent
6233cc9d12
commit
2c500049e8
10 changed files with 18 additions and 14 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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]>,
|
||||||
|
|
@ -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 {}
|
||||||
2
crates/librqbit/src/storage/examples/mod.rs
Normal file
2
crates/librqbit/src/storage/examples/mod.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
pub mod inmemory;
|
||||||
|
pub mod mmap;
|
||||||
2
crates/librqbit/src/storage/middleware/mod.rs
Normal file
2
crates/librqbit/src/storage/middleware/mod.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
pub mod slow;
|
||||||
|
pub mod timing;
|
||||||
|
|
@ -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,
|
||||||
|
|
@ -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,
|
||||||
|
|
@ -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},
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue