pub struct DrainState { /* private fields */ }Expand description
Cloneable gate shared by transports, dispatchers, worker streams, and the shutdown coordinator.
Implementations§
Source§impl DrainState
impl DrainState
Sourcepub fn is_draining(&self) -> bool
pub fn is_draining(&self) -> bool
Return whether drain has begun and new workflow/activity starts must be rejected.
Sourcepub fn begin(&self) -> bool
pub fn begin(&self) -> bool
Mark the server draining. Returns true for the first caller that changed the state.
Sourcepub fn ensure_accepting(
&self,
namespace: &str,
activity_type: &str,
) -> Result<(), ServerError>
pub fn ensure_accepting( &self, namespace: &str, activity_type: &str, ) -> Result<(), ServerError>
Reject a new unit of work if drain has already begun.
§Errors
Returns ServerError::WorkerDispatch with a stable drain message when work is closed.
Sourcepub fn notify_activity_drained(&self)
pub fn notify_activity_drained(&self)
Wake waiters after in-flight accounting may have reached zero.
Trait Implementations§
Source§impl Clone for DrainState
impl Clone for DrainState
Source§fn clone(&self) -> DrainState
fn clone(&self) -> DrainState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DrainState
impl Debug for DrainState
Source§impl Default for DrainState
impl Default for DrainState
Source§fn default() -> DrainState
fn default() -> DrainState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DrainState
impl RefUnwindSafe for DrainState
impl Send for DrainState
impl Sync for DrainState
impl Unpin for DrainState
impl UnsafeUnpin for DrainState
impl UnwindSafe for DrainState
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
Mutably borrows from an owned value. Read more
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request