pub struct Snapshot {Show 14 fields
pub id: Uuid,
pub workspace_id: Uuid,
pub hosted_deployment_id: Option<Uuid>,
pub name: Option<String>,
pub description: Option<String>,
pub triggered_by: String,
pub triggered_by_user: Option<Uuid>,
pub status: String,
pub storage_url: Option<String>,
pub size_bytes: Option<i64>,
pub manifest: Option<Value>,
pub expires_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub captured_at: Option<DateTime<Utc>>,
}Fields§
§id: Uuid§workspace_id: Uuid§hosted_deployment_id: Option<Uuid>§name: Option<String>§description: Option<String>§triggered_by: String§triggered_by_user: Option<Uuid>§status: String§storage_url: Option<String>§size_bytes: Option<i64>§manifest: Option<Value>§expires_at: Option<DateTime<Utc>>§created_at: DateTime<Utc>§captured_at: Option<DateTime<Utc>>Implementations§
Source§impl Snapshot
impl Snapshot
pub async fn list_by_workspace( pool: &Pool<Postgres>, workspace_id: Uuid, limit: i64, ) -> Result<Vec<Snapshot>, Error>
pub async fn find_by_id( pool: &Pool<Postgres>, id: Uuid, ) -> Result<Option<Snapshot>, Error>
Sourcepub async fn create(
pool: &Pool<Postgres>,
input: CreateSnapshot<'_>,
) -> Result<Snapshot, Error>
pub async fn create( pool: &Pool<Postgres>, input: CreateSnapshot<'_>, ) -> Result<Snapshot, Error>
Insert a snapshot row in capturing status. The capture worker
transitions it to ready (with storage_url + size_bytes + manifest
- captured_at) once the blob is safely uploaded.
Sourcepub async fn mark_ready(
pool: &Pool<Postgres>,
id: Uuid,
storage_url: &str,
size_bytes: i64,
manifest: &Value,
) -> Result<Option<Snapshot>, Error>
pub async fn mark_ready( pool: &Pool<Postgres>, id: Uuid, storage_url: &str, size_bytes: i64, manifest: &Value, ) -> Result<Option<Snapshot>, Error>
Worker callback: snapshot blob is durably stored; transition to
ready. Idempotent — only updates rows currently in capturing.
Sourcepub async fn mark_failed(
pool: &Pool<Postgres>,
id: Uuid,
) -> Result<Option<Snapshot>, Error>
pub async fn mark_failed( pool: &Pool<Postgres>, id: Uuid, ) -> Result<Option<Snapshot>, Error>
Worker callback for the failure path. Idempotent.
pub async fn delete(pool: &Pool<Postgres>, id: Uuid) -> Result<bool, Error>
Sourcepub async fn mark_expired_batch(
pool: &Pool<Postgres>,
limit: i64,
) -> Result<Vec<Snapshot>, Error>
pub async fn mark_expired_batch( pool: &Pool<Postgres>, limit: i64, ) -> Result<Vec<Snapshot>, Error>
Retention worker callback: transition ready snapshots whose
expires_at has passed to expired. Returns the snapshots
affected so the worker can reclaim their blobs after the row
flip lands. Idempotent: rows already in expired are skipped.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Snapshot
impl<'de> Deserialize<'de> for Snapshot
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Snapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Snapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, R> FromRow<'a, R> for Snapshotwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<i64>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Value>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<DateTime<Utc>>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
impl<'a, R> FromRow<'a, R> for Snapshotwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<i64>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Value>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<DateTime<Utc>>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Source§impl Serialize for Snapshot
impl Serialize for Snapshot
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Snapshot
impl RefUnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshot
impl UnwindSafe for Snapshot
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<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.