ExStorageService.Metadata.Models.OperationIntent (ex_storage_service v0.6.4)

Copy Markdown View Source

Durable protection for bytes that may be referenced by an unresolved write.

Intents are created after a content hash is known and before replica publication. A final metadata transaction marks the matching intent committed. Pending and unknown intents remain garbage-collection roots until their safety deadline.

Summary

Types

state()

@type state() :: :pending | :unknown | :committed | :aborted

t()

@type t() :: %ExStorageService.Metadata.Models.OperationIntent{
  created_at_ms: non_neg_integer(),
  hash: binary(),
  node_generation: pos_integer(),
  node_id: binary(),
  operation_id: binary(),
  protected_until_ms: non_neg_integer(),
  schema: 2,
  size: non_neg_integer(),
  state: state(),
  updated_at_ms: non_neg_integer()
}

Functions

cast(intent)

@spec cast(term()) :: {:ok, t()} | {:error, :invalid_operation_intent}

new(operation_id, hash, size, node_id, node_generation, protected_until_ms, now_ms \\ System.system_time(:millisecond))

@spec new(
  binary(),
  binary(),
  non_neg_integer(),
  binary(),
  pos_integer(),
  non_neg_integer(),
  non_neg_integer()
) :: {:ok, t()} | {:error, :invalid_operation_intent}

protected?(operation_intent, now_ms)

@spec protected?(t(), non_neg_integer()) :: boolean()

to_map(intent)

@spec to_map(t()) :: map()