MingaEditor.RenderModel.Window.ResidentStore (Minga v0.1.0)

Copy Markdown View Source

Persistent indexed resident-row sequence.

Rows are held in an implicit chunk treap. Rank split/concatenation copy only the search paths and the at-most-64-row boundary chunks; untouched prefix and suffix subtrees are shared verbatim. Buffer positions are therefore not stored eagerly in suffix payloads: payload_at/2 and payload_range/3 project positional metadata when a caller actually reads a row.

Summary

Types

entry()

@type entry() :: %{id: term(), content_hash: non_neg_integer(), payload: term()}

t()

@type t() :: %MingaEditor.RenderModel.Window.ResidentStore{
  digest: Minga.RenderModel.Window.ContentDigest.t(),
  root: tree(),
  size: non_neg_integer(),
  work: work()
}

tree()

@type tree() ::
  nil | {:chunk, non_neg_integer(), pos_integer(), tree(), tuple(), tree()}

work()

@type work() :: %{
  rows_visited: non_neg_integer(),
  rows_copied: non_neg_integer(),
  rows_emitted: non_neg_integer(),
  chunks_touched: non_neg_integer()
}

Functions

delete_at(store, index)

@spec delete_at(t(), non_neg_integer()) :: t()

digest(resident_store)

empty?(store)

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

entries(resident_store)

@spec entries(t()) :: [entry()]

Materializes all entries. Reserved for hydration/debug/oracle paths.

entry(id, content_hash, payload)

@spec entry(term(), non_neg_integer(), term()) :: entry()

entry_at(arg1, index)

@spec entry_at(t(), non_neg_integer()) :: {:ok, entry()} | :error

from_entries(entries)

@spec from_entries([entry()]) :: t()

insert_at(store, index, item)

@spec insert_at(t(), non_neg_integer(), entry()) :: t()

new()

@spec new() :: t()

payload_at(store, index)

@spec payload_at(t(), non_neg_integer()) :: {:ok, term()} | :error

payload_range(store, start, count)

@spec payload_range(t(), non_neg_integer(), non_neg_integer()) :: [term()]

payloads(store)

@spec payloads(t()) :: [term()]

Materializes all projected payloads. Reserved for explicit full hydration.

rebuild(store, dirty, fun)

@spec rebuild(t(), MapSet.t(non_neg_integer()), (non_neg_integer() -> entry())) :: t()

replace_at(store, index, item)

@spec replace_at(t(), non_neg_integer(), entry()) :: t()

replace_range(store, start, delete_count, inserted)

@spec replace_range(t(), non_neg_integer(), non_neg_integer(), [entry()]) :: t()

Persistent rank splice. Only boundary/search chunks are copied.

size(resident_store)

@spec size(t()) :: non_neg_integer()

work(resident_store)

@spec work(t()) :: work()