Skip to main content

Store

Struct Store 

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

The job history. Cloning shares it.

Implementations§

Source§

impl Store

Source

pub fn open(path: &Path) -> Result<Store, StoreError>

Opens the database at path, creating it and its directory (mode 0700) if missing, and migrates it to the latest version. Refuses a database a newer runnerd wrote.

Source

pub fn queued(&self, repository: &str, job: &QueuedJob)

Records a queued job the repository’s runners may run; announces it the first time.

Source

pub fn runner_started(&self, runner: RunnerRecord)

Records a runner container that started, or one an earlier daemon started and this one adopted.

Source

pub fn runner_removed(&self, runner: &str, at: u64)

Records that a runner’s container and registration were removed at at (ms).

Source

pub fn runners_gone(&self, running: Vec<String>, at: u64)

Records every runner the history holds open, except the running ones, removed at at (ms): what recovery found gone, so it stops counting as holding a slot.

Source

pub fn claimed(&self, job: u64, run_id: u64, runner: &str, at: u64)

Records that a runner took a job at at (ms).

Source

pub fn details(&self, details: JobDetails)

Records a running job’s progress and steps as GitHub reports them; announces changed steps.

Source

pub fn elsewhere(&self, details: JobDetails)

Closes a queued job that left the queue without a runner of this daemon: another machine’s runner took it, or none did and it has no start.

Source

pub fn lost(&self, job: u64, at: u64)

Closes a job whose container is gone and that GitHub did not report completed in time.

Source

pub async fn log( &self, job: u64, lines: Vec<String>, position: LogPosition, max_bytes: u64, )

Appends log lines to a job, up to max_bytes per job, and records where the capture continues. Waits while LOG_BACKLOG bytes of lines are waiting to be stored; a larger batch goes in parts, each waiting its turn.

Source

pub fn samples(&self, samples: Vec<SampleRecord>)

Records samples of runner containers.

Source

pub fn host_sample(&self, sample: HostSample)

Records a sample of the slice and sends it to every subscriber at once; it is stored with the next ones, a minute’s worth in one transaction, or at flush.

Source

pub fn latest_sample(&self, runner: &str) -> Option<SampleRecord>

A runner’s last sample, stored or not; None before its first sample or once it is removed.

Source

pub fn runner_admission(&self, runner: &str, admission: Admission)

Records what a runner reserves now, when measured admission changed it after the start.

Source

pub fn runner_oom_killed(&self, runner: &str)

Records that Docker saw the kernel kill a process in a runner’s container for memory, which its samples may have missed: one in the last interval before the container stopped.

Source

pub fn build_cache(&self, runner: &str, counts: BuildCacheCounts)

Adds what the shared build cache served a runner and took from it, and records whether its job could write.

Source

pub fn host_memory(&self, memory: HostMemory)

Keeps the latest reading of the host’s memory for admission and the status; it is not stored.

Source

pub fn latest_host_memory(&self) -> Option<HostMemory>

The latest reading of the host’s memory; None before the first.

Source

pub fn host_waited(&self, jobs: Vec<u64>, ms: u64)

Adds ms to how long each of jobs waited because the host’s memory could not take its runner, which sizing does not read as a wait for a slot.

Source

pub fn latest_host_sample(&self) -> Option<HostSample>

The last host sample sent, stored or not; None before the first.

Source

pub async fn mirror_bytes( &self, bytes: Vec<(String, u64)>, until: MirrorPosition, ) -> bool

Adds bytes the mirror served to runners, counted from its log up to until, and says whether that was stored: if not, the caller counts the same lines again.

Source

pub fn cache_sizes(&self, at: u64, sizes: BTreeMap<String, u64>)

Records volume sizes in bytes, by name, measured at at (ms).

Source

pub fn event(&self, event: Event)

Stores a durable event, or sends a live one, to every subscriber.

Source

pub fn record_made(&self, record: Record)

Records that a failed job’s runner was kept as record, and announces it.

Source

pub fn record_skipped(&self, job: u64, why: String)

Records why a failed job’s runner was not kept.

Source

pub fn record_removed(&self, job: u64, at: u64, by: RecordRemoval)

Records that a job’s record was removed at at (ms), and why, and announces it.

Source

pub fn paused( &self, repositories: Vec<String>, ) -> impl Future<Output = bool> + use<>

Records the paused repositories, all of them, in place of the ones recorded before. The write is sent at once, in order with every other; the future says whether it committed.

Source

pub fn visibility(&self, repository: String, visibility: Visibility, at: u64)

Records a repository’s visibility as GitHub gave it at at (ms), in place of the one recorded before.

Source

pub fn sizing_intent( &self, change: SizingChange, ) -> impl Future<Output = Option<i64>> + use<>

Records a change auto sizing is about to write, as pending, before the file is, synced to disk. The future has its row once it committed, None if it did not: then nothing may be written.

Source

pub fn sizing_resolved( &self, id: i64, resolution: Resolution, ) -> impl Future<Output = bool> + use<>

Records what became of a pending change, synced to disk; a done one is announced as sizing.changed in the same transaction. The future says whether it committed.

Source

pub fn notify_record( &self, target: &str, set: Vec<(String, u64)>, remove: Vec<String>, ) -> impl Future<Output = bool> + use<>

