Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub host: Host,
    pub caches: Caches,
    pub profiles: BTreeMap<String, Profile>,
    pub repositories: Vec<Repository>,
    pub history: History,
    pub records: Records,
    pub sizing: Sizing,
    pub web: Web,
    pub notify: Notify,
    pub github: Github,
}
Expand description

A parsed runnerd.toml. validate checks it against the host’s budget.

Fields§

§host: Host

The host’s budget and isolation.

§caches: Caches

The caches runners share.

§profiles: BTreeMap<String, Profile>

Runner profiles by name.

§repositories: Vec<Repository>

The repositories to serve, one pool per entry: a repository named by several entries is served by each of their profiles, a job by the one whose labels match it (ADR 0058).

§history: History

What is kept of past jobs.

§records: Records

How much the records of failed jobs may keep.

§sizing: Sizing

How sizing advice reads the job history.

§web: Web

Who may use the dashboard through another address.

§notify: Notify

Where the daemon sends notifications; none by default.

§github: Github

What runnerd may ask of GitHub on the owner’s behalf.

Implementations§

Source§

impl Config

Source

pub fn budget_blocks( &self, admission: AdmissionPolicy, ) -> Option<Vec<BudgetBlock>>

What admission holds to MemoryMax, a block per profile: under caps, every slot of each profile at its cap; under measured, one runner of the largest profile. The mirror with either. None when the caps overflow, as Config::memory_caps refuses them.

Source

pub fn check_against(&self, memory_max: Option<ByteSize>) -> ConfigCheck

Validates the parsed config against memory_max, the slice’s MemoryMax: what Config::check answers once the text parses and the slice is read, and what doctor checks the config the daemon runs with by.

Source§

impl Config

Source

pub fn load(path: &Path) -> Result<Config, ConfigError>

Reads and parses a config file.

Source

pub fn parse(text: &str) -> Result<Config, ConfigError>

Parses a config from TOML text.

Source

pub fn unreviewed() -> &'static str

Why a save from a diff is refused when the text changed after the diff was shown: the save would write lines nobody reviewed.

Source

pub fn parse_error(text: &str) -> Option<ParseError>

Where text stops parsing as a config: the line, counted from 1, and the parser’s words without its own excerpt of the text, for an editor that marks the line. None when it parses, and for an error the parser places nowhere.

Source

pub fn check( text: &str, memory_max: impl FnOnce(&str) -> Result<Option<ByteSize>>, ) -> (Option<Config>, ConfigCheck)

Parses text and validates it against the MemoryMax that memory_max reads for the slice it names: what runnerd check-config prints and POST /v1/config/check answers. Returns the config if it is valid.

Source

pub fn mirror_memory(&self) -> u64

The mirror’s memory cap, 0 when it is disabled.

Source

pub fn memory_caps(&self) -> Result<ByteSize, ConfigError>

The memory every runner and the mirror may use at once.

Source

pub fn memory_needed(&self) -> Result<ByteSize, ConfigError>

The memory [host] admission must fit in MemoryMax: every cap at once under caps; under measured, the largest single runner with the mirror, since slots there only bounds how many run at once.

Source

pub fn runner_ceiling(&self) -> Option<u64>

The most memory one runner of any profile may have under [host] memory_ceiling: the ceiling less the mirror while it is enabled, as no host of that size starts more beside it. None without a ceiling. The config check refuses a profile above it, and auto sizing raises none past it (ADR 0086).

Source

pub fn pool(&self, repository: &str, labels: &[String]) -> Option<&Repository>

The pool of repository whose labels match a job asking for labels: every label it asks for is one of the pool’s. None when no pool of it does.

Source

pub fn pool_in(&self, repository: &str, profile: &str) -> Option<&Repository>

The pool of repository in profile, whose runners start in that profile’s slots.

Source

pub fn pricing(&self) -> Pricing

The GitHub-hosted runner each profile’s jobs are priced at (ADR 0072).

Source

pub fn repository_names(&self) -> Vec<String>

The repositories served, each once, in the order the config first names them.

Source

pub fn validate( &self, memory_max: Option<ByteSize>, ) -> Result<Vec<Warning>, ConfigError>

Checks the config against the slice’s MemoryMax (None when the slice is unlimited).

Trait Implementations§

Source§

impl Debug for Config

Source§

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

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

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

§

impl UnwindSafe for Config

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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