Skip to main content

NodeOriginConfig

Struct NodeOriginConfig 

Source
pub struct NodeOriginConfig {
Show 14 fields pub probe_fanout: usize, pub pull_timeout: Duration, pub stall_window: Duration, pub min_throughput_bps: u64, pub max_blob_size_bytes: u64, pub max_rate_per_mb: u64, pub event_poll_interval: Duration, pub lookup: LookupConfig, pub own_region: Option<String>, pub serve_economics: Arc<dyn ServeEconomicsPolicy>, pub operator_shares: OperatorShares, pub frequency_estimator: Option<Arc<dyn FrequencyEstimator>>, pub sell_rate_base: u64, pub warming: Arc<WarmingAllowance>,
}
Expand description

Tuning knobs for the node-to-node pull, resolved from [cache] config.

Fields§

§probe_fanout: usize

How many discovered providers to probe before ranking.

§pull_timeout: Duration

Wall-clock bound on the STREAM-OPEN stage of a single upstream pull: connect, handshake, and the signed StreamResponse. Bounded work, so a slow one is a stall.

It does NOT bound the buyer-channel open, which is a separate, earlier stage on its own budget (selection::CHANNEL_OPEN_CALLER_BUDGET, 5 s) — raising this to give a slow L2 more room does nothing. That the two are sequential stages is exactly why outer_pull_deadline budgets both, plus the stall window, for every candidate.

§stall_window: Duration

THROUGHPUT-FLOOR window on the STREAMING stage (#1797). Bytes are counted off the QUIC stream sub-frame, so a pull aborts only when throughput over this window falls below Self::min_throughput_bps — never on a large blob or a big frame. Deliberately not a wall clock: bounding the bytes by wall clock caps the blob size this node can pull through at pull_timeout × link speed, which is the bug this avoids.

§min_throughput_bps: u64

Minimum sustained upstream throughput (bytes/sec) over Self::stall_window; 0 disables the throughput test and leaves idle detection (#1797).

§max_blob_size_bytes: u64

Buyer-side blob-size ceiling (cache.max_blob_size_mb × MB), 0 = unlimited. Enforced on the bytes that ACTUALLY arrive on the miss-pull leg, never on the peer’s unverified total_bytes claim: the pull aborts with BlobTooLarge once cumulative received bytes cross it (#1895).

§max_rate_per_mb: u64

Buyer-side ABSOLUTE per-MB rate ceiling (cache.max_rate_per_mb), 0 = unlimited (#1375). Combined via effective_rate_ceiling with the probe-relative bound (the rate the chosen candidate advertised) so the node refuses a stream quote that exceeds the lower of the two before paying — and retains the signed over-quote as rate-manipulation evidence.

§event_poll_interval: Duration

How often this node’s chain watcher polls for events (blockchain.event_poll_interval_ms), used to size the settle window after a funding recovery step’s top-up (#1530).

The wait is for the UPSTREAM’s watcher, not ours, but every node in the network runs the same default cadence and this is the only local reading of it we have. See funder::settle_wait_budget.

§lookup: LookupConfig

DHT lookup tuning.

§own_region: Option<String>

This node’s self-attested region (identity.region), or None when unset. Used to apply the ADR 030 latency-vs-claim penalty: a probed peer that claims this region yet answers slower than the latency ceiling (REGION_LATENCY_MAX_MS) is a region-spoofing signal. None disables the penalty (nothing to compare against).

§serve_economics: Arc<dyn ServeEconomicsPolicy>

ADR 041 buy-side profitability gate: the most this node pays upstream, per MB, on a cache-miss relay leg. select_policy(&cfg.cache.serve_economics) picks OffPolicy (no ceiling) or MarginPolicy at construction.

§operator_shares: OperatorShares

Live operator fee-share (basis points) from FeeRouter.getShares()[0], the (1 - f) numerator the margin serve-economics policy amortizes over. Seeded from chain at startup and kept current by the fee-shares watcher (crate::fee_shares_watcher::route).

§frequency_estimator: Option<Arc<dyn FrequencyEstimator>>

ADR 040 shared frequency estimator, when built (cache.eviction_policy / cache.admission_policy == "tinylfu", or cache.serve_economics.policy == "margin"). Feeds the margin policy’s heat-estimate ceiling input; None when no consumer needs it.

§sell_rate_base: u64

This node’s configured served rate per MB (payment.rate_per_mb) — the sell rate P_sell, the serve-economics policy’s other input. The same base value the probe handler is constructed with.

§warming: Arc<WarmingAllowance>

ADR 041 per-source warming allowance: bounds the loss from speculative above-floor buys per upstream source node. The buy loop reads available(source) to pick the warm-at-market vs amortized-floor regime, and debits the full buy cost on a successful speculative pull. The SAME Arc is shared with the eviction path (which forgets a dropped hash’s tag) and with the warming-credit aggregator, which applies the realized margin the serve path enqueues on each re-serve.

Trait Implementations§

Source§

impl Clone for NodeOriginConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeOriginConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more