pub struct StreamClient { /* private fields */ }Expand description
An async client for the satd satd.events.v1 streaming API.
Debug is hand-written to redact the auth credential — never derive it here.
Implementations§
Source§impl StreamClient
impl StreamClient
Sourcepub fn builder(endpoint: impl Into<String>) -> StreamClientBuilder
pub fn builder(endpoint: impl Into<String>) -> StreamClientBuilder
Start building a client for endpoint (e.g. http://node:50051, or
https://node:50051 with tls).
Sourcepub fn node_version(&self) -> Option<String>
pub fn node_version(&self) -> Option<String>
The version the node advertised on the most recently opened stream, e.g.
"0.6.0".
None until a stream has been opened, and when the node predates the
satd-version header (0.5.x and older).
Sourcepub async fn subscribe(
&mut self,
opts: SubscribeOptions,
) -> Result<EventStream, StreamError>
pub async fn subscribe( &mut self, opts: SubscribeOptions, ) -> Result<EventStream, StreamError>
Open a server-streaming firehose. Requires the stream:subscribe
capability when the server enforces auth.
Sourcepub fn resilient_subscribe(
&self,
opts: SubscribeOptions,
config: ResilientConfig,
) -> ResilientSubscription
pub fn resilient_subscribe( &self, opts: SubscribeOptions, config: ResilientConfig, ) -> ResilientSubscription
Open a reconnect-and-replay-aware firehose. Unlike subscribe,
the returned ResilientSubscription
reconnects with backoff, persists and replays the resume cursor, recovers
from Lagged per the LagPolicy, and surfaces
replay-truncation gaps. Connects lazily on the first
next.
Sourcepub fn resilient_watch(&self, config: ResilientWatchConfig) -> ResilientWatch
pub fn resilient_watch(&self, config: ResilientWatchConfig) -> ResilientWatch
Open a reconnect-and-replay-aware bidirectional watch. Unlike
watch, the returned ResilientWatch
mirrors the watch-set and re-registers it on reconnect, re-anchors off the
deterministic set_cursor results, and persists the resume cursor.
Connects lazily on the first next.
Sourcepub async fn watch(&mut self) -> Result<(WatchHandle, EventStream), StreamError>
pub async fn watch(&mut self) -> Result<(WatchHandle, EventStream), StreamError>
Open a bidirectional watch stream, returning a WatchHandle to send
control messages and an EventStream of matches + firehose.
Trait Implementations§
Source§impl Clone for StreamClient
impl Clone for StreamClient
Auto Trait Implementations§
impl !Freeze for StreamClient
impl !RefUnwindSafe for StreamClient
impl !UnwindSafe for StreamClient
impl Send for StreamClient
impl Sync for StreamClient
impl Unpin for StreamClient
impl UnsafeUnpin for StreamClient
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request