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: DocumentBoxScopeRawRef<'_>, ) -> DbResult<Option<Task>>
Sourcepub async fn complete_task(
&mut self,
db: impl DbExecutor<'_>,
status: TaskStatus,
output_data: Option<Value>,
) -> DbResult<()>
pub async fn complete_task( &mut self, db: impl DbExecutor<'_>, status: TaskStatus, output_data: Option<Value>, ) -> DbResult<()>
Mark the task as completed and set its output data
Sourcepub async fn delete_expired(
db: impl DbExecutor<'_>,
before: DateTime<Utc>,
) -> DbResult<PgQueryResult>
pub async fn delete_expired( db: impl DbExecutor<'_>, before: DateTime<Utc>, ) -> DbResult<PgQueryResult>
Deletes all tasks where the creation date is older than the before date
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>,
impl Eq for Task
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreCreates a shared type from an unshared type.