ExStorageService.Metadata.ObjectCommit (ex_storage_service v0.6.2)

Copy Markdown View Source

Atomic v2 object metadata commits.

Each logical operation writes an operation record in the same Concord transaction as the immutable version and mutable head. That record is the source of truth when the transaction result is ambiguous.

Summary

Types

commit_result()

@type commit_result() :: %{
  operation_id: String.t(),
  version_id: String.t(),
  kind: :put | :delete_marker | :deleted
}

Functions

delete_marker(bucket, key, opts \\ [])

@spec delete_marker(String.t(), String.t(), keyword()) ::
  {:ok, commit_result()} | {:error, term()}

delete_version(bucket, key, version_id, opts \\ [])

@spec delete_version(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, commit_result()} | {:error, term()}

Permanently removes one metadata version and atomically repairs the head.

Blob bytes are intentionally untouched.

get_head(bucket, key, opts \\ [])

@spec get_head(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, :not_found | term()}

get_version(bucket, key, version_id, opts \\ [])

@spec get_version(String.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, :not_found | term()}

list_versions(bucket, key, opts \\ [])

@spec list_versions(String.t(), String.t(), keyword()) ::
  {:ok, [map()]} | {:error, term()}

put(bucket, key, metadata, opts \\ [])

@spec put(String.t(), String.t(), map(), keyword()) ::
  {:ok, commit_result()} | {:error, term()}