pub struct ExchangeConfig {Show 14 fields
pub piece_size: u64,
pub block_size: usize,
pub request_window: usize,
pub max_piece_retries: u32,
pub materialize_limit: u64,
pub recv_timeout: Duration,
pub serve_idle_timeout: Duration,
pub upload_bytes_per_sec: Option<u64>,
pub download_bytes_per_sec: Option<u64>,
pub max_sources: usize,
pub ban_after_corrupt: u32,
pub max_piece_size: u64,
pub max_artifact_bytes: u64,
pub redistribution: Arc<dyn RedistributionPolicy>,
}Expand description
Tunables for one node’s exchange.
Fields§
§piece_size: u64Piece size for artifacts seeded here.
block_size: usizeBytes of piece data per piece frame.
request_window: usizePieces requested per round trip.
max_piece_retries: u32Bad copies of one piece accepted from one peer before giving up on that piece from that peer.
materialize_limit: u64Completed artifacts up to this size are also stored whole under their content hash, so package verification can read them.
recv_timeout: DurationLongest wait for one frame from a peer.
serve_idle_timeout: DurationLongest a serve session waits for the fetcher’s next request before closing the stream.
upload_bytes_per_sec: Option<u64>Cap on bytes sent to peers per second (None = unlimited).
download_bytes_per_sec: Option<u64>Cap on bytes received from peers per second (None = unlimited).
max_sources: usizeMost peers a swarm fetch pulls from at once.
ban_after_corrupt: u32Corrupt pieces from one peer before it is banned (1 = first).
max_piece_size: u64Largest piece size accepted in a peer’s descriptor. A descriptor above it is refused before any piece is requested.
max_artifact_bytes: u64Largest total size accepted in a peer’s descriptor (an exact size from a signed manifest, when the caller has one, is checked as well).
redistribution: Arc<dyn RedistributionPolicy>Who may be handed what this node holds. Fixed for the exchange’s
lifetime; the default is crate::mesh_swarm_state::ManifestPolicy.
Implementations§
Source§impl ExchangeConfig
impl ExchangeConfig
Sourcepub fn validate(&self) -> Result<(), ExchangeError>
pub fn validate(&self) -> Result<(), ExchangeError>
Check sizes against the protocol limits.
Trait Implementations§
Source§impl Clone for ExchangeConfig
impl Clone for ExchangeConfig
Source§impl Debug for ExchangeConfig
impl Debug for ExchangeConfig
Auto Trait Implementations§
impl !RefUnwindSafe for ExchangeConfig
impl !UnwindSafe for ExchangeConfig
impl Freeze for ExchangeConfig
impl Send for ExchangeConfig
impl Sync for ExchangeConfig
impl Unpin for ExchangeConfig
impl UnsafeUnpin for ExchangeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more