Skip to main content

AppHandle

Struct AppHandle 

Source
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

Source

pub fn manifest(&self) -> &Manifest

The membership run() applies.

Source

pub fn worker(&self) -> Option<&Worker>

The worker of all the app’s aggregates; none if it has none.

Source

pub fn listeners(&self) -> &[ListenerHandle]

Every read model and reactor of the app, live ones too.

Source

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.

Source

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.

Source

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.

Source

pub fn stop(&self)

Ends run: stops the worker and every listener.

Source

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§

Source§

impl Clone for AppHandle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for AppHandle

§

impl !UnwindSafe for AppHandle

§

impl Forget for AppHandle

§

impl Freeze for AppHandle
where *const ArcInner<AppInner> is !null: Freeze, PhantomData<ArcInner<AppInner>>: Freeze,

§

impl Move for AppHandle

§

impl Send for AppHandle
where Arc<AppInner>: Send,

§

impl Sync for AppHandle
where Arc<AppInner>: Sync,

§

impl Unpin for AppHandle
where Arc<AppInner>: Unpin,

§

impl UnsafeUnpin for AppHandle
where *const ArcInner<AppInner> is !null: UnsafeUnpin, PhantomData<ArcInner<AppInner>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more