PtcRunner.Kernel.ApplicationSource (PtcRunner v0.14.0)

Copy Markdown View Source

Bounded, caching document source shared by application acquisition adapters.

Directory reads are confined to one canonical root. Memory reads use portable logical names and reject unused supplied records. Each unique document is charged once and cached, so later compilation cannot reopen a path and observe different bytes.

Summary

Functions

Closes a source when acquisition aborts.

Verifies memory closure use, returns accounting, and closes the source.

Returns the JSON Schema pattern for portable application logical names.

Opens one confined directory-backed application source.

Opens one in-memory logical-name/bytes application source.

Reads and caches one portable logical document under a per-role ceiling.

Reads a logical name relative to the source manifest.

Checks the portable lowercase ASCII logical-name grammar.

Types

t()

@type t() :: %PtcRunner.Kernel.ApplicationSource{manifest_name: binary(), pid: pid()}

Functions

close(application_source)

@spec close(t()) :: :ok

Closes a source when acquisition aborts.

finish(application_source)

@spec finish(t()) ::
  {:ok, %{document_count: non_neg_integer(), document_bytes: non_neg_integer()}}
  | {:error, atom()}

Verifies memory closure use, returns accounting, and closes the source.

logical_name_pattern()

@spec logical_name_pattern() :: binary()

Returns the JSON Schema pattern for portable application logical names.

open_directory(path)

@spec open_directory(binary()) :: {:ok, t()} | {:error, atom()}

Opens one confined directory-backed application source.

open_memory(manifest_name, documents)

@spec open_memory(binary(), %{required(binary()) => binary()}) ::
  {:ok, t()} | {:error, atom()}

Opens one in-memory logical-name/bytes application source.

read(arg1, name, max_bytes)

@spec read(t(), binary(), pos_integer()) :: {:ok, binary()} | {:error, atom()}

Reads and caches one portable logical document under a per-role ceiling.

read_reference(source, relative_name, max_bytes)

@spec read_reference(t(), binary(), pos_integer()) ::
  {:ok, binary()} | {:error, atom()}

Reads a logical name relative to the source manifest.

valid_name?(name)

@spec valid_name?(term()) :: boolean()

Checks the portable lowercase ASCII logical-name grammar.