pub struct WaitUntilContext { /* private fields */ }Expand description
A context for managing wait_until tasks within an application. This handles local task execution and coordinates with the runtime via gRPC.
Implementations§
Source§impl WaitUntilContext
impl WaitUntilContext
Sourcepub async fn from_env(application_id: Option<String>) -> Result<Self>
pub async fn from_env(application_id: Option<String>) -> Result<Self>
Creates a new WaitUntilContext and connects to gRPC endpoint from environment variables. This is the recommended way to create a WaitUntilContext in production.
Sourcepub async fn from_env_with_vars(
application_id: Option<String>,
env_vars: &HashMap<String, String>,
) -> Result<Self>
pub async fn from_env_with_vars( application_id: Option<String>, env_vars: &HashMap<String, String>, ) -> Result<Self>
Creates a new WaitUntilContext and connects to gRPC endpoint from provided environment variables.
Sourcepub fn new_with_grpc_client(
application_id: Option<String>,
grpc_client: WaitUntilServiceClient<Channel>,
) -> Self
pub fn new_with_grpc_client( application_id: Option<String>, grpc_client: WaitUntilServiceClient<Channel>, ) -> Self
Creates a new WaitUntilContext with a gRPC client.
Sourcepub fn set_grpc_client(&mut self, client: WaitUntilServiceClient<Channel>)
pub fn set_grpc_client(&mut self, client: WaitUntilServiceClient<Channel>)
Sets the gRPC client for communicating with the runtime.
Sourcepub fn application_id(&self) -> &str
pub fn application_id(&self) -> &str
Gets the application ID.
Sourcepub async fn start_drain_listener(&self) -> Result<()>
pub async fn start_drain_listener(&self) -> Result<()>
Starts a background task that waits for drain signals from the runtime. This should be called once when the application starts.
Trait Implementations§
Source§impl Debug for WaitUntilContext
impl Debug for WaitUntilContext
Source§impl WaitUntil for WaitUntilContext
impl WaitUntil for WaitUntilContext
Source§fn wait_for_drain_signal<'life0, 'async_trait>(
&'life0 self,
timeout_duration: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<DrainConfig>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_for_drain_signal<'life0, 'async_trait>(
&'life0 self,
timeout_duration: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<DrainConfig>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Waits for a drain signal from the runtime.
This is a blocking call that returns when the runtime decides it’s time to drain.
Source§fn drain_all<'life0, 'async_trait>(
&'life0 self,
config: DrainConfig,
) -> Pin<Box<dyn Future<Output = Result<DrainResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn drain_all<'life0, 'async_trait>(
&'life0 self,
config: DrainConfig,
) -> Pin<Box<dyn Future<Output = Result<DrainResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Drains all currently registered tasks.
This waits for all tasks to complete or timeout.
Source§fn get_task_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_task_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets the current number of registered tasks.
Source§fn notify_drain_complete<'life0, 'async_trait>(
&'life0 self,
response: DrainResponse,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn notify_drain_complete<'life0, 'async_trait>(
&'life0 self,
response: DrainResponse,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Notifies the runtime that draining is complete.
impl Binding for WaitUntilContext
Auto Trait Implementations§
impl !Freeze for WaitUntilContext
impl !RefUnwindSafe for WaitUntilContext
impl Send for WaitUntilContext
impl Sync for WaitUntilContext
impl Unpin for WaitUntilContext
impl UnsafeUnpin for WaitUntilContext
impl !UnwindSafe for WaitUntilContext
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
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>
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 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>
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 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>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.