pub struct AppHandle { /* private fields */ }Expand description
An App on a connection; see Kernable::app. Cloning gives another handle to the same
app, e.g. to call stop() or ready() while another task awaits run().
Implementations§
Source§impl AppHandle
impl AppHandle
Sourcepub fn worker(&self) -> Option<&Worker>
pub fn worker(&self) -> Option<&Worker>
The worker of all the app’s aggregates; none if it has none.
Sourcepub fn listeners(&self) -> &[ListenerHandle]
pub fn listeners(&self) -> &[ListenerHandle]
Every read model and reactor of the app, live ones too.
Sourcepub async fn ready(&self)
pub async fn ready(&self)
Returns once the worker and every listener of the app are connected, its deployment
serves the service (AppHandle::serving) and the domains’ processes are registered;
waits forever if one never connects, so wrap it in tokio::time::timeout where that
matters.
Sourcepub async fn connected(&self)
pub async fn connected(&self)
Returns once the worker and every listener of the app are connected; while another deployment serves, they are warming up beside it.
Sourcepub async fn serving(&self)
pub async fn serving(&self)
Returns once the app’s membership is applied: its deployment serves the service. Right
at the start, unless another deployment serves; then once the app’s deployment has
caught up and taken over (App::switch), or an operator switched to it.
Sourcepub async fn run(&self) -> Result<(), Error>
pub async fn run(&self) -> Result<(), Error>
Applies the membership (see Kernable::apply; it lists the domains’ processes), then
runs the worker and every listener until stop(). If another deployment serves the
service, the kernel switches to this one only as App::switch says: until then the app
runs beside it (workers idle, read models building) and applies its membership again
every second. Once it serves and the worker is ready, it registers the domains’ processes
(Kernable::register_process): a process whose commands no worker runs yet would be
refused. Once all are connected and it serves, it prints an overview of the app (unless
KERNABLE_LOG is below info) instead of their connection lines. Fails only if the
kernel refuses the membership for another reason than the switch (Error::Status); a
failing handler does not end it (a command handler’s error rejects the command, a
listener handler’s error makes the listener reconnect and get the event again), or the
kernel refuses a process (then it stops). A panic in a worker or listener task is passed
on.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AppHandle
impl !UnwindSafe for AppHandle
impl Forget for AppHandle
impl Freeze for AppHandle
impl Move for AppHandle
impl Send for AppHandle
impl Sync for AppHandle
impl Unpin for AppHandle
impl UnsafeUnpin for AppHandlewhere
*const ArcInner<AppInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<AppInner>>: 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
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