Skip to main content

Control

Struct Control 

Source
pub struct Control { /* private fields */ }
Expand description

Commands from the API and signals to the loop.

Implementations§

Source§

impl Control

Source

pub fn new( repositories: impl IntoIterator<Item = String>, paused: impl IntoIterator<Item = String>, store: Store, ) -> (Control, Commands)

Controls for the configured repositories, of which those in paused start paused, and the commands they send the engine. A paused repository the config no longer has is forgotten, in store too: one added back starts active.

Source

pub fn mode(&self) -> Shutdown

Whether a shutdown was requested, and how.

Source

pub async fn set_paused( &self, target: &Target, paused: bool, ) -> Result<(), ControlError>

Pauses or resumes one repository or all, whatever they run, and records it in the store before it answers, so a restarted daemon starts with the same ones paused. NotFound for a repository the config does not have. If the record fails, the change holds until a restart and the answer is NotRecorded.

Source

pub fn shutdown(&self, jobs: RunningJobs)

Asks the loop to stop; a forced request overrides a graceful one, never the other way.

Source

pub fn is_paused(&self, repository: &str) -> bool

Whether the repository is paused.

Source

pub async fn pause( &self, target: Target, jobs: RunningJobs, ) -> Result<Paused, ControlError>

Pauses one repository or all. With RunningJobs::Keep, refuses while any of them runs a job, pausing none; with Kill, cancels the runs of their running jobs on GitHub, whose runners are removed once they report it or CANCEL_GRACE later, and removes their other runners at once.

Source

pub async fn reseed(&self, profile: &str) -> Result<(), ControlError>

Reseeds a profile as soon as its slots are free; none of them starts a runner until then.

Source

pub async fn clean_cache(&self, name: &str) -> Result<(), ControlError>

Removes a slot’s volume or a shared cache’s, unless a runner uses it.

Source

pub async fn replace_config( &self, config: Config, memory_max: Option<u64>, commit: Commit, ) -> Result<Option<String>, ControlError>

Runs commit to write a validated config, and if it commits, runs with the config from then on, before the next tick. If it does not, nothing changes and the answer is Failed. Running jobs keep running: removed profiles and slots go as their runners finish.

Trait Implementations§

Source§

impl Debug for Control

Source§

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

Formats the value using the given formatter. Read more

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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