mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-25 22:21:13 +10:00
refactor: Convert some things from static to const and refactor into drop-consts
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
7
drop-consts/Cargo.toml
Normal file
7
drop-consts/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "drop-consts"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
dirs = "6.0.0"
|
||||
23
drop-consts/src/lib.rs
Normal file
23
drop-consts/src/lib.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use std::{cell::LazyCell, path::PathBuf};
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
pub const DATA_ROOT_PREFIX: &str = "drop";
|
||||
#[cfg(debug_assertions)]
|
||||
pub const DATA_ROOT_PREFIX: &str = "drop-debug";
|
||||
|
||||
pub const DATA_ROOT_DIR: LazyCell<PathBuf> = LazyCell::new(|| {
|
||||
dirs::data_dir()
|
||||
.expect("Failed to get data dir")
|
||||
.join(DATA_ROOT_PREFIX)
|
||||
});
|
||||
|
||||
pub const DROP_DATA_PATH: &str = ".dropdata";
|
||||
|
||||
// Downloads
|
||||
pub const MAX_PACKET_LENGTH: usize = 4096 * 4;
|
||||
pub const BUMP_SIZE: usize = 4096 * 16;
|
||||
|
||||
pub const RETRY_COUNT: usize = 3;
|
||||
|
||||
pub const TARGET_BUCKET_SIZE: usize = 63 * 1000 * 1000;
|
||||
pub const MAX_FILES_PER_BUCKET: usize = (1024 / 4) - 1;
|
||||
Reference in New Issue
Block a user