Skip to main content

PurgeJob

Type Alias PurgeJob 

Source
pub type PurgeJob = Job<Purge>;
Expand description

One account purge, running or completed.

A Job of kind Purge: the queue’s fields (job_id, state, queue_position, error, the timestamps) plus a purge’s PurgeReport, which dereferences flat — job.stores_purged reads the report and job.state the queue. The account is job.key.

Aliased Type§

pub struct PurgeJob {
    pub job_id: String,
    pub key: String,
    pub state: JobState,
    pub queue_position: u32,
    pub progress: Option<(u64, u64)>,
    pub error: Option<String>,
    pub order: PurgeOrder,
    pub report: PurgeReport,
    pub enqueued_at_unix_ms: i64,
    pub started_at_unix_ms: i64,
    pub finished_at_unix_ms: i64,
}

Fields§

§job_id: String§key: String

The subject, exactly as the queue keys on it — a repository path, an account.

§state: JobState§queue_position: u32

How many jobs are ahead of this one; 0 unless JobState::Queued.

Computed from the waiting list at read time and never stored, because a stored position is wrong the moment the job in front of it starts, and a queue that reported stale positions would be worse than one that reported none.

§progress: Option<(u64, u64)>

How far along, as (done, total) — whatever the kind counts in.

None until the job reports one, and for kinds that never do: a gc and a purge each finish in one indivisible act as far as a caller is concerned, and a fabricated 0/1 would be a progress bar that lies. A mirror cannot do without it — a fetch of a large repository is minutes of network with somebody watching, and a job that sat at Running and then jumped to Done tells that watcher nothing.

§error: Option<String>

Only set when JobState::Failed.

§order: PurgeOrder

What was asked for.

§report: PurgeReport

What the kind produced. Also reachable field-by-field through Deref.

§enqueued_at_unix_ms: i64§started_at_unix_ms: i64

0 until the job leaves JobState::Queued.

§finished_at_unix_ms: i64

0 until the job leaves JobState::Running.