#[non_exhaustive]pub struct OpenStreamConfig {
pub enabled: bool,
pub max_concurrent_streams: usize,
pub max_buffered_chunks_per_stream: usize,
pub max_buffered_bytes_per_stream: usize,
pub idle_timeout_ms: u64,
pub probe_timeout_ms: u64,
pub close_grace_period_ms: u64,
pub max_total_timeout_ms: Option<u64>,
}Expand description
CEP-41 open-stream configuration shared by both transports.
Bundles the capability gate plus the reader buffering/keepalive knobs.
Attached to
NostrServerTransportConfig
and NostrClientTransportConfig
via their with_open_stream builders.
Disabled by default (opt-in): open-stream is neither advertised nor
activated until enabled (matching the TS SDK’s default). Opt in with
OpenStreamConfig::enabled or with_enabled(true). Once on, it is safe for
non-CEP-41 peers — the server activates only for advertising clients, and a
writer is injected only when a request carries a progressToken.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.enabled: boolMaster gate, false by default. When false the capability is neither
advertised nor activated, and the server does not learn a client’s flag.
max_concurrent_streams: usizeUpper bound on concurrently active streams (per peer/registry).
max_buffered_chunks_per_stream: usizeUpper bound on buffered + queued chunks held for a single stream.
max_buffered_bytes_per_stream: usizeUpper bound on buffered + queued payload bytes held for a single stream.
idle_timeout_ms: u64Idle interval after which a reader probes the peer with a ping (ms).
probe_timeout_ms: u64Time a reader waits for a pong after probing before aborting (ms).
close_grace_period_ms: u64Grace period after a close with unresolved gaps before aborting (ms).
max_total_timeout_ms: Option<u64>Optional hard cap on total stream lifetime (ms).
None (the default) means no lifetime cap. When set, only
call_tool_stream reads it (the registry and keepalive sweep never do);
it is not the CEP-22 DEFAULT_OVERSIZED_MAX_TOTAL_TIMEOUT.
Implementations§
Source§impl OpenStreamConfig
impl OpenStreamConfig
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Enable or disable open-stream support.
Sourcepub fn with_max_concurrent_streams(self, max: usize) -> Self
pub fn with_max_concurrent_streams(self, max: usize) -> Self
Set the upper bound on concurrently active streams.
Sourcepub fn with_max_buffered_chunks_per_stream(self, max: usize) -> Self
pub fn with_max_buffered_chunks_per_stream(self, max: usize) -> Self
Set the upper bound on buffered + queued chunks per stream.
Sourcepub fn with_max_buffered_bytes_per_stream(self, max: usize) -> Self
pub fn with_max_buffered_bytes_per_stream(self, max: usize) -> Self
Set the upper bound on buffered + queued payload bytes per stream.
Sourcepub fn with_idle_timeout_ms(self, ms: u64) -> Self
pub fn with_idle_timeout_ms(self, ms: u64) -> Self
Set the idle interval before a reader probes with a ping (ms).
Sourcepub fn with_probe_timeout_ms(self, ms: u64) -> Self
pub fn with_probe_timeout_ms(self, ms: u64) -> Self
Set the time a reader waits for a pong before aborting (ms).
Sourcepub fn with_close_grace_period_ms(self, ms: u64) -> Self
pub fn with_close_grace_period_ms(self, ms: u64) -> Self
Set the close grace period before aborting on unresolved gaps (ms).
Sourcepub fn with_max_total_timeout_ms(self, ms: Option<u64>) -> Self
pub fn with_max_total_timeout_ms(self, ms: Option<u64>) -> Self
Set the optional hard cap on total stream lifetime (ms).
Trait Implementations§
Source§impl Clone for OpenStreamConfig
impl Clone for OpenStreamConfig
Source§fn clone(&self) -> OpenStreamConfig
fn clone(&self) -> OpenStreamConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenStreamConfig
impl Debug for OpenStreamConfig
Source§impl Default for OpenStreamConfig
impl Default for OpenStreamConfig
Source§impl From<&OpenStreamConfig> for OpenStreamRegistryPolicy
impl From<&OpenStreamConfig> for OpenStreamRegistryPolicy
Source§fn from(config: &OpenStreamConfig) -> Self
fn from(config: &OpenStreamConfig) -> Self
Project the registry-relevant knobs of an OpenStreamConfig into an
OpenStreamRegistryPolicy (the reader admission/buffering policy).
Auto Trait Implementations§
impl Freeze for OpenStreamConfig
impl RefUnwindSafe for OpenStreamConfig
impl Send for OpenStreamConfig
impl Sync for OpenStreamConfig
impl Unpin for OpenStreamConfig
impl UnsafeUnpin for OpenStreamConfig
impl UnwindSafe for OpenStreamConfig
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