Skip to main content

Crate printobserver_server

Crate printobserver_server 

Source
Expand description

printobserver-server.

Owns: the long-running service: the HTTP surface the clients call, the Obico ingress the failure detector posts to, the supervision loop’s lifecycle, and the composition root that chooses which implementation backs each port.

May depend on: printobserver-types, the four port crates, printobserver-core, and the implementation crates — it is a composition root, so naming an implementation is its job rather than a violation.

§The shape of this crate, in four sentences

config is the one configuration file and every value it is validated against. operations is the whole public API declared once, and api builds the router by folding over it, so the set served and the set declared cannot come apart. ingress is Obico’s own endpoint, which answers before its handling completes and inside a bound this repository declares. server is the composition root: the one place an implementation crate is named, and the only file here that knows there is an OctoPrint at all.

§Images are a path, never bytes

The server, the command-line program and the supervising agent all run on the one host by design, so an image answer is an absolute path on this host’s own filesystem. No route this server serves answers image bytes, and no answer renders or encodes them; see wire::ImageAnswer.

§Restarting loses nothing

The store and the session directory are the whole of the state, and [reconcile] is what adopts them on start.

Re-exports§

pub use api::ApiState;
pub use api::router;
pub use config::ASSETS_DIRECTORY;
pub use config::ConfigError;
pub use config::ConfigField;
pub use config::ConfigFile;
pub use config::DEFAULT_INGRESS_ANSWER_BOUND_MS;
pub use config::FAN_VOCABULARY;
pub use config::IngressSection;
pub use config::OBICO_POSTING_TIMEOUT_MS;
pub use config::OctoprintSection;
pub use config::REDACTED;
pub use config::ServerConfig;
pub use config::SharedSecret;
pub use config::SupervisorSection;
pub use ingress::IngressState;
pub use ingress::QUEUE_DEPTH;
pub use ingress::TOKEN_HEADER;
pub use ingress::TOKEN_PARAM;
pub use operations::Answer;
pub use operations::BESIDE_THE_ACTIONS;
pub use operations::CONTEXT_IMAGE_PATH_FIELD;
pub use operations::Declared;
pub use operations::Effect;
pub use operations::IMAGE_PATH_FIELD;
pub use operations::INGRESS_PATH;
pub use operations::Located;
pub use operations::MEDIA_TYPE;
pub use operations::Method;
pub use operations::OPERATIONS;
pub use operations::Operation;
pub use operations::Parameter;
pub use operations::VERSION_PREFIX;
pub use operations::ValueKind;
pub use operations::operation;
pub use reconcile::Reconciliation;
pub use reconcile::overdue;
pub use reconcile::reconcile;
pub use server::CLIENT_CONFIG_FILE;
pub use server::CONTEXT_PROGRAM;
pub use server::PROMPT_FILE;
pub use server::Ports;
pub use server::Running;
pub use server::SCHEMA_FILE;
pub use server::SKILL_FILE;
pub use server::Server;
pub use server::StartError;
pub use server::TURN_PROMPT;
pub use server::context_command;
pub use wire::ActionAnswer;
pub use wire::ActionBody;
pub use wire::BodyRefusal;
pub use wire::ContextAnswer;
pub use wire::ErrorAnswer;
pub use wire::HistoryAnswer;
pub use wire::ImageAnswer;
pub use wire::IngressAnswer;
pub use wire::ManifestAnswer;
pub use wire::ManifestBody;
pub use wire::StatusAnswer;
pub use wire::reason_of;

Modules§

api
The HTTP surface, built by folding over the declared operations.
config
The one configuration file a running supervisor reads, and its validation.
ingress
The one endpoint Obico’s webhook notification plugin posts to.
operations
The public operations this server serves, declared once.
reconcile
What a supervisor adopts when it starts.
server
The composition root: the one place an implementation crate is named.
wire
The JSON a caller sends and the JSON this server answers with.