Skip to main content

Crate surrealdb_engine_api

Crate surrealdb_engine_api 

Source
Expand description

The service-provider interface between the SurrealDB Rust SDK and the engines it drives.

An engine owns a datastore or a connection to one, and serves SurrealEngine to the SDK. Some run as a task the SDK hands a Route per request, answering on the route’s response channel; session lifetime travels alongside on a separate SessionId channel either way. This crate holds exactly the types that cross that boundary, so an engine can live in its own crate without the SDK depending on it, or on anything it in turn depends on.

§Stability

This is an internal interface between crates released together. It carries no stability guarantee and may change in any release, including a patch release. Depend on it only if you implement an engine; application code should use the surrealdb crate.

Re-exports§

pub use session::Established;
pub use session::SessionEntry;
pub use session::SessionRegistry;

Modules§

session
The registry an engine keeps its sessions in.

Structs§

DbExportConfig
EngineContext
Which session, and which explicit transaction, a request applies to.
MlExportConfig
Which machine learning model to export, by name and version.
RequestData
A request travelling from the SDK to an engine, tagged with the session it belongs to.
Route
A request paired with the channel its response must be sent on.
RouteChannelEngine
A SurrealEngine that drives an engine which consumes Routes.

Enums§

Command
The operations an engine can be asked to perform.
SessionError
Why a route could not be matched to a session.
SessionId
A session-lifetime event. Engines keep per-session state (the authenticated session, its variables, its live queries), and these events tell them when to create, copy and discard it.

Constants§

QUERY_STREAM_BUFFER
The channel depth a consumer should give a streaming execution.

Traits§

SurrealEngine
The interface every SurrealDB engine implements, and the only thing the Rust SDK calls to reach a database.

Functions§

session_error_to_error
Convert a session error into the error type the SDK surfaces to callers.
single_result
Flattens the results of an operation that runs a single statement into the one value it produced.

Type Aliases§

BoxFuture
A future boxed for storage behind a trait object, as SurrealEngine’s methods require.
EngineFuture
A boxed engine result.