pub struct Task {
pub id: Uuid,
pub document_box: DocumentBoxScopeRaw,
pub status: TaskStatus,
pub output_data: Option<Value>,
pub created_at: DateTime<Utc>,
pub completed_at: Option<DateTime<Utc>>,
}Expand description
Represents a stored asynchronous task progress
Fields§
§id: UuidUnique ID of the task
document_box: DocumentBoxScopeRawID of the document box the task belongs to
status: TaskStatusStatus of the task
output_data: Option<Value>Output data from the task completion
created_at: DateTime<Utc>When the task was created
completed_at: Option<DateTime<Utc>>Implementations§
Source§impl Task
impl Task
Sourcepub async fn create(
db: impl DbExecutor<'_>,
document_box: DocumentBoxScopeRaw,
) -> DbResult<Task>
pub async fn create( db: impl DbExecutor<'_>, document_box: DocumentBoxScopeRaw, ) -> DbResult<Task>
Stores / updates the stored user data, returns back the user ID
pub async fn find( db: impl DbExecutor<'_>, id: TaskId, document_box: &DocumentBoxScopeRaw, ) -> DbResult<Option<Task>>
Sourcepub async fn complete_task(
self,
db: impl DbExecutor<'_>,
status: TaskStatus,
output_data: Option<Value>,
) -> DbResult<Task>
pub async fn complete_task( self, db: impl DbExecutor<'_>, status: TaskStatus, output_data: Option<Value>, ) -> DbResult<Task>
Mark the task as completed and set its output data
Trait Implementations§
Source§impl<'a, R: Row> FromRow<'a, R> for Taskwhere
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, R::Database> + Type<R::Database>,
DocumentBoxScopeRaw: Decode<'a, R::Database> + Type<R::Database>,
TaskStatus: Decode<'a, R::Database> + Type<R::Database>,
Option<Value>: Decode<'a, R::Database> + Type<R::Database>,
DateTime<Utc>: Decode<'a, R::Database> + Type<R::Database>,
Option<DateTime<Utc>>: Decode<'a, R::Database> + Type<R::Database>,
impl<'a, R: Row> FromRow<'a, R> for Taskwhere
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, R::Database> + Type<R::Database>,
DocumentBoxScopeRaw: Decode<'a, R::Database> + Type<R::Database>,
TaskStatus: Decode<'a, R::Database> + Type<R::Database>,
Option<Value>: Decode<'a, R::Database> + Type<R::Database>,
DateTime<Utc>: Decode<'a, R::Database> + Type<R::Database>,
Option<DateTime<Utc>>: Decode<'a, R::Database> + Type<R::Database>,
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnwindSafe for Task
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
Mutably borrows from an owned value. Read more
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>
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 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>
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