pub struct FleetSnapshot { /* private fields */ }Expand description
The immutable value captured at Workflow start.
Fields are private and there are no setters: once captured, the only way to change a snapshot is to take a new one.
Implementations§
Source§impl FleetSnapshot
impl FleetSnapshot
Sourcepub fn capture(
fleet: QualifiedFleetId,
document: &FleetDocument,
captured_at: impl Into<String>,
router: Option<CapturedReasoningRouter>,
) -> Result<Self, ExactFleetError>
pub fn capture( fleet: QualifiedFleetId, document: &FleetDocument, captured_at: impl Into<String>, router: Option<CapturedReasoningRouter>, ) -> Result<Self, ExactFleetError>
Capture a snapshot from a parsed fleet document and an already-resolved Reasoning Router service.
Exact rosters are revalidated here, not trusted. ExactFleet is
public and Deserialize, so a document can reach this point without
having passed the TOML parser’s invariant checks; capture is the last
place to catch a duplicate role, an id/role collision, or a worker
claiming the Router’s identity before those become a running Workflow.
router is the captured service, whether it came from a saved reusable
profile or was normalized out of the legacy inline form. Resolution
happens in the host because it needs the fleet search roots; capture
only records the result.
Sourcepub fn verify_content_hash(&self) -> Result<(), ExactFleetError>
pub fn verify_content_hash(&self) -> Result<(), ExactFleetError>
Recompute the canonical content hash and reject a snapshot whose recorded hash does not describe its own contents.
FleetSnapshot is Deserialize and its content_hash is an ordinary
field, so a snapshot can reach a launch without ever having passed
Self::capture — through a replay file, a cache, or an IPC hop. That
hash is then stamped onto the durable receipt as the evidence that a run
matched a saved definition, so an unverified one is not weak evidence but
false evidence: it asserts a definition the members may not describe.
Call this before anything durable or costly happens. It is cheap (one canonical serialization plus a SHA-256) and it is the only thing standing between a tampered or migrated snapshot and a receipt that vouches for it.
Sourcepub fn into_verified(self) -> Result<Self, ExactFleetError>
pub fn into_verified(self) -> Result<Self, ExactFleetError>
Self::verify_content_hash, as a guard that yields the snapshot.
Exists so a load path cannot verify and then accidentally go on to use a different value: the only thing this returns is the snapshot it just checked.
pub fn fleet(&self) -> &QualifiedFleetId
pub fn schema_kind(&self) -> &str
pub const fn schema_revision(&self) -> u32
pub fn schema_hash(&self) -> &str
pub fn content_hash(&self) -> &str
pub fn members(&self) -> &[FleetSnapshotMember]
pub fn router(&self) -> Option<&FleetSnapshotRouter>
pub fn legacy_roles(&self) -> &[FleetSnapshotLegacyRole]
pub fn captured_at(&self) -> &str
Sourcepub fn member(&self, id: &str) -> Option<&FleetSnapshotMember>
pub fn member(&self, id: &str) -> Option<&FleetSnapshotMember>
Look up a member by its member id — what addresses a roster entry.
Sourcepub fn member_by_role(&self, role: &str) -> Option<&FleetSnapshotMember>
pub fn member_by_role(&self, role: &str) -> Option<&FleetSnapshotMember>
Look up a member by its semantic role — what gates, handoffs, and records use. Kept separate from id lookup so a task can carry a meaningful role while the runtime resolves a distinct profile id.
Both sides resolve through canonical_role_key, so a snapshot frozen
from a Fleet saved under a renamed role is still addressable by a gate or
handoff that spells the role the old way.
Sourcepub fn member_by_id_or_role(
&self,
id_or_role: &str,
) -> Option<&FleetSnapshotMember>
pub fn member_by_id_or_role( &self, id_or_role: &str, ) -> Option<&FleetSnapshotMember>
Look up by id first, then by role. Roster invariants forbid an id/role collision, so this can never be order-dependent.
Sourcepub fn has_auto_member(&self) -> bool
pub fn has_auto_member(&self) -> bool
Whether any frozen member requested auto reasoning — i.e. whether this
Workflow needs a working Reasoning Router at all.
Sourcepub fn auto_member_ids(&self) -> Vec<String>
pub fn auto_member_ids(&self) -> Vec<String>
Ids of the members that requested auto, for a startup error that names
who actually needs the Router.
Trait Implementations§
Source§impl Clone for FleetSnapshot
impl Clone for FleetSnapshot
Source§fn clone(&self) -> FleetSnapshot
fn clone(&self) -> FleetSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more