Skip to main content

RouteChannelEngine

Struct RouteChannelEngine 

Source
pub struct RouteChannelEngine { /* private fields */ }
Expand description

A SurrealEngine that drives an engine which consumes Routes.

The WebSocket and HTTP engines each run a task that reads Routes off a channel and answers on the response channel a Route carries – the channel is also their session replay log, so a reconnection can rebuild what the connection had established. This adapter is the whole of what it takes to expose one of them through SurrealEngine: it turns each typed call back into the Command that task already understands, and unwraps the single response into the type the method promises.

Command is therefore an implementation detail of those two engines, not part of the interface: an engine with no route channel – the embedded and gRPC ones – never constructs a Command at all.

Implementations§

Source§

impl RouteChannelEngine

Source

pub fn new(sender: Sender<Route>) -> Self

Wraps a route sender as a SurrealEngine.

Trait Implementations§

Source§

impl Clone for RouteChannelEngine

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RouteChannelEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SurrealEngine for RouteChannelEngine

Source§

fn query( &self, ctx: EngineContext, query: Cow<'static, str>, variables: Variables, ) -> EngineFuture<'_, Vec<QueryResult>>

Executes SurrealQL, returning one result per statement, in order.
Source§

fn run( &self, ctx: EngineContext, name: String, version: Option<String>, args: Array, ) -> EngineFuture<'_, Value>

Calls a function, or a machine learning model when version is set.
Source§

fn use_ns_db( &self, ctx: EngineContext, namespace: Option<String>, database: Option<String>, ) -> EngineFuture<'_, (Option<String>, Option<String>)>

Selects the namespace and/or database, returning the resulting selection. None for either argument leaves that one unchanged.
Source§

fn set( &self, ctx: EngineContext, key: String, value: Value, ) -> EngineFuture<'_, ()>

Binds a session variable.
Source§

fn unset(&self, ctx: EngineContext, key: String) -> EngineFuture<'_, ()>

Removes a session variable.
Source§

fn signup( &self, ctx: EngineContext, credentials: Object, ) -> EngineFuture<'_, Token>

Registers a record user and authenticates the session as them.
Source§

fn signin( &self, ctx: EngineContext, credentials: Object, ) -> EngineFuture<'_, Token>

Authenticates the session with credentials.
Source§

fn authenticate( &self, ctx: EngineContext, token: Token, ) -> EngineFuture<'_, Token>

Authenticates the session with an existing token, returning the token now in effect. Read more
Source§

fn refresh(&self, ctx: EngineContext, token: Token) -> EngineFuture<'_, Token>

Exchanges a refresh token for a fresh token pair.
Source§

fn revoke(&self, ctx: EngineContext, token: Token) -> EngineFuture<'_, ()>

Invalidates a refresh token so it can no longer be redeemed.
Source§

fn invalidate(&self, ctx: EngineContext) -> EngineFuture<'_, ()>

Drops the session’s authentication.
Source§

fn begin(&self, ctx: EngineContext) -> EngineFuture<'_, Uuid>

Opens an explicit transaction, returning its id.
Source§

fn commit(&self, ctx: EngineContext, txn: Uuid) -> EngineFuture<'_, ()>

Commits an explicit transaction.
Source§

fn rollback(&self, ctx: EngineContext, txn: Uuid) -> EngineFuture<'_, ()>

Cancels an explicit transaction.
Source§

fn health(&self, ctx: EngineContext) -> EngineFuture<'_, ()>

Checks that the engine is reachable.
Source§

fn version(&self, ctx: EngineContext) -> EngineFuture<'_, String>

Reports the database version, as the server spells it (for example surrealdb-3.0.0).
Source§

fn subscribe_live( &self, ctx: EngineContext, uuid: Uuid, notifications: Sender<Result<Notification, Error>>, ) -> EngineFuture<'_, ()>

Registers the channel a live query’s notifications are delivered on.
Source§

fn kill(&self, ctx: EngineContext, uuid: Uuid) -> EngineFuture<'_, ()>

Kills a live query.
Source§

fn export_file( &self, ctx: EngineContext, path: PathBuf, config: Option<DbExportConfig>, ) -> EngineFuture<'_, ()>

Exports the database to a file.
Source§

fn export_bytes( &self, ctx: EngineContext, bytes: Sender<Result<Vec<u8>, Error>>, config: Option<DbExportConfig>, ) -> EngineFuture<'_, ()>

Exports the database, streaming it to a channel.
Source§

fn export_ml_file( &self, ctx: EngineContext, path: PathBuf, config: MlExportConfig, ) -> EngineFuture<'_, ()>

Exports a machine learning model to a file.
Source§

fn export_ml_bytes( &self, ctx: EngineContext, bytes: Sender<Result<Vec<u8>, Error>>, config: MlExportConfig, ) -> EngineFuture<'_, ()>

Exports a machine learning model, streaming it to a channel.
Source§

fn import_file(&self, ctx: EngineContext, path: PathBuf) -> EngineFuture<'_, ()>

Imports a database export from a file.
Source§

fn import_ml_file( &self, ctx: EngineContext, path: PathBuf, ) -> EngineFuture<'_, ()>

Imports a machine learning model from a file.
Source§

fn query_stream( &self, ctx: EngineContext, query: Cow<'static, str>, variables: Variables, items: Sender<QueryStreamItem>, ) -> EngineFuture<'_, ()>

Executes SurrealQL, sending results into items as they are produced. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool