pub trait AlgorithmHost: Send + Sync {
// Required method
fn as_any(&self) -> &dyn Any;
// Provided method
fn project(
&self,
spec: &GraphProjectionSpec,
) -> BoxFuture<'static, Result<Arc<dyn GraphView>, FnError>> { ... }
}Expand description
Host callback surfacing graph access to plugin algorithms.
A provider’s AlgorithmProvider::run receives an AlgorithmHost
through its AlgorithmContext and calls AlgorithmHost::project
to materialize a GraphView over the requested subgraph. Hosts
(e.g. uni-plugin-builtin) implement project by building a
projection from their StorageManager / L0Manager; the
AlgorithmHost::as_any downcast hook remains for hosts that expose
additional concrete state. This keeps uni-plugin free of upward
dependencies on uni-store / uni-algo.
Required Methods§
Provided Methods§
Sourcefn project(
&self,
spec: &GraphProjectionSpec,
) -> BoxFuture<'static, Result<Arc<dyn GraphView>, FnError>>
fn project( &self, spec: &GraphProjectionSpec, ) -> BoxFuture<'static, Result<Arc<dyn GraphView>, FnError>>
Materialize a read-only GraphView over the subgraph named by
spec.
The returned future is 'static (owns its inputs) so a provider
can move it into the stream it returns from the synchronous
AlgorithmProvider::run and .await it there. The default
implementation reports that the host offers no graph access;
graph-capable hosts override it.
§Errors
Returns FnError if the host offers no graph access, the
caller lacks the required capability (e.g. HostQuery), or the
projection cannot be built.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".