mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-02-03 18:55:17 +00:00
9b4b0436c3
* refactor p2p signed message * add new pubsub messages in network layer to find chunks * handle find chunks pubsub message in router * Supports to sync partial chunks * add admin rpc to sync chunks * limit number of chunks to sync at a time * refactor code to sync file and chunks * add more switches to trigger file sync * fix ut failure * refactor code
38 lines
978 B
Rust
38 lines
978 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: 100,
|
|
find_peer_timeout: Duration::from_secs(30),
|
|
sync_file_by_rpc_enabled: true,
|
|
sync_file_on_announcement_enabled: false,
|
|
}
|
|
}
|
|
}
|