Expand description
printobserver-core.
Owns: the supervision logic — the loop that turns printer state and vision
observations into supervisory decisions, and the policy that decides which
decisions are allowed to reach the printer — together with the event kinds
and source names that logic writes (kinds), the one aggregate a
caller and the agent both read, the print’s context (context), and the
persistence interfaces it needs, one per aggregate (store).
May depend on: printobserver-types and the three port crates
(printobserver-printer-api, printobserver-vision-api,
printobserver-supervisor-api), and NO implementation crate. This is the
rule the whole design rests on and just check-repo enforces it. The
persistence interfaces this crate needs are its own (store), one trait
per aggregate it persists, and the store implementation depends on this
crate to implement them.
§The policy, which is the reason this layer exists
A failure detector can already see a failure and a printer can already drive the machine. What does not exist without this crate is the thing in between that decides what an agent is allowed to do about it, and its whole value is in being thin, bounded, and the single place that decision is made — so that an operator’s own commands are bounded by exactly the same rules an agent’s are.
- Effective bounds are the configured safety
envelope intersected with the active
print’s manifest. A manifest may only narrow; a range wider than the
envelope’s is narrowed to the envelope’s and the narrowing is recorded on
the print. See
bounds. - Every action from every actor passes one decision, taken by
decision::decideand issued by the one function named insupervisor. There is no path by which an action reaches the printer without it, and that is structural: no other item of this crate names an action method of the printer port, and no item outside that one module can obtain the handle to call one on. - A request outside the bounds is rejected, not clamped, and the rejection is persisted with the value asked for and the range allowed, so the caller can ask again inside the range.
- A bounded intervention expires on its own. Core reads the current time
through an injected
Clockrather than the system’s, so expiry is driven by time passing and by nothing else. Seeexpiry. - Nothing in this crate, and nothing reachable from it, sends a command
string to a printer. The printer port declares no method that admits
one: no method admits a byte sequence at all, and the only string anywhere
in the closure its parameters reach is the one
FileNamewraps.
Re-exports§
pub use accounting::UNTRACKED_REASON;pub use actions::ActionOutcome;pub use actions::reported_value;pub use block_on::block_on;pub use bounds::Bounds;pub use bounds::effective_bounds;pub use clock::Clock;pub use clock::SystemClock;pub use clock::plus_seconds;pub use clock::seconds_between;pub use clock::unix_seconds;pub use config::CoreConfig;pub use config::DEFAULT_DETECTOR_RESUME_GRACE;pub use config::DEFAULT_EXPIRY_POLL;pub use config::DEFAULT_OBSERVATION_INTERVAL;pub use config::DEFAULT_RECENT_EVENTS;pub use config::MAX_LOOK_WAIT_S;pub use config::PRINT_ID_PLACEHOLDER;pub use config::PreflightMode;pub use config::SpoolPolicy;pub use context::PrintContext;pub use decision::DecisionInput;pub use decision::adjustment;pub use decision::changes_the_machine;pub use decision::decide;pub use decision::valid_from;pub use error::CoreError;pub use events::PendingTurn;pub use events::Received;pub use events::TERMINAL_STATES;pub use expiry::rejection_detail;pub use expiry::restoring_action;pub use filament::DEFAULT_DIAMETER_MM;pub use filament::MATERIAL_DENSITIES;pub use filament::MarkClearing;pub use filament::buffer_g;pub use filament::density_for;pub use filament::grams_for_length;pub use filament::marks_cleared_by;pub use inbox::Arrival;pub use inbox::Inboxes;pub use kinds::ActionExecutedPayload;pub use kinds::ActionRejectedPayload;pub use kinds::ActionRequestedPayload;pub use kinds::AgentAssessmentPayload;pub use kinds::CameraLookPayload;pub use kinds::ChargePendedPayload;pub use kinds::FilamentChangeSignalledPayload;pub use kinds::FilamentConsumedPayload;pub use kinds::FileTallyRebaselinedPayload;pub use kinds::InterventionExpiredPayload;pub use kinds::OperatorAcknowledgementPayload;pub use kinds::PeriodicObservationPayload;pub use kinds::PortFailurePayload;pub use kinds::PortFailureSite;pub use kinds::PreflightCheckedPayload;pub use kinds::PrintEndedPayload;pub use kinds::PrintStartedPayload;pub use kinds::PrintUntrackedPayload;pub use kinds::RebaselineDisposition;pub use kinds::SpoolAdjustedPayload;pub use kinds::SpoolCommandRejectedPayload;pub use kinds::SpoolLoadedPayload;pub use kinds::SpoolRegisteredPayload;pub use kinds::SpoolRetiredPayload;pub use kinds::SpoolUnloadedPayload;pub use kinds::SpoolUnverifiedPayload;pub use kinds::TIMELINE_KINDS;pub use kinds::UnaccountedPrintPayload;pub use kinds::agent_source;pub use kinds::operator_source;pub use kinds::system_source;pub use look::Look;pub use observation::Observed;pub use preflight::ANALYSIS_POLL;pub use records::AcknowledgementDisposition;pub use records::ActionId;pub use records::ActionKind;pub use records::ActionRecord;pub use records::ActionRequest;pub use records::Actor;pub use records::ActorClass;pub use records::ChargeKey;pub use records::ChargeMethod;pub use records::ClearedMark;pub use records::EffectiveBounds;pub use records::ExecutionOutcome;pub use records::FilePosition;pub use records::ImageRecord;pub use records::Intervention;pub use records::InterventionId;pub use records::InterventionOutcome;pub use records::JobManifest;pub use records::LoadedSpool;pub use records::ManifestNarrowing;pub use records::PendingCharge;pub use records::PendingTaken;pub use records::PolicyDecision;pub use records::Preflight;pub use records::PreflightTool;pub use records::PreflightVerdict;pub use records::PrintAction;pub use records::PrintOutcome;pub use records::PrintRecord;pub use records::RejectionReason;pub use records::SafetyEnvelope;pub use records::SpoolCommand;pub use records::SpoolId;pub use records::SpoolRecord;pub use records::SpoolTrust;pub use records::UnverifiedMark;pub use records::UnverifiedReason;pub use records::UnverifiedReasonKind;pub use spools::SpoolCommandOutcome;pub use store::ActionStore;pub use store::AuditPage;pub use store::Charge;pub use store::ChargeRecord;pub use store::DEFAULT_HISTORY_WINDOW;pub use store::EventDraft;pub use store::EventStore;pub use store::FilamentStore;pub use store::FileTally;pub use store::HistoryQuery;pub use store::ImageLookup;pub use store::ImageStore;pub use store::MAX_HISTORY_LIMIT;pub use store::NewSpool;pub use store::Pend;pub use store::PrintStore;pub use store::SessionStore;pub use store::SettleOutcome;pub use store::Settlement;pub use store::SpoolChange;pub use store::SpoolMutation;pub use store::SpoolWrite;pub use store::StoreError;pub use store::Stores;pub use store::TimelineQuery;pub use store::TimelineStore;pub use store::resolve_history_limit;pub use supervisor::Issued;pub use supervisor::Supervisor;pub use turn_access::OpenedTurn;pub use turn_access::TurnAuthority;pub use turn_lock::TurnGuard;pub use turn_lock::TurnLocks;
Modules§
- accounting
- The printer timeline, and what every print takes from the spools that fed it.
- actions
- The one path an action takes, whoever asked for it.
- block_
on - A dependency-free executor, so that the expiry driver can run its own work.
- bounds
- The effective bounds: the configured envelope intersected with the manifest.
- clock
- The one time source this crate reads.
- config
- What a running supervisor is configured with.
- context
- The one aggregate a caller and the agent both read.
- decision
- The one decision, as a total function over what it is given.
- detector
- A print the detector paused, and the resume an adjustment earns it.
- error
- The one error type core answers its callers with.
- events
- The loop: one normalized event becomes one supervised turn.
- expiry
- A bounded intervention expires on its own, and nothing has to ask it to.
- filament
- The arithmetic of filament, and the one rule for which command clears which mark on a spool.
- inbox
- What reaches a turn while it is running.
- kinds
- The event kinds and source names the supervision domain writes.
- listing
- Every print this system holds, and the one the printer is running now.
- look
- A fresh look at a print: what arrived, what the camera shows, and what the printer says, now.
- observation
- A periodic observation of every active print, which no detector asked for.
- preflight
- Whether the spools loaded hold enough for a print, asked before it starts.
- records
- The supervision domain’s own records, and the identifiers it mints.
- spools
- The spool ledger’s commands and reads, through the one granted path.
- store
- The persistence interfaces the supervision domain needs, one per aggregate.
- supervisor
- The supervisor, and the one call site every action passes through.
- turn_
access - Where a supervision turn’s runs take their credentials from.
- turn_
lock - One supervision turn per print at a time.
- unobserved
- The prints the printer’s own tallies counted and this system never saw.