#[non_exhaustive]pub enum Request {
Show 27 variants
Ping,
ListFlock,
Describe {
selector: SelectorSpec,
},
Start {
apps: Vec<AppConfig>,
},
Add {
apps: Vec<AppConfig>,
},
ConfigDrift {
apps: Vec<AppConfig>,
},
ApplyConfig {
apps: Vec<DeclaredApp>,
reset: ResetDepth,
},
Stop {
selector: SelectorSpec,
},
Restart {
selector: SelectorSpec,
},
Reload {
selector: SelectorSpec,
},
Delete {
selector: SelectorSpec,
},
Scale {
name: String,
count: u32,
},
SetSmit {
sheep: String,
smit: Option<Smit>,
},
Reopen {
selector: SelectorSpec,
},
Flush {
selector: SelectorSpec,
},
Trigger {
selector: SelectorSpec,
action: String,
params: Option<String>,
},
Signal {
selector: SelectorSpec,
signal: String,
},
SendLine {
selector: SelectorSpec,
line: String,
},
SaveRoll,
Muster,
DogConfig {
name: String,
},
EnableDog {
name: String,
source: DogSource,
},
DisableDog {
name: String,
},
DogStaleness,
HandoverFitness,
KillDaemon,
Subscribe {
topics: Vec<String>,
},
}Expand description
One RPC request
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ping
Liveness check
ListFlock
Full flock listing
Describe
Detailed info for matching sheep
Fields
selector: SelectorSpecWhich sheep
Start
Register + start apps
Fields
apps: Vec<AppConfig>App configs. The daemon must re-normalize them, since peer input
is untrusted; failures return RpcErrorCode::InvalidConfig
Add
Register apps as flock members without starting any of them
Each app lands Stopped and holds no pid; shep add is the verb.
Idempotent by name: an app the flock already has is answered as it
stands, running or not, and nothing about it changes.
Self::ApplyConfig merges a template into one the flock already
has, and shep add sends both.
Answers Response::Added.
Fields
apps: Vec<AppConfig>App configs, carried exactly as Self::Start carries them. The
daemon must re-normalize them, since peer input is untrusted;
failures return RpcErrorCode::InvalidConfig
ConfigDrift
Ask which of apps name a sheep the flock already has under a
different config
Read-only. Self::Start on an already-registered name adds
instances rather than reconciling config.
Answers Response::Drifted with one SheepDrift per app that is
both registered and different. An app the flock does not have is
absent from the answer, not reported as unchanged.
Fields
apps: Vec<AppConfig>The configs to compare against, exactly as Self::Start would
carry them. The daemon must re-normalize them: peer input is
untrusted, and an unnormalized config would report every default
it has not spelled out as a difference. Failures return
RpcErrorCode::InvalidConfig.
ApplyConfig
Merge each declared app into the sheep of the same name, applying what can be applied and parking the rest for that sheep’s next spawn
Nothing is registered, nothing is pruned and nothing running is
killed: an app the flock does not have is refused by name, and a
field the running child was spawned from waits for a shep reload.
Additive by default; reset widens it.
Answers Response::Applied with one SheepApplied per entry in
apps, in the order given, found or not and changed or not. One
app’s refusal rides in SheepApplied::refused and does not cost
the rest of the file its load.
Fields
apps: Vec<DeclaredApp>The apps to merge in, each carrying the keys its document
literally wrote. The daemon must re-normalize the merge result,
since peer input is untrusted, and refuses the whole request with
RpcErrorCode::InvalidConfig when two entries share a name:
the second would be merged against a store the first has not
written yet.
reset: ResetDepthHow much of what the operator has set since a template last
loaded this request may overwrite. Default ResetDepth::None,
which overwrites nothing.
Spelled none/file/env/policy on the wire.
Stop
Stop matching sheep (stay registered)
Fields
selector: SelectorSpecWhich sheep
Restart
Restart matching sheep
Fields
selector: SelectorSpecWhich sheep
Reload
Replace each matching sheep with a fresh instance of the same app, one instance of an app at a time, so the app has a window in which it can stay reachable across the swap
Fields
selector: SelectorSpecWhich sheep. No default: a reload replaces running processes.
Delete
Stop + deregister matching sheep
Fields
selector: SelectorSpecWhich sheep
Scale
Set how many instances one app runs (see shep stock).
Takes a name where every other verb takes a SelectorSpec:
instances is a per-app number and slots are allocated against the
same-name group, so a selector matching two apps could mean four of
each or four in total.
The count is absolute: two operators sending +2 against the same
app would get a number neither asked for.
Fields
name: StringThe app’s name, exactly as its config spells it. Not a selector: no
all, no regex, no fold:.
count: u32How many instances the app has when this returns. 0 is refused
with RpcErrorCode::InvalidConfig: shep delete is the verb
for removing an app.
SetSmit
Attach a short marker to sheep for shep flock to paint, or clear
it with None.
By name, not a selector: a smit belongs to a sheep, and every instance of that name shows it, one spawned after the paint included.
Held in memory and scoped to the connection that sent it, so a publisher republishes rather than publishing on change.
Reopen
Reopen every matched sheep’s log files, for an external rotator that
has renamed them (create-mode rotation)
Fields
selector: SelectorSpecWhich sheep
Flush
Empty every matched sheep’s log files: flush what is still pending, then truncate the recorded paths
Fields
selector: SelectorSpecWhich sheep. No default: this destroys log data.
Trigger
Send a named action to every matched sheep over its shepherd channel
and report what each app says back (see shep trigger).
Fields
selector: SelectorSpecWhich sheep. No default, matching every other verb that reaches a running process.
Signal
Deliver one signal to every matched sheep’s own process, never its
process group (see shep signal).
Fields
selector: SelectorSpecWhich sheep. No default, matching every other verb that reaches a running process.
signal: StringThe signal’s name, as
OperatorSignal spells it. The
SIG prefix and the case are both optional; a name outside the
grammar answers RpcErrorCode::InvalidConfig.
SendLine
Write one line to every matched sheep’s stdin (see shep whisper).
Fields
selector: SelectorSpecWhich sheep. No default, matching every other verb that reaches a running process.
line: StringThe line, without its terminator: the shepherd appends exactly
one \n when it writes.
A line containing an embedded newline is refused
(RpcErrorCode::InvalidConfig): it would deliver two commands
where the operator typed one.
SaveRoll
Write the muster roll now, bypassing the snapshot writer’s debounce
Muster
Assemble the flock from the muster roll on disk: start every app the roll recorded running, leaving every app the flock already has exactly as it stands
DogConfig
Ask for one dog’s [dog.<name>] section, as the dog itself parses it
EnableDog
Start one dog now, marking it as coming from source
DisableDog
Stop and deregister one dog
Answers Response::Deleted: disabling deregisters exactly as
Delete does.
DogStaleness
Ask which dogs this daemon has given up on, and which it is still
waiting to hear from (shep daemon reload).
Read-only, and about this daemon’s own handshakes: take the reading
after a reload, not before one. Never sent to an older daemon, on
Self::HandoverFitness’s terms.
Answers Response::DogStaleness.
HandoverFitness
Ask whether this daemon could hand its flock to a successor in place,
rather than stopping it and starting it again (shep daemon reload).
Read-only: the handover itself is triggered by a signal, which reaches a daemon that refuses the client at the handshake.
Answers Response::HandoverFitness. A refusal is a feature the
running daemon cannot carry, not an error: the caller falls back to a
stop-and-start and prints the reason. Never sent to an older daemon:
shep-cli’s commands::daemon gates it on the crate version the
handshake reported.
KillDaemon
Graceful daemon shutdown
Subscribe
Subscribe this connection to bus topics (glob patterns)