Skip to main content

InMemoryTaskStore

Struct InMemoryTaskStore 

Source
pub struct InMemoryTaskStore<Req, Res>
where Req: Clone + Send + Sync + 'static, Res: Clone + Send + Sync + 'static,
{ /* private fields */ }

Implementations§

Source§

impl<Req, Res> InMemoryTaskStore<Req, Res>
where Req: Debug + Clone + Send + Sync + Deserialize<'static> + Serialize + 'static, Res: Debug + Clone + Send + Sync + Deserialize<'static> + Serialize + 'static,

Source

pub fn new(page_size: Option<usize>) -> Self

Trait Implementations§

Source§

impl<Req, Res> TaskStatusSignal for InMemoryTaskStore<Req, Res>
where Req: Clone + Debug + Send + Sync + 'static + Deserialize<'static> + Serialize, Res: Clone + Debug + Send + Sync + 'static + Deserialize<'static> + Serialize,

Source§

fn publish_status_change<'life0, 'life1, 'async_trait>( &'life0 self, event: TaskStatusNotificationParams, session_id: Option<&'life1 String>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Publish a status change event
Source§

fn subscribe( &self, ) -> Option<Pin<Box<dyn Stream<Item = (TaskStatusNotificationParams, Option<String>)> + Send + 'static>>>

Return a new independent stream of events
Source§

impl<Req, Res> TaskStore<Req, Res> for InMemoryTaskStore<Req, Res>
where Req: Clone + Debug + Send + Sync + 'static + Deserialize<'static> + Serialize, Res: Clone + Debug + Send + Sync + 'static + Deserialize<'static> + Serialize,

Source§

fn create_task<'life0, 'async_trait>( &'life0 self, task_params: CreateTaskOptions, _request_id: RequestId, request: Req, session_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Task> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a new task with the given creation parameters and original request. The implementation must generate a unique taskId and createdAt timestamp. Read more
Source§

fn start_task_polling( &self, get_task_callback: TaskStatusPoller, ) -> SdkResult<()>

Begins active polling for task status updates in requestor mode. This method spawns a long-running background task that drives the polling schedule for all tasks managed by this store. It repeatedly invokes the provided get_task_callback to query the receiver for the current status of pending tasks. Read more
Source§

fn wait_for_task_result<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, session_id: Option<String>, ) -> Pin<Box<dyn Future<Output = SdkResult<(TaskStatus, Option<Res>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Waits asynchronously for the result of a task. Read more
Source§

fn get_task<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, session_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Option<Task>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the current status of a task. Read more
Source§

fn store_task_result<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task_id: &'life1 str, status: TaskStatus, result: Res, session_id: Option<&'life2 String>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stores the result of a task and sets its final status. Read more
Source§

fn get_task_result<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, session_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Option<Res>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves the stored result of a task. Read more
Source§

fn update_task_status<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, status: TaskStatus, status_message: Option<String>, session_id: Option<String>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Updates a task’s status (e.g., to ‘cancelled’, ‘failed’, ‘completed’). Read more
Source§

fn list_tasks<'life0, 'async_trait>( &'life0 self, cursor: Option<String>, session_id: Option<String>, ) -> Pin<Box<dyn Future<Output = ListTasksResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists tasks, optionally starting from a pagination cursor. Read more

Auto Trait Implementations§

§

impl<Req, Res> !Freeze for InMemoryTaskStore<Req, Res>

§

impl<Req, Res> !RefUnwindSafe for InMemoryTaskStore<Req, Res>

§

impl<Req, Res> Send for InMemoryTaskStore<Req, Res>

§

impl<Req, Res> Sync for InMemoryTaskStore<Req, Res>

§

impl<Req, Res> Unpin for InMemoryTaskStore<Req, Res>

§

impl<Req, Res> UnsafeUnpin for InMemoryTaskStore<Req, Res>

§

impl<Req, Res> !UnwindSafe for InMemoryTaskStore<Req, Res>

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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<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