pub struct Query { /* private fields */ }Expand description
Fluent builder for query configurations.
Use Query::cypher() or Query::gql() to get started.
§Example
use drasi_lib::Query;
let query_config = Query::cypher("my-query")
.query("MATCH (n:Person) RETURN n.name, n.age")
.from_source("my-source")
.auto_start(true)
.build();Implementations§
Source§impl Query
impl Query
Sourcepub fn from_source(self, source_id: impl Into<String>) -> Self
pub fn from_source(self, source_id: impl Into<String>) -> Self
Subscribe to a source.
Sourcepub fn from_source_with_pipeline(
self,
source_id: impl Into<String>,
pipeline: Vec<String>,
) -> Self
pub fn from_source_with_pipeline( self, source_id: impl Into<String>, pipeline: Vec<String>, ) -> Self
Subscribe to a source with a middleware pipeline.
The pipeline is a list of middleware names (strings) that will be applied to data from this source before it reaches the query.
Sourcepub fn with_middleware(self, middleware: SourceMiddlewareConfig) -> Self
pub fn with_middleware(self, middleware: SourceMiddlewareConfig) -> Self
Add middleware to the query.
Sourcepub fn auto_start(self, auto_start: bool) -> Self
pub fn auto_start(self, auto_start: bool) -> Self
Set whether the query should auto-start.
Sourcepub fn with_joins(self, joins: Vec<QueryJoinConfig>) -> Self
pub fn with_joins(self, joins: Vec<QueryJoinConfig>) -> Self
Set the join configuration.
Sourcepub fn enable_bootstrap(self, enable: bool) -> Self
pub fn enable_bootstrap(self, enable: bool) -> Self
Enable or disable bootstrap.
Sourcepub fn with_bootstrap_buffer_size(self, size: usize) -> Self
pub fn with_bootstrap_buffer_size(self, size: usize) -> Self
Set the bootstrap buffer size.
Sourcepub fn with_priority_queue_capacity(self, capacity: usize) -> Self
pub fn with_priority_queue_capacity(self, capacity: usize) -> Self
Set the priority queue capacity.
Sourcepub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
pub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
Set the dispatch buffer capacity.
Sourcepub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
pub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
Set the dispatch mode.
Sourcepub fn with_storage_backend(self, backend: StorageBackendRef) -> Self
pub fn with_storage_backend(self, backend: StorageBackendRef) -> Self
Set the storage backend reference.
Sourcepub fn with_recovery_policy(self, policy: RecoveryPolicy) -> Self
pub fn with_recovery_policy(self, policy: RecoveryPolicy) -> Self
Set the recovery policy. Applies only to queries with a persistent
storage backend. See RecoveryPolicy.
Sourcepub fn with_outbox_capacity(self, capacity: usize) -> Self
pub fn with_outbox_capacity(self, capacity: usize) -> Self
Set the outbox capacity (number of recent QueryResult emissions retained). Default: 1000.
Sourcepub fn with_bootstrap_timeout_secs(self, secs: u64) -> Self
pub fn with_bootstrap_timeout_secs(self, secs: u64) -> Self
Set the bootstrap timeout in seconds.
This controls how long fetch_snapshot / fetch_outbox will wait for
the query to finish bootstrapping before returning FetchError::TimedOut.
Default: 300 (5 minutes).
Sourcepub fn build(self) -> QueryConfig
pub fn build(self) -> QueryConfig
Build the query configuration.