pub struct Engine {
pub router: Arc<PartitionRouter>,
/* private fields */
}Expand description
The FlowFabric engine: partition routing + background scanners.
Fields§
§router: Arc<PartitionRouter>Implementations§
Source§impl Engine
impl Engine
Sourcepub fn start(config: EngineConfig, backend: Arc<dyn EngineBackend>) -> Self
pub fn start(config: EngineConfig, backend: Arc<dyn EngineBackend>) -> Self
Start the engine with the given config and backend.
Spawns background scanner tasks. Returns immediately.
backend is an Arc<dyn EngineBackend>. When the underlying
concrete type is ff_backend_valkey::ValkeyBackend, the
engine spawns its in-tree Valkey scanner supervisors. For
non-Valkey backends (Postgres, SQLite, custom impls), the
reconciler supervisor lives inside the backend itself (spawned
during connect_with_*) and this constructor only wires the
completion dispatch loop + partition router. Cairn #436: the
runtime downcast-or-panic from v0.12 PR-7a is gone.
Sourcepub fn start_with_metrics(
config: EngineConfig,
backend: Arc<dyn EngineBackend>,
metrics: Arc<Metrics>,
) -> Self
pub fn start_with_metrics( config: EngineConfig, backend: Arc<dyn EngineBackend>, metrics: Arc<Metrics>, ) -> Self
PR-94: start the engine with a shared observability registry.
Used by ff-server so scanner cycle metrics funnel into the
same Prometheus registry exposed at /metrics. Under the
observability feature (flipped via the same feature on
ff-server / ff-engine), the handle records into an OTEL
MeterProvider; otherwise the shim no-ops.
Sourcepub fn start_with_completions(
config: EngineConfig,
backend: Arc<dyn EngineBackend>,
metrics: Arc<Metrics>,
completions: CompletionStream,
) -> Self
pub fn start_with_completions( config: EngineConfig, backend: Arc<dyn EngineBackend>, metrics: Arc<Metrics>, completions: CompletionStream, ) -> Self
Start the engine with a shared observability registry and a completion stream for push-based DAG promotion (issue #90).
The stream is typically produced by
ff_core::completion_backend::CompletionBackend::subscribe_completions.
The engine spawns a dispatch loop that drains the stream and
fires ff_resolve_dependency per completion, reducing DAG
latency from interval × levels to ~RTT × levels. The
dependency_reconciler scanner remains as a safety net for
completions missed during subscriber reconnect windows.
§Backend parameter
backend is an Arc<dyn EngineBackend>. Works uniformly
across Valkey / Postgres / SQLite (and any other impl): the
engine attempts a Valkey downcast and, when successful, spawns
the in-tree ferriskey-speaking scanner supervisors. Otherwise
it trusts the backend to own its reconciler supervisor (cairn
#436 / PR-7b). No runtime panic path.
§Example
// Any `EngineBackend` impl works (cairn #436).
let engine = ff_engine::Engine::start_with_completions(
cfg, backend, metrics, stream,
);Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more