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, the composition root that chooses which implementation backs each port, and the one event kind a restart writes — the startup reconciliation [reconcile] alone records.

May depend on: printobserver-types, the three 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, and admits a post by its shared secret alone; every route beneath the versioned prefix admits a request by the API credential alone. 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::BODY_BOUND;
pub use api::DRAIN_BOUND;
pub use api::router;
pub use config::ASSETS_DIRECTORY;
pub use config::ApiCredential;
pub use config::ApiSection;
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::GENERATED_CREDENTIAL_BYTES;
pub use config::IngressSection;
pub use config::OBICO_POSTING_TIMEOUT_MS;
pub use config::OctoprintSection;
pub use config::REDACTED;
pub use config::SKILL_INSTALL;
pub use config::ServerConfig;
pub use config::SharedSecret;
pub use config::SignInConfig;
pub use config::SupervisorSection;
pub use config::plainly_written;
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::ReconcileStores;
pub use reconcile::Reconciliation;
pub use reconcile::StartupOutcome;
pub use reconcile::StartupReconciliationPayload;
pub use reconcile::overdue;
pub use reconcile::reconcile;
pub use server::API_CREDENTIAL_FILE;
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::Server;
pub use server::StartError;
pub use server::TURN_PROMPT;
pub use server::agent_config;
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::PrintsAnswer;
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.

Structs§

HarnessSignIn
The harness identities this program can sign in, as the adapter declares them: the command-line program reads the table through this crate, which is the one edge it has to the adapter. One harness identity this program can sign in.

Constants§

HARNESS_DIRECTORY
The harness identities this program can sign in, as the adapter declares them: the command-line program reads the table through this crate, which is the one edge it has to the adapter. The directory under the state directory every identity’s own directory is kept in.
SIGN_INS
The harness identities this program can sign in, as the adapter declares them: the command-line program reads the table through this crate, which is the one edge it has to the adapter. Every harness identity this program can sign in, and there is no other.