ckb_sync/
lib.rs

1//! # The Sync module
2//!
3//! Sync module implement ckb sync protocol as specified here:
4//! <https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0004-ckb-block-sync/0004-ckb-block-sync.md>
5
6mod filter;
7pub(crate) mod net_time_checker;
8mod relayer;
9mod status;
10mod synchronizer;
11mod types;
12mod utils;
13
14#[cfg(test)]
15mod tests;
16
17pub use crate::filter::BlockFilter;
18pub use crate::net_time_checker::NetTimeProtocol;
19pub use crate::relayer::Relayer;
20pub use crate::status::{Status, StatusCode};
21pub use crate::synchronizer::Synchronizer;
22pub use crate::types::{ActiveChain, SyncShared};
23use ckb_constant::sync::MAX_BLOCKS_IN_TRANSIT_PER_PEER;
24
25// Time recording window size, ibd period scheduler dynamically adjusts frequency
26// for acquisition/analysis generating dynamic time range
27pub(crate) const TIME_TRACE_SIZE: usize = MAX_BLOCKS_IN_TRANSIT_PER_PEER * 4;
28// Fast Zone Boundaries for the Time Window
29pub(crate) const FAST_INDEX: usize = TIME_TRACE_SIZE / 3;
30// Normal Zone Boundaries for the Time Window
31pub(crate) const NORMAL_INDEX: usize = TIME_TRACE_SIZE * 4 / 5;
32// Low Zone Boundaries for the Time Window
33pub(crate) const LOW_INDEX: usize = TIME_TRACE_SIZE * 9 / 10;
34
35pub(crate) const LOG_TARGET_RELAY: &str = "ckb_relay";
36
37pub(crate) const LOG_TARGET_FILTER: &str = "ckb_filter";