Ancora.Derive.RunContext (ancora v1.0.0-rc.1)

Copy Markdown View Source

Per-run detector context: an unnamed ETS memo table and the git batch port, both passed by reference. Nothing here is named, registered, or written to disk.

Summary

Functions

Looks up a memo entry. Returns {:ok, value, kind} or :error.

Stores value under key at kind.

Opens an unnamed public ETS memo table and, unless batch: false, one unregistered git cat-file --batch port against root.

Closes the batch port and deletes the memo table.

Types

kind()

@type kind() :: :def_index | :resolver | :ast | :blob | :module_map | :ambient

t()

@type t() :: %Ancora.Derive.RunContext{
  base: String.t(),
  batch_port: Ancora.Git.BatchPort.t() | nil,
  memo: :ets.tid(),
  root: Path.t()
}

Functions

memo_get(run_context, key)

@spec memo_get(t(), term()) :: {:ok, term(), kind()} | :error

Looks up a memo entry. Returns {:ok, value, kind} or :error.

memo_put(run_context, key, value, kind \\ :ast)

@spec memo_put(t(), term(), term(), kind()) :: :ok

Stores value under key at kind.

DefIndex and resolver results outrank a raw AST for the same key: a lower-ranked kind does not overwrite a higher-ranked entry.

start(root, base, opts \\ [])

@spec start(Path.t(), String.t(), keyword()) :: {:ok, t()} | {:error, term()}

Opens an unnamed public ETS memo table and, unless batch: false, one unregistered git cat-file --batch port against root.

stop(run_context)

@spec stop(t()) :: :ok

Closes the batch port and deletes the memo table.