Skip to main content

LiveOwnershipRow

Struct LiveOwnershipRow 

Source
pub struct LiveOwnershipRow {
Show 13 fields pub id: i64, pub run_id: Option<i64>, pub operation_kind: LiveOperationKind, pub database_key: String, pub resource_key: String, pub owner_pid: i64, pub acquired_at: DateTime<Utc>, pub heartbeat_at: DateTime<Utc>, pub released_at: Option<DateTime<Utc>>, pub state: LiveOwnershipState, pub restore_intent_json: Option<String>, pub orphan_eligible: bool, pub orphan_evidence_json: Option<String>,
}

Fields§

§id: i64§run_id: Option<i64>§operation_kind: LiveOperationKind§database_key: String§resource_key: String§owner_pid: i64§acquired_at: DateTime<Utc>§heartbeat_at: DateTime<Utc>§released_at: Option<DateTime<Utc>>§state: LiveOwnershipState§restore_intent_json: Option<String>§orphan_eligible: bool§orphan_evidence_json: Option<String>

Implementations§

Source§

impl LiveOwnershipRow

Source

pub async fn create_and_claim( pool: &SqlitePool, new: NewLiveOwnership, claim_key: &str, ) -> DbResult<Option<Self>>

Inserts an owner and conditionally claims its canonical database/resource key in one transaction. Recovery claim transfer is handled atomically by TuneRecoveryAttemptRow::start_with_claim.

Source

pub async fn heartbeat( pool: &SqlitePool, owner_id: i64, now: DateTime<Utc>, ) -> DbResult<()>

Source

pub async fn release( pool: &SqlitePool, owner_id: i64, now: DateTime<Utc>, ) -> DbResult<()>

Source

pub async fn get(pool: &SqlitePool, id: i64) -> DbResult<Option<Self>>

Source

pub async fn has_claim( pool: &SqlitePool, owner_id: i64, expected_claim_key: &str, ) -> DbResult<bool>

Source

pub async fn list_for_run(pool: &SqlitePool, run_id: i64) -> DbResult<Vec<Self>>

Source

pub async fn stale_active_owners( pool: &SqlitePool, stale_before: DateTime<Utc>, ) -> DbResult<Vec<Self>>

Source

pub async fn set_restore_intent( pool: &SqlitePool, owner_id: i64, intent_json: &str, ) -> DbResult<()>

Source

pub async fn mark_orphaned( pool: &SqlitePool, update: OrphanOwnerUpdate<'_>, ) -> DbResult<bool>

Source

pub async fn mark_orphaned_unrecoverable( pool: &SqlitePool, update: UnrecoverableOwnerUpdate<'_>, ) -> DbResult<bool>

Retires a stale owner only after its caller has exported the exact affected rows. Any still-running row attached to the orphaned operation is failed closed rather than made automatically recoverable.

Trait Implementations§

Source§

impl Clone for LiveOwnershipRow

Source§

fn clone(&self) -> LiveOwnershipRow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LiveOwnershipRow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for LiveOwnershipRow

Source§

fn eq(&self, other: &LiveOwnershipRow) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for LiveOwnershipRow

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for LiveOwnershipRow

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more