Records what the notifier delivered to a target: sets set’s keys and removes remove’s, in one transaction. The future says whether it committed.

Source

pub fn notify_keep( &self, targets: Vec<String>, ) -> impl Future<Output = bool> + use<>

Forgets what the notifier kept for every target but targets. The future says whether it committed.

Source

pub fn prune(&self, now: u64, history: &History) -> JoinHandle<()> ⓘ

Deletes what is older than history keeps, at now (ms), off the writer, in batches the writer’s transactions fit between. A prune while the last one runs does nothing. The handle finishes with it; dropping it lets it run.

Source

pub fn close(&self)

Stops a running prune after its batch, and any later one before it starts, so a shutdown does not wait for one. What a stopped prune left, the next daemon’s deletes. Writes go on as before.

Source

pub async fn flush(&self)

Waits until every write sent before is done.

Source

pub fn subscribe(&self) -> Receiver<Arc<EventEnvelope>>

Every event from now on, durable or live. Subscribe before reading what was stored, then skip what the read returned, and nothing is missed or sent twice.

Source

pub async fn jobs(&self, query: JobQuery) -> Result<JobPage, StoreError>

One page of jobs, newest first.

Source

pub async fn job(&self, id: u64) -> Result<Option<Job>, StoreError>

A job with its steps.

Source

pub async fn job_samples( &self, id: u64, interval: Duration, ) -> Result<Option<SampleSeries>, StoreError>

A job’s samples, oldest first; None if there is no such job.

Source

pub async fn log_lines( &self, job: u64, from: u64, limit: u64, ) -> Result<Vec<(u64, String)>, StoreError>

Up to limit log lines of a job from line from, with their numbers.

Source

pub async fn events_after( &self, after: u64, limit: u64, ) -> Result<Vec<EventEnvelope>, StoreError>

Up to limit durable events after after, oldest first.

Source

pub async fn sizing_changes( &self, since: u64, ) -> Result<Vec<SizingChange>, StoreError>

The changes auto sizing wrote since since (ms), oldest first.

Source

pub async fn auto_sizing(&self) -> Result<AutoSizing, StoreError>

When each profile last changed, and the changes still pending.

Source

pub fn announced(&self) -> Result<Announced, StoreError>

The profiles and repositories as the stored events last announced them, so a restarted daemon announces only what changed since, including what its config no longer has. Blocks on the database: for startup.

Source

pub fn paused_repositories(&self) -> Result<Vec<String>, StoreError>

The repositories recorded paused, for the engine to start with. Blocks on the database: for startup.

Source

pub async fn host_samples( &self, since: u64, ) -> Result<Vec<HostSample>, StoreError>

The slice’s samples since since (seconds), oldest first, the ones not yet stored included.

Source

pub async fn activity( &self, since: u64, now: u64, ) -> Result<Activity, StoreError>

The jobs runnerd’s runners started and finished from since until now (seconds).

Source

pub async fn stats( &self, query: StatsQuery, now: u64, ) -> Result<Stats, StoreError>

Finished jobs per repository and bucket.

Source

pub async fn sizing(&self, since: u64) -> Result<History, StoreError>

What sizing reads: the finished jobs queued at or after since (ms) and the runners since.

Source

pub async fn pricing(&self, since: u64) -> Result<PricingHistory, StoreError>

What pricing at GitHub’s rates reads: the completed and lost jobs dated at or after since (ms), each repository’s visibility and since when the history holds every final job.

Source

pub async fn insights(&self, since: u64) -> Result<Vec<Run>, StoreError>

The jobs completed or lost that were queued at or after since (ms), as insights read them.

Source

pub async fn last_event(&self) -> Result<u64, StoreError>

The newest durable event’s ID; 0 before the first.

Source

pub async fn notify_state( &self, ) -> Result<BTreeMap<String, BTreeMap<String, u64>>, StoreError>

What the notifier kept for each target, by target, then key.

Source

pub async fn warm(&self, since: u64) -> Result<Vec<Seen>, StoreError>

The jobs queued at or after since (ms), whatever became of them, as warm runners learn from them.

Source

pub async fn cache_sizes_now(&self) -> Result<Measured, StoreError>

The last measurement of every volume, with its time (seconds), by name.

Source

pub async fn build_cache_since( &self, since: u64, ) -> Result<BuildCacheCounts, StoreError>

What the build cache served and took from the runners started since since (ms), summed.

Source

pub async fn cache_history( &self, since: u64, ) -> Result<Vec<CacheSize>, StoreError>

Every volume measurement since since (seconds).

Source

pub async fn open_jobs(&self) -> Result<Vec<OpenJob>, StoreError>

The jobs not yet closed, for the engine after a restart.

Source

pub async fn runner_job(&self, runner: &str) -> Result<Option<u64>, StoreError>

The job a runner took, if the history knows it.

Source

pub async fn runner_admitted( &self, runner: &str, ) -> Result<Option<Admission>, StoreError>

How a runner was admitted, with what it reserves since, if the history knows it.

Source

pub async fn log_position(&self, job: u64) -> Result<LogPosition, StoreError>

Where a job’s log capture continues.

Source

pub async fn mirror_log_until(&self) -> Result<MirrorPosition, StoreError>

How far the mirror’s log was counted.

Trait Implementations§

Source§

impl Clone for Store

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 Store

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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