-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(overlay-client): simplify overlay client
- Loading branch information
Showing
11 changed files
with
495 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use std::time::Duration; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
use tycho_util::serde_helpers; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[serde(default)] | ||
#[non_exhaustive] | ||
pub struct PublicOverlayClientConfig { | ||
/// The interval at which neighbours list is updated. | ||
/// | ||
/// Default: 2 minutes. | ||
#[serde(with = "serde_helpers::humantime")] | ||
pub neighbours_update_interval: Duration, | ||
|
||
/// The interval at which current neighbours are pinged. | ||
/// | ||
/// Default: 30 seconds. | ||
#[serde(with = "serde_helpers::humantime")] | ||
pub neighbours_ping_interval: Duration, | ||
|
||
/// The maximum number of neighbours to keep. | ||
/// | ||
/// Default: 5. | ||
pub max_neighbours: usize, | ||
|
||
/// The maximum number of ping tasks to run concurrently. | ||
/// | ||
/// Default: 5. | ||
pub max_ping_tasks: usize, | ||
|
||
/// The default roundtrip time to use when a neighbour is added. | ||
/// | ||
/// Default: 300 ms. | ||
#[serde(with = "serde_helpers::humantime")] | ||
pub default_roundtrip: Duration, | ||
} | ||
|
||
impl Default for PublicOverlayClientConfig { | ||
fn default() -> Self { | ||
Self { | ||
neighbours_update_interval: Duration::from_secs(2 * 60), | ||
neighbours_ping_interval: Duration::from_secs(30), | ||
max_neighbours: 5, | ||
max_ping_tasks: 5, | ||
default_roundtrip: Duration::from_millis(300), | ||
} | ||
} | ||
} |
Oops, something went wrong.