pub struct Control { /* private fields */ }Expand description
Commands from the API and signals to the loop.
Implementations§
Source§impl Control
impl Control
Sourcepub fn new(
repositories: impl IntoIterator<Item = String>,
paused: impl IntoIterator<Item = String>,
store: Store,
) -> (Control, Commands)
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.
Sourcepub async fn set_paused(
&self,
target: &Target,
paused: bool,
) -> Result<(), ControlError>
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.
Sourcepub fn shutdown(&self, jobs: RunningJobs)
pub fn shutdown(&self, jobs: RunningJobs)
Asks the loop to stop; a forced request overrides a graceful one, never the other way.
Sourcepub async fn pause(
&self,
target: Target,
jobs: RunningJobs,
) -> Result<Paused, ControlError>
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.
Sourcepub async fn reseed(&self, profile: &str) -> Result<(), ControlError>
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.
Sourcepub async fn clean_cache(&self, name: &str) -> Result<(), ControlError>
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.
Sourcepub async fn replace_config(
&self,
config: Config,
memory_max: Option<u64>,
commit: Commit,
) -> Result<Option<String>, ControlError>
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.