pub struct ServerBuilder { /* private fields */ }Implementations§
Source§impl ServerBuilder
impl ServerBuilder
pub fn consensus_driver(self, driver: Arc<dyn ConsensusDriver>) -> Self
pub fn clock(self, clock: Arc<dyn Clock>) -> Self
pub fn window_ahead(self, window_ahead: Duration) -> Self
pub fn failover_advance(self, failover_advance: Duration) -> Self
Sourcepub fn shutdown_grace(self, shutdown_grace: Duration) -> Self
pub fn shutdown_grace(self, shutdown_grace: Duration) -> Self
Bound on how long a graceful shutdown waits for the leader-watch task to stop cooperatively before forcibly aborting it.
On shutdown the server drops the watch task’s cancel signal and waits for
it to publish NotServing and return. That wait is normally
near-instant, but the task observes cancellation only at its select!
boundaries — never inside a fence attempt. A consensus driver whose
load_high_water / persist_high_water never returns (the trait places
no latency bound) would otherwise park the task mid-fence and block
process exit indefinitely, leading to a SIGKILL on a Kubernetes drain.
Once shutdown_grace elapses the server aborts the task so exit always
makes progress. Set this comfortably below your deployment’s
terminationGracePeriodSeconds. Defaults to 10s. A value of zero aborts
immediately without waiting for a cooperative stop.
Sourcepub fn heartbeat_interval(self, interval: Duration) -> Self
pub fn heartbeat_interval(self, interval: Duration) -> Self
Interval between heartbeat log lines emitted at target = "tsoracle::heartbeat".
Defaults to 10 seconds. Pass Duration::ZERO to disable the heartbeat task entirely.
The heartbeat surfaces serving role, current epoch, requests served, timestamps issued, and key error counters every interval — proof-of-life for production deployments that may not have a metrics exporter installed.
Requires feature = "tracing" to emit output; with tracing off the
setter is accepted but no task is spawned (no subscriber to log to).
Sourcepub fn tls_config(self, cfg: ServerTlsConfig) -> Self
pub fn tls_config(self, cfg: ServerTlsConfig) -> Self
Configure TLS termination for this server. Applied inside
Server::serve, Server::serve_with_shutdown, and
Server::serve_with_listener. Not applied to Server::into_router —
embedders mounting tsoracle alongside their own services control TLS
on their own tonic builder.
pub fn build(self) -> Result<Server, BuildError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServerBuilder
impl !RefUnwindSafe for ServerBuilder
impl Send for ServerBuilder
impl Sync for ServerBuilder
impl Unpin for ServerBuilder
impl UnsafeUnpin for ServerBuilder
impl !UnwindSafe for ServerBuilder
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> 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