pub enum AttemptWorkspace {
Ephemeral,
PersistentSlot {
slot: NonZeroU16,
},
}Expand description
The immutable allocation fact journalled with one runner attempt.
02-target-architecture.md: “runtime_path remains the exact path used by
the attempt. The workspace kind and slot number tell recovery which cleanup
algorithm is legal. Neither may change after allocation.” There is therefore
no mutator here and none on RunnerAttempt — the value is set by the
allocating constructor and read thereafter.
A persistent variant is also a durable slot lease: every attempt whose
state is not cleaned, including a terminal one whose cleanup failed, holds
its slot. That is why the slot lives on the attempt rather than in a slot
table — the journal is already the authority on which leases exist.
Variants§
Ephemeral
A unique directory under the effective host runner root, removed whole.
PersistentSlot
The sN slot leased from the policy’s persistent root.
Fields
slot: NonZeroU16Implementations§
Source§impl AttemptWorkspace
impl AttemptWorkspace
Sourcepub const fn persistent_slot(slot: NonZeroU16) -> Self
pub const fn persistent_slot(slot: NonZeroU16) -> Self
Lease slot slot.
Sourcepub fn from_persisted(
kind: WorkspaceKind,
slot: Option<u16>,
) -> Result<Self, WorkspaceError>
pub fn from_persisted( kind: WorkspaceKind, slot: Option<u16>, ) -> Result<Self, WorkspaceError>
Rebuild a journalled allocation from its two columns.
The raw slot is a u16 rather than a NonZeroU16 precisely so that
0 — a value SQLite will happily hold and this crate will never write —
is a refusal here rather than a panic or a silent s0.
§Errors
WorkspaceError::PersistentWithoutSlot,
WorkspaceError::EphemeralWithSlot, or
WorkspaceError::SlotNotPositive.
pub const fn kind(&self) -> WorkspaceKind
Sourcepub const fn slot(&self) -> Option<NonZeroU16>
pub const fn slot(&self) -> Option<NonZeroU16>
The leased slot, for a2’s uncleaned-lease index and c2’s allocator.
Sourcepub const fn slot_number(&self) -> Option<u16>
pub const fn slot_number(&self) -> Option<u16>
The stored slot column: None for an ephemeral attempt.
pub const fn is_persistent(&self) -> bool
Sourcepub fn slot_directory_name(&self) -> Option<String>
pub fn slot_directory_name(&self) -> Option<String>
The slot’s directory name under the persistent root.
02-target-architecture.md: “Names are s1, s2, and so on to minimize
path length.” It is derived here, once, so no caller builds the string a
second way — the whole change exists because a path grew too long.
Trait Implementations§
Source§impl Clone for AttemptWorkspace
impl Clone for AttemptWorkspace
Source§fn clone(&self) -> AttemptWorkspace
fn clone(&self) -> AttemptWorkspace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more