Struct persist::storage::LockInfo[][src]

pub struct LockInfo {
    reentrance_id: String,
    details: String,
}
Expand description

The partially structured information stored in an exclusive-writer lock.

To allow for restart without operator intervention in situations where we’ve crashed and are unable to cleanly unlock (s3 has no flock equivalent, for example), this supports reentrance. We define the “same” process as any that have the same reentrance id, which is an opaque user-provided string.

This, in essence, delegates the problem of ensuring writer-exclusivity to the persist user, which may have access to better (possibly distributed) locking primitives than we do.

Concretely, MZ Cloud will initially depend on the exclusivity of attaching an EBS volume. We’ll store the reentrant_id somewhere on the EBS volume that holds the catalog. Any process that starts and has access to this volume is guaranteed that the previous machine is no longer available and thus the previous mz process is no longer running. Similarly, a second process cannot accidentally start up pointed at the same storage locations because it will not have the reentrant_id available.

Violating writer-exclusivity will cause undefined behavior including data loss. It’s always correct, and MUCH safer, to provide a random reentrant_id here (e.g. a UUID). It will simply require operator intervention to verify that the previous process is no longer running in the event of a crash and to confirm this by manually removing the previous lock.

Fields

reentrance_id: Stringdetails: String

Implementations

Returns a new LockInfo from its component parts.

Errors if reentrance_id contains a newline.

Constructs a new, empty LockInfo with a unique reentrance id.

Helper for tests that don’t care about locking reentrance (which is most of them).

Returns Ok if this lock information represents a process that may proceed in the presence of some existing lock.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Formats an object with the “alternative” format ({:#}) and returns it.

Compare self to key and return true if they are equal.

Performs the conversion.

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Upcasts this ProgressEventTimestamp to Any. Read more

Returns the name of the concrete type of this object. Read more

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

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