PtcRunner.Kernel.InspectionArtifact.Indexes (PtcRunner v0.15.0)

Copy Markdown View Source

Private ETS indexes and logical versus actual retained accounting.

Logical index bytes are the conservative RetainedSize.bytes/1 charge of each detached {family, key, value} row, matching issue #1646. The physical ETS tuple is {key, value} inside the family table. Actual ETS allocation is sum(:ets.info(table, :memory)) * word_size. Owner metadata, paired trace facts, and cache state are charged separately and never as a substitute for the ETS total. Shared binaries that appear in both owner metadata and an ETS row are charged in both places.

Summary

Types

t()

@type t() :: %{
  tables: %{required(atom()) => :ets.tid()},
  logical_entries: non_neg_integer(),
  logical_bytes: non_neg_integer(),
  owner_metadata: map(),
  trace_facts: map(),
  cache: map(),
  turn_evidence: map()
}

Functions

accounting(indexes)

@spec accounting(t()) :: map()

create(heir)

@spec create(pid()) :: t()

delete_all(map)

@spec delete_all(t()) :: :ok

give_away(map, owner)

@spec give_away(t(), pid()) :: :ok

insert(indexes, family, key, value, limits)

@spec insert(t(), atom(), term(), term(), map()) ::
  {:ok, t()} | {:error, :max_index_entries | :max_logical_index_bytes}

lookup(indexes, table, key)

@spec lookup(t(), atom(), term()) :: [term()]

match(indexes, table, pattern)

@spec match(t(), atom(), term()) :: [term()]

put_cache(indexes, cache)

@spec put_cache(t(), map()) :: t()

put_owner_metadata(indexes, metadata)

@spec put_owner_metadata(t(), map()) :: t()

put_trace_facts(indexes, facts)

@spec put_trace_facts(t(), map()) :: t()

put_turn_evidence(indexes, evidence)

@spec put_turn_evidence(t(), map()) :: t()

tab2list(indexes, table)

@spec tab2list(t(), atom()) :: [term()]

table_ids(map)

@spec table_ids(t()) :: [reference()]

undefined?(map)

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

within_retained?(indexes, limits)

@spec within_retained?(t(), map()) :: boolean()