pub struct PaymentConfig {
pub rate_per_mb: Option<u64>,
pub credit_max: Option<Bytes>,
pub credit_ramp_divisor: Option<u64>,
pub frame_target_bytes: Option<Bytes>,
pub voucher_commit_interval_ms: Option<u64>,
}Expand description
Payment section of the config file.
Fields§
§rate_per_mb: Option<u64>Rate per MB in USDC base units.
credit_max: Option<Bytes>Downstream credit-window ceiling in bytes (ADR 003 §Credit window). The
per-stream window ramps toward this cap as the stream pays, bounding the
node’s credit exposure (unbilled egress already on the wire) to
paid / credit_ramp_divisor; the client’s exposure stays zero (vouchers
are cumulative over delivered bytes). Absent =>
crate::config::DEFAULT_CREDIT_MAX (64 MiB). Floored at one chunk
(decdn_protocol::client::CHUNK_BYTES, 1 MiB); a value at or below one
chunk reproduces the strict stop-and-wait cadence — deliver a chunk, then
recoup it. It is node-local config, not a governance-owned parameter — no
contract holds a delivery-cadence value.
credit_ramp_divisor: Option<u64>Ramp divisor for the credit window (ADR 003 §Credit window): the window is
paid / credit_ramp_divisor, floored at one chunk and capped at
Self::credit_max. Absent => crate::config::DEFAULT_CREDIT_RAMP_DIVISOR
(2). 0 opens the full ceiling immediately, reproducing the flat-window
behavior. It is node-local config, not a governance-owned parameter.
frame_target_bytes: Option<Bytes>Target wire-frame size for the serve path, in bytes (ADR 005
§cdn/client/v1). Absent => crate::config::DEFAULT_FRAME_TARGET_BYTES
(1 MiB). Must be > 0.
Node-local policy that is never negotiated: no message carries it, the payer
accepts any non-empty frame, and both bao verification and the payment meter
are defined over byte counts rather than frame boundaries. Raising it lowers
per-frame CPU per byte served, up to one CHUNK_BYTES payment interval
(1 MiB) — a frame never crosses a payment-chunk boundary, so a larger value
is rejected rather than silently ignored. The serve loop also clamps each
frame to the credit window’s remaining room, so a large value does not widen
credit exposure.
voucher_commit_interval_ms: Option<u64>Background flush period for the lane store, in ms. See
crate::config::DEFAULT_VOUCHER_COMMIT_INTERVAL_MS (5 s). Must be > 0.
Trait Implementations§
Source§impl Debug for PaymentConfig
impl Debug for PaymentConfig
Source§impl Default for PaymentConfig
impl Default for PaymentConfig
Source§impl<'de> Deserialize<'de> for PaymentConfig
impl<'de> Deserialize<'de> for PaymentConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PaymentConfig
impl RefUnwindSafe for PaymentConfig
impl Send for PaymentConfig
impl Sync for PaymentConfig
impl Unpin for PaymentConfig
impl UnsafeUnpin for PaymentConfig
impl UnwindSafe for PaymentConfig
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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