pub async fn validate_format(
kind: BackendKind,
store: &dyn ObjectStore,
prefix: &str,
url_engine: Option<StorageEngine>,
) -> Result<StorageEngine, BackendError>Expand description
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:
- The key does not exist (new bucket — engine will be written on first push).
- The stored engine matches the URL engine (or no engine was declared).
Returns the resolved engine in priority order:
- the engine stored in
FORMATwhen present and recognised, - the URL engine when
FORMATis absent and the URL declared one, StorageEngine::Bundleotherwise (the default for new buckets).
One FORMAT read per call. build surfaces the resolved engine to
its caller so crate::protocol::run can dispatch without a second
network round trip.
§Errors
BackendError::UnknownStoredEnginewhen theFORMATcontent is not a recognised engine name.BackendError::EngineMismatchwhen the URL engine conflicts with the stored engine.BackendError::Networkfor transport failures (DNS, TLS, timeout) reading the key.BackendError::InvalidCredentialsfor auth / credential failures reading the key, or non-UTF-8 bytes in the FORMAT body.