#[non_exhaustive]pub enum BusEvent {
Process {
event: ProcessEventKind,
info: ProcessInfo,
manually: bool,
at_ms: u64,
},
LogOut {
id: u32,
line: String,
},
LogErr {
id: u32,
line: String,
},
Channel {
id: u32,
message: ChildMessage,
},
Dropped {
count: u64,
},
DaemonShutdown,
DogConfigChanged {
dog: String,
},
DogSheepSettingsChanged {
dog: String,
sheep: String,
},
}Expand description
One event on the daemon bus
Adjacently tagged: event discriminator, data wrapper. Subscription
topics are the dotted strings from BusEvent::topic (process.exit,
log.out, daemon.*); the daemon’s filter globs against them.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Process
Lifecycle event for one sheep
LogOut
One stdout line from a sheep
LogErr
One stderr line from a sheep
Channel
One message a sheep wrote on its shepherd channel (fd 3).
Child -> shepherd only: the shepherd’s own writes (a shutdown
message, a dispatched action) are reported elsewhere, by
process.stop and Response::Triggered.
message is the app’s own text, whole and unredacted. The daemon
adds nothing of its own; app-provided text must be safe for every
subscriber, since it is broadcast verbatim.
Fields
message: ChildMessageThe message, exactly as it came off fd 3.
Dropped
The bounded queue dropped this many events for this subscriber
DaemonShutdown
Daemon is shutting down
DogConfigChanged
A dog’s section in dogs.toml changed. Published under
config.dog.<name>, so a dog subscribes to its own name and hears
nobody else’s.
Carries only the dog’s name, nothing else: the bus is a broadcast,
and a [bark] section can hold a webhook URL as a bearer credential
(why DogSectionToml redacts its own Debug). A dog that wants
the values re-asks with
Request::DogConfig, which
answers only that dog’s own section.
DogSheepSettingsChanged
A dog’s [app.dogs.<name>] table changed on one sheep. Published
under config.sheep.<dog>, so a dog subscribes to its own name and
hears nobody else’s, the way Self::DogConfigChanged does for
dogs.toml.
Fires once per dog and sheep for a change that adds, removes or
edits that sheep’s table for dog: a name gaining its first table,
the last instance of such a name being deleted, or a load,
Request::SetSheepDogSettings or --reset changing one. Never for
a handover, since that changes no answer.
Carries only the sheep’s name and the dog’s: a table can hold a
credential, the same reason Self::DogConfigChanged carries only
the dog’s own name. A dog that wants the values re-asks with
Request::DogSheepSettings,
which answers with that dog’s tables.
Implementations§
Source§impl BusEvent
impl BusEvent
Sourcepub fn topic(&self) -> Cow<'static, str>
pub fn topic(&self) -> Cow<'static, str>
The dotted subscription topic for this event (spec §6 grammar)
A Cow rather than a &'static str, because two topics are not
fixed: Self::DogConfigChanged and Self::DogSheepSettingsChanged
name their dog in the topic itself, which is what lets a dog
subscribe to its own config and hear nobody else’s. Every other
variant is still a borrowed literal and allocates nothing.