Struct WorkflowContext

Source
pub struct WorkflowContext<'ctx> { /* private fields */ }
Expand description

Workflow handler context.

Implementations§

Source§

impl<'ctx> WorkflowContext<'ctx>

Source

pub fn key(&self) -> &str

Get workflow key.

Source

pub fn headers(&self) -> &HeaderMap

Get request headers.

Source

pub fn headers_mut(&mut self) -> &HeaderMap

Get request headers.

Trait Implementations§

Source§

impl<'ctx> From<(&'ctx ContextInternal, InputMetadata)> for WorkflowContext<'ctx>

Source§

fn from(value: (&'ctx ContextInternal, InputMetadata)) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'ctx> Freeze for WorkflowContext<'ctx>

§

impl<'ctx> RefUnwindSafe for WorkflowContext<'ctx>

§

impl<'ctx> Send for WorkflowContext<'ctx>

§

impl<'ctx> Sync for WorkflowContext<'ctx>

§

impl<'ctx> Unpin for WorkflowContext<'ctx>

§

impl<'ctx> UnwindSafe for WorkflowContext<'ctx>

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<'ctx, CTX> ContextAwakeables<'ctx> for CTX
where CTX: SealedContext<'ctx>,

Source§

fn awakeable<T: Deserialize + 'static>( &self, ) -> (String, impl DurableFuture<Output = Result<T, TerminalError>> + Send + 'ctx)

Create an awakeable
Source§

fn resolve_awakeable<T: Serialize + 'static>(&self, key: &str, t: T)

Resolve an awakeable
Source§

fn reject_awakeable(&self, key: &str, failure: TerminalError)

Resolve an awakeable
Source§

impl<'ctx, CTX> ContextClient<'ctx> for CTX
where CTX: SealedContext<'ctx>,

Source§

fn request<Req, Res>( &self, request_target: RequestTarget, req: Req, ) -> Request<'ctx, Req, Res>

Create a Request.
Source§

fn invocation_handle( &self, invocation_id: String, ) -> impl InvocationHandle + 'ctx

Create an InvocationHandle from an invocation id.
Source§

fn service_client<C>(&self) -> C
where C: IntoServiceClient<'ctx>,

Create a service client. The service client is generated by the restate_sdk_macros::service macro with the same name of the trait suffixed with Client. Read more
Source§

fn object_client<C>(&self, key: impl Into<String>) -> C
where C: IntoObjectClient<'ctx>,

Create an object client. The object client is generated by the restate_sdk_macros::object macro with the same name of the trait suffixed with Client. Read more
Source§

fn workflow_client<C>(&self, key: impl Into<String>) -> C
where C: IntoWorkflowClient<'ctx>,

Create an workflow client. The workflow client is generated by the restate_sdk_macros::workflow macro with the same name of the trait suffixed with Client. Read more
Source§

impl<'ctx, CTX> ContextPromises<'ctx> for CTX
where CTX: SealedContext<'ctx> + SealedCanUsePromises,

Source§

fn promise<T: Deserialize + 'static>( &'ctx self, key: &str, ) -> impl DurableFuture<Output = Result<T, TerminalError>> + 'ctx

Create a promise
Source§

fn peek_promise<T: Deserialize + 'static>( &self, key: &str, ) -> impl Future<Output = Result<Option<T>, TerminalError>> + 'ctx

Peek a promise
Source§

fn resolve_promise<T: Serialize + 'static>(&self, key: &str, t: T)

Resolve a promise
Source§

fn reject_promise(&self, key: &str, failure: TerminalError)

Resolve a promise
Source§

impl<'ctx, CTX> ContextReadState<'ctx> for CTX
where CTX: SealedContext<'ctx> + SealedCanReadState,

Source§

fn get<T: Deserialize + 'static>( &self, key: &str, ) -> impl Future<Output = Result<Option<T>, TerminalError>> + 'ctx

Get state
Source§

fn get_keys( &self, ) -> impl Future<Output = Result<Vec<String>, TerminalError>> + 'ctx

Get state keys
Source§

impl<'ctx, CTX> ContextSideEffects<'ctx> for CTX
where CTX: SealedContext<'ctx>,

Source§

fn run<R, F, T>( &self, run_closure: R, ) -> impl RunFuture<Result<T, TerminalError>> + 'ctx
where R: RunClosure<Fut = F, Output = T> + Send + 'ctx, F: Future<Output = HandlerResult<T>> + Send + 'ctx, T: Serialize + Deserialize + 'static,

Journaled actions Read more
Source§

fn random_seed(&self) -> u64

Return a random seed inherently predictable, based on the invocation id, which is not secret. Read more
Source§

fn rand(&mut self) -> &mut StdRng

Generating random numbers Read more
Source§

fn rand_uuid(&mut self) -> Uuid

Generating UUIDs Read more
Source§

impl<'ctx, CTX> ContextTimers<'ctx> for CTX
where CTX: SealedContext<'ctx>,

Source§

fn sleep( &self, duration: Duration, ) -> impl DurableFuture<Output = Result<(), TerminalError>> + 'ctx

Sleep using Restate
Source§

impl<'ctx, CTX> ContextWriteState<'ctx> for CTX
where CTX: SealedContext<'ctx> + SealedCanWriteState,

Source§

fn set<T: Serialize + 'static>(&self, key: &str, t: T)

Set state
Source§

fn clear(&self, key: &str)

Clear state
Source§

fn clear_all(&self)

Clear all state
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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