Skip to main content

Module plugin

Module plugin 

Source
Expand description

Generic plugin seams: writes, plan, and execution.

Four traits; waratah_geo implements all of them, waratah_temporal the write/planner/executor trio (its terms are storage-native, no encode hook):

  • WritePlugin runs before the hexastore RPC on the insert path (gRPC fan-out and offline import alike). It returns a sparse object-rewrite overlay (PreparedInsert::object_rewrites), registry blob puts, and opaque O-axis index postings (geo + temporal) sent with the same commit_ts — Put-shaped only: on Delete batches the fan-out discards the postings (term-keyed indexes are never retracted on delete; the rebuilds GC dead terms). Compute itself contains no geozero, PROJ, S2, or temporal datatype logic.
  • EncodePlugin claims datatype IRIs (geo:wktLiteral, geo:wkbLiteral). Every SPARQL/RDF user literal of a claimed datatype routes through encode_user_literal (FILTER / CONSTRUCT / BIND / BGP constants included); native terms decode back through decode_user_literal at materialization. The temporal plugin claims NO datatypes: its terms (xsd:dateTime, xsd:date, xsd:gYear, …) are storage-native already.
  • PlannerPlugin rewrites lowered PlanNode trees. The geo rewrite inspects Filter.residual conjuncts and recurses into inner plans and EXISTS clause bodies (never early; that tree is all that survives lower_pattern + split_filter), and must not drop rows unless its custom op is a complete implementation of the stripped conjunct. Repeat executions of an uncorrelated (childless) custom op — EXISTS NestedProbe re-opens, expr-subst groups, duplicate identical conjuncts — are covered by the query-local CustomOp memo (see ExecutorPlugin).
  • ExecutorPlugin dispatches PlanNode::CustomNode on both evaluation paths. A geo_scan / temporal_scan op materializes (drains its stream once) — OpenNode pages the local table, never a second scan RPC.

Registration is COMPOSED through PluginHost: every plugin crate exposes a register(&mut PluginHost) that adds its RegisteredPlugin and its custom functions to ONE host, and the binary installs the composed host process-wide exactly once (PluginHost::install_process_wide) BEFORE any query is lowered — QueryEngine::new installs the plain builtin casts on the same process CustomFunctions map (first install wins), so a late or second registration would leave geof:* / tf:* FILTERs erroring Unsupported in split_filter rather than planning wrong.

Structs§

PluginEnv
Execution environment handed to ExecutorPlugin.
PluginHost
Composition point for the process-wide plugin + custom-function registries.
PluginPayloadBox
Cloneable, comparable box over PluginPayload so PlanNode can keep its derived Clone / PartialEq / Debug.
PluginRegistry
Process-wide plugin set: datatype map + hooks, registered at startup.
PreparedInsert
What a WritePlugin returns for one insert batch.
RegisteredPlugin
One registered plugin bundle.

Traits§

EncodePlugin
Datatype-owner hook: encode + decode user literals of claimed IRIs.
ExecutorPlugin
Executor hook for PlanNode::CustomNode.
PlannerPlugin
Plan-rewrite hook over the LOWERED plan tree.
PluginPayload
Typed payload of a PlanNode::CustomNode (downcast inside the plugin — never a stringly blob).
WritePlugin
Write-path hook (runs on ingest and offline import alike).

Functions§

decode_user_literal
Decode a native plugin term back to its lexical form.
encode_user_literal
Encode a SPARQL/RDF user literal through the plugin datatype map.
encode_user_literal_with_payloads
encode_user_literal with the mint’s payload pairs retained — the form every seeding site uses (the term-only wrapper serves matching and comparison sites that never decode). The pairs are the only copy of a query constant’s blob payload; see EncodePlugin::encode_literal.
install_process_plugins
Install the process-lifetime plugin registry (first install wins, like the custom-function registry). Called by ComputeNode startup; a second call is a no-op and registry is dropped.
process_plugins
The process plugin registry (empty when nothing was installed, so library tests and plugin-less deployments take the plain path).
variable
Variable helper: build a plan-time Variable.

Type Aliases§

BlobsFn
Batched blob-fetch closure type (PluginEnv::blobs).
ExecuteFuture
Materialized-row future of ExecutorPlugin::execute.
GeoCandidatesFn
Candidate-drain closure type (PluginEnv::geo_candidates).
StringsFn
Batched registry-string-resolve closure type (PluginEnv::strings).
TemporalCandidatesFn
Candidate-drain closure type (PluginEnv::temporal_candidates).
TextCandidatesFn
Candidate-drain closure type (PluginEnv::text_candidates).
TextSubjectsFn
Subject-resolve closure type (PluginEnv::text_subjects).