0g-storage-node/node/sync/src/lib.rs
Bo QIU 5bc5bbd696
Enhance log level (#103)
* reduce default find peers timeout for auto sync

* opt log level to avoid too many noisy info logs
2024-07-02 11:52:52 +08:00

38 lines
976 B
Rust

#[macro_use]
extern crate tracing;
mod auto_sync;
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;
#[derive(Clone, Copy, Debug, Deserialize)]
#[serde(default)]
pub struct Config {
pub auto_sync_enabled: bool,
pub max_sync_files: usize,
#[serde(deserialize_with = "deserialize_duration")]
pub find_peer_timeout: Duration,
pub sync_file_by_rpc_enabled: bool,
pub sync_file_on_announcement_enabled: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
auto_sync_enabled: false,
max_sync_files: 8,
find_peer_timeout: Duration::from_secs(10),
sync_file_by_rpc_enabled: true,
sync_file_on_announcement_enabled: false,
}
}
}