hive-sh4re: split inbox, container, journal, and schedule wire shapes into their own modules

Closes the #3110 split — lib.rs is now just the crate doc comment and
the pub mod list.

journal.rs's new doc comment fixes a pre-existing bug: the old
JournalPriority doc text in lib.rs was actually half Capability's doc
(a leftover from an earlier reorder that moved the code but not the
comment above it).
This commit is contained in:
damocles 2026-08-10 23:06:57 +02:00 committed by mara
commit 80f16094f1
30 changed files with 513 additions and 486 deletions

41
hive-sh4re/src/journal.rs Normal file
View file

@ -0,0 +1,41 @@
//! Journal-priority encoding for `GetHostJournal` (`read_host_journal`
//! capability). One small enum, own topic module rather than a
//! catch-all — see `hive-sh4re/README.md`'s module list.
use serde::{Deserialize, Serialize};
/// Syslog priority levels for `GetHostJournal`. Serialised as lowercase
/// strings matching journalctl `-p` accepted values.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, schemars::JsonSchema)]
#[serde(rename_all = "lowercase")]
pub enum JournalPriority {
Emerg,
Alert,
Crit,
Err,
Warning,
Notice,
Info,
Debug,
}
impl JournalPriority {
/// Returns the lowercase string journalctl expects for `-p`. Named
/// `as_journald_str` (not `as_str`) because this is a specific
/// external-tool encoding, not the enum's general wire/db string —
/// distinct call sites shouldn't reach for this by accident when they
/// actually want the serde wire representation.
#[must_use]
pub fn as_journald_str(self) -> &'static str {
match self {
Self::Emerg => "emerg",
Self::Alert => "alert",
Self::Crit => "crit",
Self::Err => "err",
Self::Warning => "warning",
Self::Notice => "notice",
Self::Info => "info",
Self::Debug => "debug",
}
}
}