Expand description
StorageClient capability trait and types for blob / object stores.
A StorageClientPlugin is the runtime side of an object store: get a
key, put a key, delete a key, list keys under a prefix, and mint a
presigned URL. Backends range from S3 / R2 / MinIO / B2 to local
filesystem and in-memory stores for tests. The trait is narrow on
purpose — anything that looks like “named blob in a flat keyspace”
fits; anything richer (consistency tiers, object versioning beyond a
single etag, multipart upload) stays backend-specific.
Design notes:
-
Payloads are
Vec<u8>, notBytes. Matches the rest of the crate, keeps the WASM ABI flat, and lets callers wrap inBytesthemselves when they want the cheap-clone semantics. Bytes-in-the-trait would pullbytesinto every WASM guest, which is not worth the ergonomic win for a leaf crate. -
listis paginated viaStorageClientPlugin::list_page, not aBoxStream. Reasons: (1) keeps the trait synchronous, matching every other E1/E2 capability; (2) avoids draggingfuturesinto a leaf crate that otherwise only depends onserde+serde_json; (3) mirrors how every real object store exposes list (S3 / R2 / GCS / Azure all hand out a continuation token). Callers who want a stream-shaped surface can build one on top in two lines. -
Errors are a flat enum with four variants —
NotFound,AccessDenied,QuotaExceeded,Backend(String)— because callers branch on the classification. A route that returns 404 onNotFound, 403 onAccessDenied, and 500 otherwise is a common pattern, and forcing callers to parse a stringly-typed error to implement it is a papercut we can avoid cheaply. Matches the shape ofcrate::session::SessionError. -
The trait is sync-only, matching the rest of the plugin API. Native backends that need async I/O (aws-sdk-s3, etc.) drive their own runtime inside each method via
tokio::runtime::Handle::block_onor a dedicatedRuntime. WASM guests go through the host-function bridge.
Modules§
- fuel
- Fuel budgets for WASM storage plugin calls.
Structs§
- Object
- A single object as observed via
StorageClientPlugin::list_page. - PutOpts
- Options for
StorageClientPlugin::put.
Enums§
- Presign
Op - Operation a presigned URL is minted for.
- Storage
Error - Errors a storage backend can return.
Traits§
- Storage
Client Plugin - A plugin that owns a blob / object store.