Skip to main content

Response

Enum Response 

Source
#[non_exhaustive]
pub enum Response {
Show 22 variants Pong, Flock(Vec<ProcessInfo>), Described(Vec<ProcessInfo>), Started(Vec<ProcessInfo>), Drifted(Vec<SheepDrift>), Stopped(Vec<ProcessInfo>), Restarted(Vec<ProcessInfo>), Reloading(Vec<ProcessInfo>), Scaled(Vec<ProcessInfo>), SmitPainted(Vec<ProcessInfo>), Deleted(Vec<u32>), Reopened(Vec<ProcessInfo>), Flushed(Vec<ProcessInfo>), Triggered(Vec<ActionReply>), Signalled(Vec<SignalReply>), SentLine(Vec<LineReply>), RollSaved { path: String, apps: u32, }, Mustered(Vec<ProcessInfo>), DogSection { toml: DogSectionToml, }, DogStarted(ProcessInfo), Subscribed, ShuttingDown,
}
Expand description

One RPC response (pairs with Request variants)

Ten variants carry a bare Vec<ProcessInfo> (Flock, Described, Started, Stopped, Restarted, Reloading, Scaled, Reopened, Flushed, Mustered), and that repetition is intentional — do not collapse them into one. Each names which request it answers, which is what lets a variant diverge later without a protocol bump: Reloading already means an acceptance rather than a result, Scaled already means only the survivors on a scale-down rather than every matched row, and Mustered already means “every sheep of every restored app” rather than “what this call started”. A single Listing(Vec<ProcessInfo>) would have to relitigate all three as a breaking change.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Pong

Answer to Ping

§

Flock(Vec<ProcessInfo>)

Answer to ListFlock

§

Described(Vec<ProcessInfo>)

Answer to Describe

§

Started(Vec<ProcessInfo>)

Answer to Start

§

Drifted(Vec<SheepDrift>)

Answer to ConfigDrift: one entry per app that is registered under a config different from the one asked about, and no entry for anything else. An empty vector means every app asked about either matches or is not registered at all.

§

Stopped(Vec<ProcessInfo>)

Answer to Stop

§

Restarted(Vec<ProcessInfo>)

Answer to Restart

§

Reloading(Vec<ProcessInfo>)

Answer to Reload — an ACCEPTANCE, not a result, and the only reply in this enum carrying a flock listing that names one rather than finished work. Self::ShuttingDown is an acceptance too, sent before the daemon actually goes down, but it carries nothing.

One instance costs a readiness wait plus a drain in the worst case, so a clustered app outlasts any deadline a client is allowed to ask for. The daemon therefore answers as soon as the reload is accepted, with the matched sheep as they stood at that moment, and the swaps report themselves on the bus — process.reload, process.reloaded, process.reload_abandoned. A matched sheep with nothing to replace is listed here as the no-op success it is, so this carries the same matches Describe would.

§

Scaled(Vec<ProcessInfo>)

Answer to Scale — the app’s instances that will REMAIN, one row each, by name and then by id (sort_flock). Every row shares one name here, so that is id order in practice; it is stated as the shared rule rather than as this reply’s own so the two cannot drift.

Scaling up, these are the instances that exist, the new ones included, and the answer is complete.

Scaling down, these are the survivors and the departing instances are deliberately absent, even though they are still running their kill ladders as this reply is written. The operator asked for a number; this is that number of rows. Listing the departing ones as well would answer a scale web 2 with four rows, which is the one thing the reply must not do. The departures report themselves on the bus as process.delete — the same split Reloading already makes between an acceptance and the swaps that follow it.

§

SmitPainted(Vec<ProcessInfo>)

Answer to SetSmit — every instance of the named sheep, one row each, each carrying the smit as it now stands.

Its own variant rather than one of the ten above, on this enum’s own stated terms: each of them names which request it answers so that one can diverge later without a protocol bump. A future SetSmit reply that also reported which connection holds the mark would have nowhere to go if this shared Scaled.

§

Deleted(Vec<u32>)

Answer to Delete — ids removed

§

Reopened(Vec<ProcessInfo>)

Answer to Reopen — every matched sheep, running or not. A sheep with no live log pump has nothing to reopen and is reported as a success, so this carries the same matches Describe would.

§

Flushed(Vec<ProcessInfo>)

Answer to Flush — one row per matched sheep, running or not, exactly as Self::Reopened.

One row per SHEEP, not per file emptied. Several sheep can share one log path (merge_logs, or an explicit out_file on a multi-instance app), and the daemon truncates each distinct path once — but the selector names sheep, so the answer names sheep, and the count here matches what Describe would return for the same selector.

§

Triggered(Vec<ActionReply>)

Answer to Trigger — one ActionReply row per matched sheep, carrying what each one answered rather than a flock listing: ProcessInfo has nowhere to hold a reply body.

§

Signalled(Vec<SignalReply>)

Answer to Signal — one SignalReply row per matched sheep.

Not a flock listing: what a caller wants back is per-instance delivery, and ProcessInfo has nowhere to hold it. Same reasoning, and the same row-shaped answer, as Self::Triggered.

§

SentLine(Vec<LineReply>)

Answer to SendLine — one LineReply row per matched sheep.

§

RollSaved

Answer to SaveRoll

Fields

§path: String

Absolute path of the roll the daemon wrote

§apps: u32

How many apps that roll records

§

Mustered(Vec<ProcessInfo>)

Answer to Muster — every sheep of every app the roll restored, not only the ones this call spawned.

The distinction is the whole point of the reply. Assembling a flock that is already assembled starts nothing, so a listing of what this call spawned would be empty there — indistinguishable from an empty roll, which is the one outcome an operator needs to tell apart.

§

DogSection

Answer to DogConfig — the dog’s own section, rendered back to TOML.

toml is DogSectionToml, not a bare String: this text routinely carries webhook credentials, and the newtype’s manual Debug keeps them out of a {:?}-formatted Response — see that type’s docs for why the section travels over the socket at all.

Fields

§toml: DogSectionToml

The [dog.<name>] table as TOML text, empty when the file has no such section

§

DogStarted(ProcessInfo)

Answer to EnableDog — the dog as it stands now

§

Subscribed

Answer to Subscribe

§

ShuttingDown

Answer to KillDaemon

Trait Implementations§

Source§

impl Clone for Response

Source§

fn clone(&self) -> Response

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
Source§

impl Debug for Response

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Response

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Response

Source§

fn eq(&self, other: &Response) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Response

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Response

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, <T as TryFrom<U>>::Error>

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.