pub struct Store { /* private fields */ }Expand description
The job history. Cloning shares it.
Implementations§
Source§impl Store
impl Store
Sourcepub fn open(path: &Path) -> Result<Store, StoreError>
pub fn open(path: &Path) -> Result<Store, StoreError>
Opens the database at path, creating it and its directory (mode 0700) if missing, with the schema when it
is new. Refuses a database at another version.
Sourcepub fn queued(&self, repository: &str, job: &QueuedJob)
pub fn queued(&self, repository: &str, job: &QueuedJob)
Records a queued job the repository’s runners may run; announces it the first time.
Sourcepub fn runner_started(&self, runner: RunnerRecord)
pub fn runner_started(&self, runner: RunnerRecord)
Records a runner container that started, or one an earlier daemon started and this one adopted.
Sourcepub fn runner_removed(&self, runner: &str, at: u64)
pub fn runner_removed(&self, runner: &str, at: u64)
Records that a runner’s container and registration were removed at at (ms).
Sourcepub fn runners_gone(&self, running: Vec<String>, at: u64)
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.
Sourcepub fn claimed(&self, job: u64, run_id: u64, runner: &str, at: u64)
pub fn claimed(&self, job: u64, run_id: u64, runner: &str, at: u64)
Records that a runner took a job at at (ms).
Sourcepub fn details(&self, details: JobDetails)
pub fn details(&self, details: JobDetails)
Records a running job’s progress and steps as GitHub reports them; announces changed steps.
Sourcepub fn elsewhere(&self, details: JobDetails)
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.
Sourcepub fn lost(&self, job: u64, at: u64)
pub fn lost(&self, job: u64, at: u64)
Closes a job whose container is gone and that GitHub did not report completed in time.
Sourcepub async fn log(
&self,
job: u64,
lines: Vec<String>,
position: LogPosition,
max_bytes: u64,
)
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.
Sourcepub fn samples(&self, samples: Vec<SampleRecord>)
pub fn samples(&self, samples: Vec<SampleRecord>)
Records samples of runner containers.
Sourcepub fn host_sample(&self, sample: HostSample)
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.
Sourcepub fn latest_sample(&self, runner: &str) -> Option<SampleRecord>
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.
Sourcepub fn runner_admission(&self, runner: &str, admission: Admission)
pub fn runner_admission(&self, runner: &str, admission: Admission)
Records what a runner reserves now, when measured admission changed it after the start.
Sourcepub fn runner_oom_killed(&self, runner: &str)
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.
Sourcepub fn build_cache(&self, runner: &str, counts: BuildCacheCounts)
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.
Sourcepub fn host_memory(&self, memory: HostMemory)
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.
Sourcepub fn latest_host_memory(&self) -> Option<HostMemory>
pub fn latest_host_memory(&self) -> Option<HostMemory>
The latest reading of the host’s memory; None before the first.
Sourcepub fn host_waited(&self, jobs: Vec<u64>, ms: u64)
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.
Sourcepub fn latest_host_sample(&self) -> Option<HostSample>
pub fn latest_host_sample(&self) -> Option<HostSample>
The last host sample sent, stored or not; None before the first.
Sourcepub async fn mirror_bytes(
&self,
bytes: Vec<(String, u64)>,
until: MirrorPosition,
) -> bool
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.
Sourcepub fn cache_sizes(&self, at: u64, sizes: BTreeMap<String, u64>)
pub fn cache_sizes(&self, at: u64, sizes: BTreeMap<String, u64>)
Records volume sizes in bytes, by name, measured at at (ms).
Sourcepub fn event(&self, event: Event)
pub fn event(&self, event: Event)
Stores a durable event, or sends a live one, to every subscriber.
Sourcepub fn record_made(&self, record: Record)
pub fn record_made(&self, record: Record)
Records that a failed job’s runner was kept as record, and announces it.
Sourcepub fn record_skipped(&self, job: u64, why: String)
pub fn record_skipped(&self, job: u64, why: String)
Records why a failed job’s runner was not kept.
Sourcepub fn record_removed(&self, job: u64, at: u64, by: RecordRemoval)
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.
Sourcepub fn paused(
&self,
repositories: Vec<String>,
) -> impl Future<Output = bool> + use<>
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.
Sourcepub fn visibility(&self, repository: String, visibility: Visibility, at: u64)
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.
Sourcepub fn sizing_intent(
&self,
change: SizingChange,
) -> impl Future<Output = Option<i64>> + use<>
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.
Sourcepub fn sizing_resolved(
&self,
id: i64,
resolution: Resolution,
) -> impl Future<Output = bool> + use<>
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.
Sourcepub fn notify_record(
&self,
target: &str,
set: Vec<(String, u64)>,
remove: Vec<String>,
) -> impl Future<Output = bool> + use<>
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.
Sourcepub fn notify_keep(
&self,
targets: Vec<String>,
) -> impl Future<Output = bool> + use<>
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.
Sourcepub fn prune(&self, now: u64, history: &History) -> JoinHandle<()> ⓘ
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.
Sourcepub fn close(&self)
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.
Sourcepub fn subscribe(&self) -> Receiver<Arc<EventEnvelope>>
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.
Sourcepub async fn jobs(&self, query: JobQuery) -> Result<JobPage, StoreError>
pub async fn jobs(&self, query: JobQuery) -> Result<JobPage, StoreError>
One page of jobs, newest first.
Sourcepub async fn job_samples(
&self,
id: u64,
interval: Duration,
) -> Result<Option<SampleSeries>, StoreError>
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.
Sourcepub async fn log_lines(
&self,
job: u64,
from: u64,
limit: u64,
) -> Result<Vec<(u64, String)>, StoreError>
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.
Sourcepub async fn events_after(
&self,
after: u64,
limit: u64,
) -> Result<Vec<EventEnvelope>, StoreError>
pub async fn events_after( &self, after: u64, limit: u64, ) -> Result<Vec<EventEnvelope>, StoreError>
Up to limit durable events after after, oldest first.
Sourcepub async fn sizing_changes(
&self,
since: u64,
) -> Result<Vec<SizingChange>, StoreError>
pub async fn sizing_changes( &self, since: u64, ) -> Result<Vec<SizingChange>, StoreError>
The changes auto sizing wrote since since (ms), oldest first.
Sourcepub async fn auto_sizing(&self) -> Result<AutoSizing, StoreError>
pub async fn auto_sizing(&self) -> Result<AutoSizing, StoreError>
When each profile last changed, and the changes still pending.
Sourcepub fn announced(&self) -> Result<Announced, StoreError>
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.
Sourcepub fn paused_repositories(&self) -> Result<Vec<String>, StoreError>
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.
Sourcepub async fn host_samples(
&self,
since: u64,
) -> Result<Vec<HostSample>, StoreError>
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.
Sourcepub async fn activity(
&self,
since: u64,
now: u64,
) -> Result<Activity, StoreError>
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).
Sourcepub async fn stats(
&self,
query: StatsQuery,
now: u64,
) -> Result<Stats, StoreError>
pub async fn stats( &self, query: StatsQuery, now: u64, ) -> Result<Stats, StoreError>
Finished jobs per repository and bucket.
Sourcepub async fn sizing(&self, since: u64) -> Result<History, StoreError>
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.
Sourcepub async fn pricing(&self, since: u64) -> Result<PricingHistory, StoreError>
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.
Sourcepub async fn insights(&self, since: u64) -> Result<Vec<Run>, StoreError>
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.
Sourcepub async fn last_event(&self) -> Result<u64, StoreError>
pub async fn last_event(&self) -> Result<u64, StoreError>
The newest durable event’s ID; 0 before the first.
Sourcepub async fn notify_state(
&self,
) -> Result<BTreeMap<String, BTreeMap<String, u64>>, StoreError>
pub async fn notify_state( &self, ) -> Result<BTreeMap<String, BTreeMap<String, u64>>, StoreError>
What the notifier kept for each target, by target, then key.
Sourcepub async fn warm(&self, since: u64) -> Result<Vec<Seen>, StoreError>
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.
Sourcepub async fn cache_sizes_now(&self) -> Result<Measured, StoreError>
pub async fn cache_sizes_now(&self) -> Result<Measured, StoreError>
The last measurement of every volume, with its time (seconds), by name.
Sourcepub async fn build_cache_since(
&self,
since: u64,
) -> Result<BuildCacheCounts, StoreError>
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.
Sourcepub async fn cache_history(
&self,
since: u64,
) -> Result<Vec<CacheSize>, StoreError>
pub async fn cache_history( &self, since: u64, ) -> Result<Vec<CacheSize>, StoreError>
Every volume measurement since since (seconds).
Sourcepub async fn open_jobs(&self) -> Result<Vec<OpenJob>, StoreError>
pub async fn open_jobs(&self) -> Result<Vec<OpenJob>, StoreError>
The jobs not yet closed, for the engine after a restart.
Sourcepub async fn runner_job(&self, runner: &str) -> Result<Option<u64>, StoreError>
pub async fn runner_job(&self, runner: &str) -> Result<Option<u64>, StoreError>
The job a runner took, if the history knows it.
Sourcepub async fn runner_admitted(
&self,
runner: &str,
) -> Result<Option<Admission>, StoreError>
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.
Sourcepub async fn log_position(&self, job: u64) -> Result<LogPosition, StoreError>
pub async fn log_position(&self, job: u64) -> Result<LogPosition, StoreError>
Where a job’s log capture continues.
Sourcepub async fn mirror_log_until(&self) -> Result<MirrorPosition, StoreError>
pub async fn mirror_log_until(&self) -> Result<MirrorPosition, StoreError>
How far the mirror’s log was counted.