2024-01-03 10:24:52 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate tracing;
|
|
|
|
|
2024-07-04 06:04:17 +00:00
|
|
|
pub mod auto_sync;
|
2024-01-03 10:24:52 +00:00
|
|
|
mod context;
|
|
|
|
mod controllers;
|
|
|
|
mod service;
|
|
|
|
pub mod test_util;
|
|
|
|
|
|
|
|
pub use controllers::FileSyncInfo;
|
|
|
|
use duration_str::deserialize_duration;
|
|
|
|
use serde::Deserialize;
|
|
|
|
pub use service::{SyncMessage, SyncReceiver, SyncRequest, SyncResponse, SyncSender, SyncService};
|
|
|
|
use std::time::Duration;
|
|
|
|
|
2024-01-19 06:04:59 +00:00
|
|
|
#[derive(Clone, Copy, Debug, Deserialize)]
|
2024-01-03 10:24:52 +00:00
|
|
|
#[serde(default)]
|
|
|
|
pub struct Config {
|
2024-01-19 06:04:59 +00:00
|
|
|
pub auto_sync_enabled: bool,
|
2024-01-03 10:24:52 +00:00
|
|
|
pub max_sync_files: usize,
|
2024-01-19 06:04:59 +00:00
|
|
|
pub sync_file_by_rpc_enabled: bool,
|
|
|
|
pub sync_file_on_announcement_enabled: bool,
|
2024-07-04 06:04:17 +00:00
|
|
|
|
|
|
|
// auto_sync config
|
|
|
|
pub max_sequential_workers: usize,
|
|
|
|
#[serde(deserialize_with = "deserialize_duration")]
|
|
|
|
pub find_peer_timeout: Duration,
|
2024-01-03 10:24:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Config {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
2024-01-19 06:04:59 +00:00
|
|
|
auto_sync_enabled: false,
|
2024-07-02 03:52:52 +00:00
|
|
|
max_sync_files: 8,
|
2024-01-19 06:04:59 +00:00
|
|
|
sync_file_by_rpc_enabled: true,
|
|
|
|
sync_file_on_announcement_enabled: false,
|
2024-07-04 06:04:17 +00:00
|
|
|
|
|
|
|
max_sequential_workers: 8,
|
|
|
|
find_peer_timeout: Duration::from_secs(10),
|
2024-01-03 10:24:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|