pub trait ComputeBackend: Send + Sync {
Show 15 methods
// Required methods
fn query(
&self,
sparql: &str,
ctx: &QueryContext,
) -> impl Future<Output = Result<QueryResults, ComputeError>> + Send;
fn quad_count(
&self,
snapshot: SnapshotId,
) -> impl Future<Output = Result<u64, ComputeError>> + Send;
// Provided methods
fn query_output(
&self,
sparql: &str,
ctx: &QueryContext,
) -> impl Future<Output = Result<QueryOutput, ComputeError>> + Send { ... }
fn union_quad_count(
&self,
snapshot: SnapshotId,
) -> impl Future<Output = Result<u64, ComputeError>> + Send { ... }
fn schema_summary(
&self,
_params: &SchemaSummaryParams,
) -> impl Future<Output = Result<SchemaSummary, ComputeError>> + Send { ... }
fn planner_profile(&self) -> StatsProfile { ... }
fn default_union(&self) -> bool { ... }
fn seat_by_total_cost(&self) -> bool { ... }
fn query_context(&self, snapshot: SnapshotId) -> QueryContext { ... }
fn spill_dir(&self) -> Option<PathBuf> { ... }
fn insert_quads(
&self,
_quads: &[Quad],
_commit_ts: CommitTs,
) -> impl Future<Output = Result<InsertResult, ComputeError>> + Send { ... }
fn flush_memtables(
&self,
) -> impl Future<Output = Result<(), ComputeError>> + Send { ... }
fn refresh_stats(
&self,
) -> impl Future<Output = Result<StatsProfile, ComputeError>> + Send { ... }
fn cluster_snapshot(
&self,
) -> impl Future<Output = Option<ClusterSnapshot>> + Send { ... }
fn cors_proxy_targets(&self) -> Vec<CorsProxyTarget> { ... }
}Expand description
Operations the RDF4J facade and Waratah ingest API need from compute.
Required Methods§
Sourcefn query(
&self,
sparql: &str,
ctx: &QueryContext,
) -> impl Future<Output = Result<QueryResults, ComputeError>> + Send
fn query( &self, sparql: &str, ctx: &QueryContext, ) -> impl Future<Output = Result<QueryResults, ComputeError>> + Send
Run a SPARQL SELECT / ASK / CONSTRUCT / DESCRIBE.
Sourcefn quad_count(
&self,
snapshot: SnapshotId,
) -> impl Future<Output = Result<u64, ComputeError>> + Send
fn quad_count( &self, snapshot: SnapshotId, ) -> impl Future<Output = Result<u64, ComputeError>> + Send
Count visible quads as of snapshot.
Provided Methods§
Sourcefn query_output(
&self,
sparql: &str,
ctx: &QueryContext,
) -> impl Future<Output = Result<QueryOutput, ComputeError>> + Send
fn query_output( &self, sparql: &str, ctx: &QueryContext, ) -> impl Future<Output = Result<QueryOutput, ComputeError>> + Send
SELECT as encoded rows plus a resolved string map; otherwise QueryOutput::Ready.
Default wraps Self::query as QueryOutput::Ready so mocks that
only implement decoded QueryResults keep working.
Sourcefn union_quad_count(
&self,
snapshot: SnapshotId,
) -> impl Future<Output = Result<u64, ComputeError>> + Send
fn union_quad_count( &self, snapshot: SnapshotId, ) -> impl Future<Output = Result<u64, ComputeError>> + Send
Count visible quads across the default graph and every named
graph — the coverage of the ai-context summary and its ETag
validator (quad_count above pins the default graph, RDF4J
/size semantics). Default: same as quad_count (test mocks).
Sourcefn schema_summary(
&self,
_params: &SchemaSummaryParams,
) -> impl Future<Output = Result<SchemaSummary, ComputeError>> + Send
fn schema_summary( &self, _params: &SchemaSummaryParams, ) -> impl Future<Output = Result<SchemaSummary, ComputeError>> + Send
Schema summary for GET /waratah/repositories/{id}/ai-context
(contract S2).
Default: unsupported, so query-only test mocks compile unchanged;
the live implementation is on ComputeNode.
Sourcefn planner_profile(&self) -> StatsProfile
fn planner_profile(&self) -> StatsProfile
Local planner sketch cache (empty when stats have not been rolled up).
Sourcefn default_union(&self) -> bool
fn default_union(&self) -> bool
SPARQL default-graph fallback copied onto each QueryContext.
Sourcefn seat_by_total_cost(&self) -> bool
fn seat_by_total_cost(&self) -> bool
Inner-join seating comparator copied onto each QueryContext
(false = legacy driver_cost decision).
Sourcefn query_context(&self, snapshot: SnapshotId) -> QueryContext
fn query_context(&self, snapshot: SnapshotId) -> QueryContext
Base QueryContext for a query at snapshot — the engine’s own:
default-graph fallback, index trust epochs, spill root.
Derived from the engine rather than re-assembled at call sites because
the geo / temporal index trust epochs live only there. A context that
misses them is not merely incomplete: a None temporal epoch gates
the temporal comparison rewrite OFF, so those queries would silently
fall back to the unindexed residual (correct answers, no index, no
diagnostic). Geo’s gate is more forgiving — it reads a missing epoch as
trusted — which is precisely why the dropped epoch went unnoticed:
geo kept working while temporal quietly degraded.
The default is built from this trait’s own defaults so query-only test mocks keep working unchanged.
Sourcefn spill_dir(&self) -> Option<PathBuf>
fn spill_dir(&self) -> Option<PathBuf>
Spill root copied onto each QueryContext (None = std::env::temp_dir).
Default None so query-only test mocks keep working.
Sourcefn insert_quads(
&self,
_quads: &[Quad],
_commit_ts: CommitTs,
) -> impl Future<Output = Result<InsertResult, ComputeError>> + Send
fn insert_quads( &self, _quads: &[Quad], _commit_ts: CommitTs, ) -> impl Future<Output = Result<InsertResult, ComputeError>> + Send
Fan out encoded quads to the string registry and S/P/O.
Default: ComputeError::IngestUnsupported (query-only test mocks).
Sourcefn flush_memtables(
&self,
) -> impl Future<Output = Result<(), ComputeError>> + Send
fn flush_memtables( &self, ) -> impl Future<Output = Result<(), ComputeError>> + Send
Flush MemTables after ingest. Default is a no-op.
Sourcefn refresh_stats(
&self,
) -> impl Future<Output = Result<StatsProfile, ComputeError>> + Send
fn refresh_stats( &self, ) -> impl Future<Output = Result<StatsProfile, ComputeError>> + Send
Reload planner sketches after ingest. Default returns an empty profile.
Sourcefn cluster_snapshot(
&self,
) -> impl Future<Output = Option<ClusterSnapshot>> + Send
fn cluster_snapshot( &self, ) -> impl Future<Output = Option<ClusterSnapshot>> + Send
Cluster snapshot for /waratah/cluster. Default: this process has no view.
Sourcefn cors_proxy_targets(&self) -> Vec<CorsProxyTarget>
fn cors_proxy_targets(&self) -> Vec<CorsProxyTarget>
Static cluster members /cors_proxy may forward to.
Default is empty so query-only mocks do not accept proxied calls.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.