Skip to main content

Module backend

Module backend 

Source
Expand description

Backend factory: turns a parsed RemoteUrl into an Arc<dyn ObjectStore> for the protocol REPL to drive.

Both S3 and Azure Blob are wired here.

§Eager probe and categorical error mapping

After constructing the SDK client, build runs a single low-cost listing call (max_keys=1 for S3, maxresults=1 for Azure) and folds well-known failures into categorical BackendError variants. Helper binaries pattern-match on these variants via fatal_message to emit single-line fatal: diagnostics.

The probe runs once at backend construction. Per-call errors during fetch / push continue to flow through their existing typed paths.

Re-exports§

pub use crate::url::BackendKind;

Enums§

BackendError
Errors surfaced by build.

Functions§

build
Construct the right ObjectStore for remote, verify it is reachable with a single low-cost list call, and resolve the storage engine from the FORMAT key in one pass.
fatal_message
Render err as a single-line fatal: diagnostic helper binaries write to stderr.
validate_format
Read the FORMAT key at <prefix>/FORMAT and validate it against the engine declared in the URL. kind selects S3 vs Azure vocabulary in the error variants this function can surface (BackendError::UnknownStoredEngine, BackendError::EngineMismatch). Returns Ok(()) when: