#[non_exhaustive]pub struct CatalogEntry {
pub module_id: String,
pub ready: bool,
pub not_ready: Option<NotReadyReason>,
pub module_version: Option<String>,
pub roles: Vec<ProviderRole>,
pub control_ops: Vec<String>,
pub capabilities: Option<CapabilityDeclarations>,
pub self_signals: Option<Vec<SelfSignalDeclaration>>,
}Expand description
A registered module’s catalog projection.
Use CatalogEntry::new and its with_* methods to construct entries so
future fields do not require changes to callers.
Struct literals and functional record updates are not supported outside this crate:
use subc_control::CatalogEntry;
let entry = CatalogEntry::new("provider", vec![], vec![]);
let entry = CatalogEntry { ready: false, ..entry };Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.module_id: String§ready: boolWhether the registered module currently accepts new route binds.
This is the module’s EFFECTIVE readiness: its own declared readiness
AND every one of its need: required capabilities having a registered
provider. It is exactly the condition route.open checks, so a caller
reading false here will be refused with module_warming; not_ready
says why.
Older daemons omit this field and are interpreted as ready. Daemons that
predate not_ready report declared readiness only.
not_ready: Option<NotReadyReason>Why ready is false, in the same shape route.open puts in the
detail of its module_warming refusal. Absent when the module is
ready, and absent from daemons that predate the field.
module_version: Option<String>The registered module’s self-declared build version, projected from its manifest so a consumer can tell WHICH BUILD of a module it is talking to at connect time.
Without this, a client compiled against a module’s current source reads a contract that is true of the repository and false of the running process – the types match, the JSON decodes, and the meaning has changed. That failure carries no error to notice; the version in the catalog turns a semantic skew into a log line at connect instead of a wrong sentence on a user’s screen.
Optional on the wire only because entries serialized by older daemons lack it: absent means “daemon predates the field”, never “module has no version” (the manifest field is required at registration).
The reading is ARMED BY OBSERVATION, not by this documentation: until a consumer has seen at least one populated entry from the daemon it is connected to, an all-None catalog is indistinguishable from an old daemon, and a client shipping the documented reading against it would hold a guarantee it does not have.
roles: Vec<ProviderRole>§control_ops: Vec<String>§capabilities: Option<CapabilityDeclarations>Static capability declarations from the registering module’s manifest.
Optional on the wire so consumers connected to a daemon that predates the capability grammar retain their existing catalog decoding behavior.
self_signals: Option<Vec<SelfSignalDeclaration>>Self-signal declarations mirrored verbatim from the registering module’s manifest. The daemon relays these declarations without interpreting them.
Implementations§
Source§impl CatalogEntry
impl CatalogEntry
Sourcepub fn new(
module_id: impl Into<String>,
roles: Vec<ProviderRole>,
control_ops: Vec<String>,
) -> Self
pub fn new( module_id: impl Into<String>, roles: Vec<ProviderRole>, control_ops: Vec<String>, ) -> Self
Construct an entry with its required fields and wire-compatible defaults.
Sourcepub fn with_ready(self, ready: bool) -> Self
pub fn with_ready(self, ready: bool) -> Self
Set the module’s effective readiness.
Sourcepub fn with_not_ready(self, not_ready: Option<NotReadyReason>) -> Self
pub fn with_not_ready(self, not_ready: Option<NotReadyReason>) -> Self
Set or clear the reason the module is not ready.
Sourcepub fn with_module_version(self, module_version: Option<String>) -> Self
pub fn with_module_version(self, module_version: Option<String>) -> Self
Set or clear the module’s self-declared version.
Sourcepub fn with_capabilities(
self,
capabilities: Option<CapabilityDeclarations>,
) -> Self
pub fn with_capabilities( self, capabilities: Option<CapabilityDeclarations>, ) -> Self
Set or clear the module’s static capability declarations.
Sourcepub fn with_self_signals(
self,
self_signals: Option<Vec<SelfSignalDeclaration>>,
) -> Self
pub fn with_self_signals( self, self_signals: Option<Vec<SelfSignalDeclaration>>, ) -> Self
Set or clear the module’s self-signal declarations.