Skip to main content

RunnerPool

Struct RunnerPool 

Source
pub struct RunnerPool {
    pub gid: u32,
    pub accounts: Vec<RunnerAccount>,
    pub legacy: Option<RunnerAccount>,
}
Expand description

The accounts a Linux boot service’s runners run as, one per concurrent runner, all in RUNNER_GROUP.

Fields§

§gid: u32

RUNNER_GROUP’s id.

§accounts: Vec<RunnerAccount>

The accounts a new attempt may be given, in order of preference.

§legacy: Option<RunnerAccount>

The single account an earlier release ran every runner as: accepted for an attempt it already owns, and given to a new one only when the pool has no account of its own yet.

Implementations§

Source§

impl RunnerPool

Source

pub fn for_this_daemon() -> Result<Option<Self>, String>

The pool runners launched by this process run as: Ok(None) when they run as this process does.

Some only for root on Linux with the pool present, which is what service install --start-at boot sets up. A login service, a foreground daemon and every other platform keep their runners in their own account, as before.

A boot unit’s daemon is root with a narrowed capability bounding set that still holds CAP_DAC_OVERRIDE and the rest of crate::service::BOOT_CAPABILITIES. A runner it started as itself would keep them, so without the pool it must start none. A root with every capability – sudo runner-manager daemon run in a terminal – keeps its runners as itself, as before.

§Errors

Why no runner may start: the pool is missing under a confined root.

Source

pub fn lookup() -> Option<Self>

The pool as it exists on this host, or None when it has no account at all.

Source

pub fn ensure() -> Result<Self, String>

The pool, with RUNNER_GROUP and every account up to POOL_SIZE created as system accounts where missing.

§Errors

What groupadd or useradd reported, when one had to run and failed.

Source

pub fn account(&self, uid: u32) -> Option<RunnerAccount>

The pool account, or the legacy one, with user id uid.

Source

pub fn allocate( &self, owner: Option<RunnerAccount>, held: &BTreeSet<u32>, busy: impl FnOnce() -> BTreeSet<u32>, ) -> Option<RunnerAccount>

The account an attempt runs as. owner is the one that already owns its directory, kept unless another live attempt holds it (held): a persistent slot kept since an earlier attempt then moves to a free account. Otherwise the first account neither held nor busy (which is asked only then) is chosen. While the pool has no account of its own, every attempt shares the legacy one. None when all are taken.

Source

pub fn share_tree(&self, path: &Path) -> Result<()>

Shares path and everything under it with every account in the pool: the group becomes RUNNER_GROUP, which may read and write it, new entries in a directory inherit that group (set-group-ID), and a default ACL gives the group write access to what any account creates later, whatever umask that account’s job runs with.

A directory already shared is not entered, so a second call over a large cache costs one lstat. Links are never followed.

§Errors

The first error met, after which the rest of the tree is not visited.

Source

pub fn is_shared(&self, metadata: &Metadata) -> bool

Whether metadata describes a directory Self::share_tree has already shared.

Trait Implementations§

Source§

impl Clone for RunnerPool

Source§

fn clone(&self) -> Self

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 RunnerPool

Source§

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

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

impl Eq for RunnerPool

Source§

impl PartialEq for RunnerPool

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RunnerPool

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

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

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