Skip to main content

OpenStreamConfig

Struct OpenStreamConfig 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§enabled: bool

Master 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: usize

Upper bound on concurrently active streams (per peer/registry).

§max_buffered_chunks_per_stream: usize

Upper bound on buffered + queued chunks held for a single stream.

§max_buffered_bytes_per_stream: usize

Upper bound on buffered + queued payload bytes held for a single stream.

§idle_timeout_ms: u64

Idle interval after which a reader probes the peer with a ping (ms).

§probe_timeout_ms: u64

Time a reader waits for a pong after probing before aborting (ms).

§close_grace_period_ms: u64

Grace 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

Source

pub fn enabled() -> Self

An explicitly enabled config with all other knobs at their defaults.

Source

pub fn with_enabled(self, enabled: bool) -> Self

Enable or disable open-stream support.

Source

pub fn with_max_concurrent_streams(self, max: usize) -> Self

Set the upper bound on concurrently active streams.

Source

pub fn with_max_buffered_chunks_per_stream(self, max: usize) -> Self

Set the upper bound on buffered + queued chunks per stream.

Source

pub fn with_max_buffered_bytes_per_stream(self, max: usize) -> Self

Set the upper bound on buffered + queued payload bytes per stream.

Source

pub fn with_idle_timeout_ms(self, ms: u64) -> Self

Set the idle interval before a reader probes with a ping (ms).

Source

pub fn with_probe_timeout_ms(self, ms: u64) -> Self

Set the time a reader waits for a pong before aborting (ms).

Source

pub fn with_close_grace_period_ms(self, ms: u64) -> Self

Set the close grace period before aborting on unresolved gaps (ms).

Source

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

Source§

fn clone(&self) -> OpenStreamConfig

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 OpenStreamConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for OpenStreamConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&OpenStreamConfig> for OpenStreamRegistryPolicy

Source§

fn from(config: &OpenStreamConfig) -> Self

Project the registry-relevant knobs of an OpenStreamConfig into an OpenStreamRegistryPolicy (the reader admission/buffering policy).

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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