pub enum WorkspacePolicy {
Ephemeral,
Persistent {
root: LocalAbsolutePath,
},
}Expand description
A repository’s configured workspace behaviour.
Persistent carries its root rather than pointing at one, so “persistent
without a path” and “ephemeral with a stale path” are both unrepresentable
rather than merely rejected — the rule crate::model states for capacity,
applied here.
Variants§
Ephemeral
D3: attempts are created under the effective host runner root and the whole attempt directory is removed on cleanup.
Persistent
D4/D5: attempts lease a stable sN slot under root and only _work
survives cleanup.
Fields
root: LocalAbsolutePathImplementations§
Source§impl WorkspacePolicy
impl WorkspacePolicy
Sourcepub fn persistent(
root: LocalAbsolutePath,
scope: TargetScope,
) -> Result<Self, WorkspaceError>
pub fn persistent( root: LocalAbsolutePath, scope: TargetScope, ) -> Result<Self, WorkspaceError>
Configure persistence for a target of scope.
The scope is an argument rather than something the caller checks first,
so D7 is stated at the call site rather than remembered. It is not the
only gate: Persistent { root } is a public variant and so is
constructible directly, which is why
ScalePolicy::set_workspace_policy
and Self::from_persisted re-run Self::permitted_for on the value
they are handed rather than trusting that it came through here.
§Errors
WorkspaceError::PersistentRequiresRepositoryScope for an
organization target.
Sourcepub fn from_persisted(
kind: WorkspaceKind,
root: Option<LocalAbsolutePath>,
scope: TargetScope,
) -> Result<Self, WorkspaceError>
pub fn from_persisted( kind: WorkspaceKind, root: Option<LocalAbsolutePath>, scope: TargetScope, ) -> Result<Self, WorkspaceError>
Rebuild a stored workspace policy from its two columns.
§Errors
WorkspaceError::PersistentWithoutRoot,
WorkspaceError::EphemeralWithRoot, or
WorkspaceError::PersistentRequiresRepositoryScope — the three shapes
a hand-edited row can claim and this crate cannot have written.
pub const fn kind(&self) -> WorkspaceKind
Sourcepub const fn root(&self) -> Option<&LocalAbsolutePath>
pub const fn root(&self) -> Option<&LocalAbsolutePath>
The configured root, for a2 to store and d1/e1 to display.
pub const fn is_persistent(&self) -> bool
Sourcepub const fn retains_job_workspace(&self) -> bool
pub const fn retains_job_workspace(&self) -> bool
Whether the job workspace survives an attempt under this policy.
The counterpart of crate::model::CachePolicy::retains_job_workspace,
which is false by construction. That constant is still correct: it
answers whether the runner package cache policy retains a workspace,
and it never will. This is the deliberate new decision D4 introduced, and
it is spelled on a different type for exactly that reason.
Trait Implementations§
Source§impl Clone for WorkspacePolicy
impl Clone for WorkspacePolicy
Source§fn clone(&self) -> WorkspacePolicy
fn clone(&self) -> WorkspacePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more