ExStorageService.Metadata.OperationIntents (ex_storage_service v0.6.3)

Copy Markdown View Source

Atomic pre-commit intent and per-hash GC protection.

Opening an intent and extending the hash guard share one Concord transaction. The transaction also requires the local GC lock to be absent, so a new writer cannot race a collector that has already fenced deletion.

Summary

Functions

commit_operations(operation_id, hash, opts \\ [])

@spec commit_operations(binary(), binary(), keyword()) ::
  {:ok, %{compare: [term()], success: [term()]}} | {:error, term()}

Returns transaction fragments that close an existing intent atomically with the object or multipart metadata publication.

open(operation_id, hash, size, node_id, node_generation, opts \\ [])

protected_hashes_page(cursor \\ nil, limit \\ 100, opts \\ [])

@spec protected_hashes_page(binary() | nil, pos_integer(), keyword()) ::
  {:ok, %{hashes: MapSet.t(binary()), next_cursor: binary() | nil}}
  | {:error, term()}

transition(operation_id, state, opts \\ [])

@spec transition(binary(), :unknown | :committed | :aborted, keyword()) ::
  {:ok, ExStorageService.Metadata.Models.OperationIntent.t()} | {:error, term()}