Concord.KV.Record (Concord v2.0.0)

Copy Markdown View Source

Per-key revisioned record in Concord's MVCC store.

Every key in Concord is backed by a Record that tracks its full revision history metadata. Records are the internal representation stored in ETS; the public API can return either bare values (for backward compatibility) or full records (with metadata: true).

Fields

  • value — The stored value (any Erlang term)
  • create_revision — Cluster revision when the key was first created (resets on delete-and-recreate)
  • mod_revision — Cluster revision of the latest mutation
  • version — Count of writes since creation; 0 means tombstone (deleted)
  • expires_at — Absolute timestamp (seconds) of TTL expiry, or nil
  • lease_id — Lease this key is attached to, or nil
  • content_type — Optional MIME-ish hint (e.g., "text/markdown")
  • metadata — Optional application-level metadata map

Summary

Functions

Returns true if this record has expired based on the given current time.

Creates a tombstone record for a deleted key.

Returns true if this record is a tombstone (deleted key).

Types

t()

@type t() :: %Concord.KV.Record{
  content_type: binary() | nil,
  create_revision: non_neg_integer(),
  expires_at: non_neg_integer() | nil,
  lease_id: non_neg_integer() | nil,
  metadata: map(),
  mod_revision: non_neg_integer(),
  value: term(),
  version: non_neg_integer()
}

Functions

expired?(record, now)

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

Returns true if this record has expired based on the given current time.

tombstone(key, revision, prev_record)

@spec tombstone(binary(), non_neg_integer(), t() | nil) :: t()

Creates a tombstone record for a deleted key.

tombstone?(record)

@spec tombstone?(t()) :: boolean()

Returns true if this record is a tombstone (deleted key).