Skip to main content

validate_format

Function validate_format 

Source
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:

  1. the engine stored in FORMAT when present and recognised,
  2. the URL engine when FORMAT is absent and the URL declared one,
  3. StorageEngine::Bundle otherwise (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