FerricStore.Flow.QueryEngine behaviour (ferricstore v0.11.4)

Copy Markdown View Source

Installable execution boundary for canonical Flow queries.

OSS uses the bounded cost-aware planner. Extensions may inject trusted mandatory scope, authorization, budgets, and index metadata through the existing instance behaviours after parsing and parameter binding.

Summary

Functions

Returns the absolute Unix-millisecond request deadline, when one was supplied.

Returns the immutable FerricStore instance carried by an execution context.

Returns trusted request authority carried by the execution context.

Returns the trusted query response codec selected by the protocol boundary.

Types

capability_manifest()

@type capability_manifest() :: %{
  request_contract: binary() | nil,
  result_contract: binary() | nil,
  explain_contract: binary() | nil,
  index_status_contract: binary() | nil,
  capabilities: [binary()],
  language_versions: [binary()],
  shapes: [binary()]
}

context()

@type context() ::
  FerricStore.Instance.t() | Ferricstore.Flow.Query.ExecutionContext.t() | map()

result()

@type result() :: {:ok, term()} | {:error, term()}

Callbacks

capabilities()

(optional)
@callback capabilities() :: capability_manifest()

execute(context, t)

@callback execute(context(), Ferricstore.Flow.Query.Request.t()) :: result()

Functions

capabilities(ctx)

@spec capabilities(context()) :: capability_manifest()

deadline_ms(arg1)

@spec deadline_ms(context()) :: pos_integer() | nil

Returns the absolute Unix-millisecond request deadline, when one was supplied.

Engines should convert this value to a monotonic deadline once at query initialization and use that value for subsequent budget checks.

execute(ctx, request, opts \\ [])

instance_context(ctx)

@spec instance_context(context()) :: FerricStore.Instance.t() | map()

Returns the immutable FerricStore instance carried by an execution context.

Query-engine implementations should use this accessor instead of depending on the protocol layer's context wrapper.

request_context(arg1)

@spec request_context(context()) :: map()

Returns trusted request authority carried by the execution context.

Embedded calls and native requests without trusted authority return an empty map.

response_codec(arg1)

@spec response_codec(context()) ::
  Ferricstore.Flow.Query.ExecutionContext.response_codec()

Returns the trusted query response codec selected by the protocol boundary.

Embedded callers and contexts that do not carry a negotiated codec use the typed native-value representation.