pub struct RuntimeSdk { /* private fields */ }Expand description
Backend-agnostic facade for runtime queue, outbox, and recurring operations.
Implementations§
Source§impl RuntimeSdk
impl RuntimeSdk
Sourcepub fn new(runtime: RuntimeComposition) -> Self
pub fn new(runtime: RuntimeComposition) -> Self
Creates a new facade over a pre-built runtime composition.
Sourcepub async fn in_memory() -> Result<Self>
pub async fn in_memory() -> Result<Self>
Builds an in-memory runtime facade with default wiring.
Sourcepub async fn surreal_mem(
namespace: impl Into<String>,
database: impl Into<String>,
) -> Result<Self>
pub async fn surreal_mem( namespace: impl Into<String>, database: impl Into<String>, ) -> Result<Self>
Builds a surreal-mem runtime facade with default wiring.
Sourcepub async fn surreal_ws(
endpoint: impl Into<String>,
namespace: impl Into<String>,
database: impl Into<String>,
) -> Result<Self>
pub async fn surreal_ws( endpoint: impl Into<String>, namespace: impl Into<String>, database: impl Into<String>, ) -> Result<Self>
Builds a remote websocket surreal runtime facade with default wiring.
Sourcepub async fn surreal_ws_with_auth(
endpoint: impl Into<String>,
namespace: impl Into<String>,
database: impl Into<String>,
auth: Option<SurrealAuth>,
) -> Result<Self>
pub async fn surreal_ws_with_auth( endpoint: impl Into<String>, namespace: impl Into<String>, database: impl Into<String>, auth: Option<SurrealAuth>, ) -> Result<Self>
Builds a remote websocket surreal runtime facade with optional root credentials.
Sourcepub async fn surreal_kv(
path: impl Into<String>,
namespace: impl Into<String>,
database: impl Into<String>,
) -> Result<Self>
pub async fn surreal_kv( path: impl Into<String>, namespace: impl Into<String>, database: impl Into<String>, ) -> Result<Self>
Builds an embedded surreal-kv runtime facade with default wiring.
Sourcepub async fn surreal_kv_with_auth(
path: impl Into<String>,
namespace: impl Into<String>,
database: impl Into<String>,
auth: Option<SurrealAuth>,
) -> Result<Self>
pub async fn surreal_kv_with_auth( path: impl Into<String>, namespace: impl Into<String>, database: impl Into<String>, auth: Option<SurrealAuth>, ) -> Result<Self>
Builds an embedded surreal-kv runtime facade with optional root credentials.
Sourcepub async fn surreal_mem_with_auth(
namespace: impl Into<String>,
database: impl Into<String>,
auth: Option<SurrealAuth>,
) -> Result<Self>
pub async fn surreal_mem_with_auth( namespace: impl Into<String>, database: impl Into<String>, auth: Option<SurrealAuth>, ) -> Result<Self>
Builds a surreal-mem runtime facade with optional root credentials.
Sourcepub async fn from_builder(builder: StasisRuntimeBuilder) -> Result<Self>
pub async fn from_builder(builder: StasisRuntimeBuilder) -> Result<Self>
Builds a runtime facade from a fully configured runtime builder.
Sourcepub fn runtime(&self) -> &RuntimeComposition
pub fn runtime(&self) -> &RuntimeComposition
Returns a shared reference to the underlying runtime composition.
Sourcepub fn into_runtime(self) -> RuntimeComposition
pub fn into_runtime(self) -> RuntimeComposition
Consumes this facade and returns the owned runtime composition.
Sourcepub async fn register_recurring(
&self,
definition: RecurringDefinition,
) -> Result<()>
pub async fn register_recurring( &self, definition: RecurringDefinition, ) -> Result<()>
Registers a recurring job definition.
Sourcepub async fn process_once(
&self,
queue: &str,
worker_id: &str,
) -> Result<Option<String>>
pub async fn process_once( &self, queue: &str, worker_id: &str, ) -> Result<Option<String>>
Attempts to process one job from a queue using the provided worker id.
Sourcepub async fn publish_pending_events(&self, limit: usize) -> Result<usize>
pub async fn publish_pending_events(&self, limit: usize) -> Result<usize>
Publishes pending outbox events up to limit.
Sourcepub async fn materialize_recurring_now(
&self,
scheduler_id: &str,
) -> Result<usize>
pub async fn materialize_recurring_now( &self, scheduler_id: &str, ) -> Result<usize>
Materializes any due recurring jobs at the current wall-clock time.
Sourcepub async fn stats_snapshot(
&self,
pending_limit: usize,
) -> Result<RuntimeStatsSnapshot>
pub async fn stats_snapshot( &self, pending_limit: usize, ) -> Result<RuntimeStatsSnapshot>
Aggregates common runtime counts into a single snapshot.
Sourcepub async fn job_count_by_state(&self, state: JobState) -> Result<usize>
pub async fn job_count_by_state(&self, state: JobState) -> Result<usize>
Counts jobs currently in the specified state.
Sourcepub async fn pending_outbox_count(&self, limit: usize) -> Result<usize>
pub async fn pending_outbox_count(&self, limit: usize) -> Result<usize>
Counts pending outbox events, bounded by limit.
Sourcepub async fn recurring_count(&self) -> Result<usize>
pub async fn recurring_count(&self) -> Result<usize>
Counts registered recurring definitions.
Trait Implementations§
Source§impl Clone for RuntimeSdk
impl Clone for RuntimeSdk
Source§fn clone(&self) -> RuntimeSdk
fn clone(&self) -> RuntimeSdk
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RuntimeSdk
impl !RefUnwindSafe for RuntimeSdk
impl Send for RuntimeSdk
impl Sync for RuntimeSdk
impl Unpin for RuntimeSdk
impl UnsafeUnpin for RuntimeSdk
impl !UnwindSafe for RuntimeSdk
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request