pub struct EventService<P> { /* private fields */ }Expand description
Durable tonic event service.
Implementations§
Source§impl<P> EventService<P>where
P: EventSource,
impl<P> EventService<P>where
P: EventSource,
Sourcepub fn new(
store: Arc<Mutex<SessionStore>>,
provider: Arc<P>,
poll_interval: Duration,
) -> Result<EventService<P>, EventServiceConfigError>
pub fn new( store: Arc<Mutex<SessionStore>>, provider: Arc<P>, poll_interval: Duration, ) -> Result<EventService<P>, EventServiceConfigError>
Construct a service sharing one durable session database and provider.
§Errors
Returns EventServiceConfigError::ZeroPollInterval when the polling
fallback is zero.
Sourcepub fn with_limits(self, limits: EventServiceLimits) -> EventService<P>
pub fn with_limits(self, limits: EventServiceLimits) -> EventService<P>
Replace the default resource policy advertised and enforced by the service.
Sourcepub fn with_source_operation_timeout(
self,
timeout: Duration,
) -> Result<EventService<P>, EventServiceConfigError>
pub fn with_source_operation_timeout( self, timeout: Duration, ) -> Result<EventService<P>, EventServiceConfigError>
Bound source operations that would otherwise stall session control traffic indefinitely. Provider wakeups remain independently cancelable.
§Errors
Returns EventServiceConfigError::ZeroSourceOperationTimeout when
timeout is zero.
Sourcepub fn with_client_hello_timeout(
self,
timeout: Duration,
) -> Result<EventService<P>, EventServiceConfigError>
pub fn with_client_hello_timeout( self, timeout: Duration, ) -> Result<EventService<P>, EventServiceConfigError>
Bound how long a newly opened stream may remain unnegotiated. This protects the pre-lease path, which is intentionally outside the active durable-session quota.
§Errors
Returns EventServiceConfigError::ZeroClientHelloTimeout when
timeout is zero.
Sourcepub fn with_client_send_timeout(
self,
timeout: Duration,
) -> Result<EventService<P>, EventServiceConfigError>
pub fn with_client_send_timeout( self, timeout: Duration, ) -> Result<EventService<P>, EventServiceConfigError>
Bound response backpressure from a client that stops reading its stream.
§Errors
Returns EventServiceConfigError::ZeroClientSendTimeout when
timeout is zero.
Install a connection-level authorization policy.
Sourcepub fn metrics(&self) -> EventServiceMetrics
pub fn metrics(&self) -> EventServiceMetrics
Shared operational counters for health endpoints or metrics exporters.
Sourcepub fn active_session_count(&self) -> u64
pub fn active_session_count(&self) -> u64
Current number of leased sessions.
Sourcepub fn shutdown_handle(&self) -> EventServiceShutdown
pub fn shutdown_handle(&self) -> EventServiceShutdown
Obtain a signal that should be triggered together with the tonic server’s graceful-shutdown future so long-lived bidirectional streams can close.
Sourcepub fn into_server(self) -> EventStreamServer<EventService<P>>
pub fn into_server(self) -> EventStreamServer<EventService<P>>
Wrap this implementation in the generated tonic server.
Trait Implementations§
Source§impl<P> Clone for EventService<P>
impl<P> Clone for EventService<P>
Source§fn clone(&self) -> EventService<P>
fn clone(&self) -> EventService<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<P> EventStream for EventService<P>where
P: EventSource,
impl<P> EventStream for EventService<P>where
P: EventSource,
Source§type SessionStream = Pin<Box<dyn Stream<Item = Result<ServerMessage, Status>> + Send>>
type SessionStream = Pin<Box<dyn Stream<Item = Result<ServerMessage, Status>> + Send>>
Source§fn session<'life0, 'async_trait>(
&'life0 self,
request: Request<Streaming<ClientMessage>>,
) -> Pin<Box<dyn Future<Output = Result<Response<<EventService<P> as EventStream>::SessionStream>, Status>> + Send + 'async_trait>>where
'life0: 'async_trait,
EventService<P>: 'async_trait,
fn session<'life0, 'async_trait>(
&'life0 self,
request: Request<Streaming<ClientMessage>>,
) -> Pin<Box<dyn Future<Output = Result<Response<<EventService<P> as EventStream>::SessionStream>, Status>> + Send + 'async_trait>>where
'life0: 'async_trait,
EventService<P>: 'async_trait,
Auto Trait Implementations§
impl<P> !RefUnwindSafe for EventService<P>
impl<P> !UnwindSafe for EventService<P>
impl<P> Freeze for EventService<P>
impl<P> Send for EventService<P>
impl<P> Sync for EventService<P>
impl<P> Unpin for EventService<P>
impl<P> UnsafeUnpin for EventService<P>where
Arc<P>: UnsafeUnpin,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§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