Skip to main content

headgate_proto/
headgate.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Envelope {
4    /// ULID: lexicographically sortable, no coordination
5    #[prost(string, tag = "1")]
6    pub id: ::prost::alloc::string::String,
7    /// task type name; the dispatch key
8    #[prost(string, tag = "2")]
9    pub kind: ::prost::alloc::string::String,
10    /// payload versioning payload versioning — free now, impossible later
11    #[prost(uint32, tag = "3")]
12    pub schema_version: u32,
13    /// opaque to headgate; codec is the caller's choice
14    #[prost(bytes = "vec", tag = "4")]
15    pub payload: ::prost::alloc::vec::Vec<u8>,
16    #[prost(string, tag = "5")]
17    pub queue: ::prost::alloc::string::String,
18    /// tenant fairness fair queuing (tenant/customer). "" = default partition
19    #[prost(string, tag = "6")]
20    pub partition_key: ::prost::alloc::string::String,
21    /// admission policy fleet-wide limiter bucket. "" = unlimited
22    #[prost(string, tag = "7")]
23    pub rate_class: ::prost::alloc::string::String,
24    /// crash quarantine quarantine key: hash(kind, payload)
25    #[prost(string, tag = "8")]
26    pub fingerprint: ::prost::alloc::string::String,
27    /// failures the handler RETURNED
28    #[prost(uint32, tag = "9")]
29    pub attempt: u32,
30    /// crash quarantine failures where the worker DIED. counted separately.
31    #[prost(uint32, tag = "10")]
32    pub crash_attempt: u32,
33    #[prost(uint32, tag = "11")]
34    pub max_attempts: u32,
35    /// higher runs first within a queue
36    #[prost(int32, tag = "12")]
37    pub priority: i32,
38    /// wire-time contract every duration and instant is milliseconds
39    #[prost(int64, tag = "13")]
40    pub enqueued_at_ms: i64,
41    #[prost(int64, tag = "14")]
42    pub scheduled_at_ms: i64,
43    /// per attempt
44    #[prost(int64, tag = "15")]
45    pub timeout_ms: i64,
46    /// absolute, across all attempts. 0 = none
47    #[prost(int64, tag = "16")]
48    pub deadline_ms: i64,
49    #[prost(int64, tag = "17")]
50    pub retention_ms: i64,
51    /// job uniqueness null = not unique
52    #[prost(bytes = "vec", tag = "18")]
53    pub unique_key: ::prost::alloc::vec::Vec<u8>,
54    /// bitmask of States uniqueness applies in
55    #[prost(uint32, tag = "19")]
56    pub unique_states: u32,
57    #[prost(map = "string, string", tag = "20")]
58    pub headers: ::std::collections::HashMap<
59        ::prost::alloc::string::String,
60        ::prost::alloc::string::String,
61    >,
62    #[prost(message, repeated, tag = "21")]
63    pub errors: ::prost::alloc::vec::Vec<AttemptError>,
64    /// job uniqueness uniqueness mode. 0 = LIFECYCLE (one live job per key, released by terminal
65    /// state). > 0 = THROTTLE (at most one per this many ms, released by the clock).
66    #[prost(int64, tag = "22")]
67    pub unique_window_ms: i64,
68    /// step replay step replay
69    #[prost(message, optional, tag = "23")]
70    pub checkpoint: ::core::option::Option<Checkpoint>,
71    /// surveyed policy behavior estimated rate-budget cost. This is NOT queue-selection weight. Proto3's
72    /// omitted zero is normalized to the default 1 by every store; an ack may report an
73    /// actual value (including zero) and atomically reconcile the estimate.
74    #[prost(uint32, tag = "24")]
75    pub weight: u32,
76    /// Typed durable periodic origin. Empty/zero means an ordinary enqueue; both fields
77    /// are set together so clients never parse ids or opaque headers.
78    #[prost(string, tag = "25")]
79    pub periodic_schedule_id: ::prost::alloc::string::String,
80    #[prost(int64, tag = "26")]
81    pub periodic_tick_ms: i64,
82    /// Request-only bitmask for atomic replacement on a unique-key conflict. Allowed
83    /// fields are defined by the language SDK constants; unknown bits are rejected.
84    #[prost(uint32, tag = "27")]
85    pub unique_replace: u32,
86    /// Trailing-edge debounce. Requires unique_key and a positive millisecond window.
87    /// The store schedules the holder at store-now + this window on both the first insert
88    /// and every conflict; it never trusts a producer clock.
89    #[prost(int64, tag = "28")]
90    pub unique_debounce_ms: i64,
91    /// River-compatible uniqueness scope. false includes kind in the effective key;
92    /// true deliberately coalesces equal keys across task kinds.
93    #[prost(bool, tag = "29")]
94    pub unique_exclude_kind: bool,
95    /// Operator-indexed labels. Canonicalized by SDKs; never smuggled through headers.
96    #[prost(string, repeated, tag = "30")]
97    pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
98    /// Insert durably without becoming admission-eligible until explicitly promoted.
99    #[prost(bool, tag = "31")]
100    pub pending: bool,
101    /// Exact stable worker identity allowed to claim this job. Empty means any worker.
102    /// Enforced atomically by the store and retained across retry/reclaim transitions.
103    #[prost(string, tag = "32")]
104    pub sticky_worker: ::prost::alloc::string::String,
105}
106/// step replay Step replay. River persists this only after the worker returns, which loses it in
107/// exactly the mid-step crash the feature exists for; Sidekiq autosaves every 5s. Here the
108/// checkpoint rides the lease renewal that is already happening, so step boundaries are
109/// exact and cursor updates are bounded by the renewal interval.
110#[derive(Clone, PartialEq, ::prost::Message)]
111pub struct Checkpoint {
112    #[prost(string, tag = "1")]
113    pub last_completed_step: ::prost::alloc::string::String,
114    /// the step a cursor belongs to, if any
115    #[prost(string, tag = "2")]
116    pub cursor_step: ::prost::alloc::string::String,
117    /// opaque, caller-serialized
118    #[prost(bytes = "vec", tag = "3")]
119    pub cursor: ::prost::alloc::vec::Vec<u8>,
120    #[prost(int64, tag = "4")]
121    pub updated_at_ms: i64,
122    /// payload versioning × step replay: what the step set looked like when this was written. A resumed job whose
123    /// step set no longer matches goes to UNDECODABLE rather than silently restarting from
124    /// step one and re-running completed side effects. No other queue has to answer this,
125    /// because no other queue has both step replay and payload versioning.
126    #[prost(uint32, tag = "5")]
127    pub schema_version: u32,
128    #[prost(string, tag = "6")]
129    pub step_set_hash: ::prost::alloc::string::String,
130    /// crash quarantine step-level crash attribution
131    #[prost(map = "string, uint32", tag = "7")]
132    pub crashes_by_step: ::std::collections::HashMap<
133        ::prost::alloc::string::String,
134        u32,
135    >,
136}
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct AttemptError {
139    #[prost(uint32, tag = "1")]
140    pub attempt: u32,
141    #[prost(int64, tag = "2")]
142    pub at_ms: i64,
143    #[prost(string, tag = "3")]
144    pub message: ::prost::alloc::string::String,
145    #[prost(enumeration = "Outcome", tag = "4")]
146    pub outcome: i32,
147    #[prost(bool, tag = "5")]
148    pub was_panic: bool,
149    #[prost(string, tag = "6")]
150    pub worker: ::prost::alloc::string::String,
151    /// step replay which step failed, when the job has steps
152    #[prost(string, tag = "7")]
153    pub step: ::prost::alloc::string::String,
154}
155#[derive(Clone, PartialEq, ::prost::Message)]
156pub struct Claim {
157    #[prost(message, optional, tag = "1")]
158    pub envelope: ::core::option::Option<Envelope>,
159    /// lease fencing created atomically with the claim, never separately
160    #[prost(string, tag = "2")]
161    pub lease_id: ::prost::alloc::string::String,
162    #[prost(int64, tag = "3")]
163    pub lease_expires_at_ms: i64,
164    /// monotonic per job; rejects writes from a superseded holder
165    #[prost(uint64, tag = "4")]
166    pub fence: u64,
167}
168#[derive(Clone, PartialEq, ::prost::Message)]
169pub struct WorkerInfo {
170    #[prost(string, tag = "1")]
171    pub worker_id: ::prost::alloc::string::String,
172    #[prost(string, tag = "2")]
173    pub host: ::prost::alloc::string::String,
174    #[prost(int32, tag = "3")]
175    pub pid: i32,
176    #[prost(string, tag = "4")]
177    pub version: ::prost::alloc::string::String,
178    #[prost(string, repeated, tag = "5")]
179    pub queues: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
180    #[prost(uint32, tag = "6")]
181    pub concurrency: u32,
182    #[prost(int64, tag = "7")]
183    pub started_at_ms: i64,
184    #[prost(int64, tag = "8")]
185    pub heartbeat_at_ms: i64,
186    #[prost(uint32, tag = "9")]
187    pub inflight: u32,
188    #[prost(string, tag = "10")]
189    pub status: ::prost::alloc::string::String,
190    #[prost(bool, tag = "11")]
191    pub duties_active: bool,
192    #[prost(string, tag = "12")]
193    pub pending_command: ::prost::alloc::string::String,
194}
195/// admission policy Admission policy, evaluated store-side inside the claim.
196#[derive(Clone, PartialEq, ::prost::Message)]
197pub struct RateClass {
198    #[prost(string, tag = "1")]
199    pub name: ::prost::alloc::string::String,
200    /// tokens per window
201    #[prost(uint64, tag = "2")]
202    pub limit: u64,
203    #[prost(int64, tag = "3")]
204    pub window_ms: i64,
205    #[prost(uint64, tag = "4")]
206    pub burst: u64,
207}
208#[derive(Clone, PartialEq, ::prost::Message)]
209pub struct ConcurrencyLimit {
210    #[prost(string, tag = "1")]
211    pub name: ::prost::alloc::string::String,
212    /// "" = global, else an envelope field name
213    #[prost(string, tag = "2")]
214    pub partition_by: ::prost::alloc::string::String,
215    #[prost(uint64, tag = "3")]
216    pub max_concurrent: u64,
217    #[prost(string, tag = "4")]
218    pub queue: ::prost::alloc::string::String,
219    /// queue|discard|cancel_running|cancel_incoming
220    #[prost(string, tag = "5")]
221    pub on_saturated: ::prost::alloc::string::String,
222}
223/// backlog metrics Backlog derivatives — a read, not a Prometheus recording rule.
224#[derive(Clone, PartialEq, ::prost::Message)]
225pub struct QueueStats {
226    #[prost(string, tag = "1")]
227    pub queue: ::prost::alloc::string::String,
228    #[prost(map = "string, uint64", tag = "2")]
229    pub by_state: ::std::collections::HashMap<::prost::alloc::string::String, u64>,
230    /// jobs/sec, 1m window
231    #[prost(double, tag = "3")]
232    pub arrival_rate: f64,
233    /// jobs/sec, 1m window
234    #[prost(double, tag = "4")]
235    pub drain_rate: f64,
236    /// -1 when arrival >= drain: the alert condition
237    #[prost(int64, tag = "5")]
238    pub time_to_drain_ms: i64,
239    #[prost(bool, tag = "6")]
240    pub paused: bool,
241    /// bounded live-control contract true when a bound was hit
242    #[prost(bool, tag = "7")]
243    pub count_is_approximate: bool,
244    /// -1 when no job is currently available
245    #[prost(int64, tag = "8")]
246    pub oldest_available_ms: i64,
247    #[prost(message, optional, tag = "9")]
248    pub quiet_groups: ::core::option::Option<QuietGroupMetrics>,
249    /// queue-selection weight; unrelated to Envelope.weight
250    #[prost(uint32, tag = "10")]
251    pub weight: u32,
252    /// exact producer-depth counter, never approximate
253    #[prost(uint64, tag = "11")]
254    pub unfinished_jobs: u64,
255    /// absent = enqueue backpressure disabled
256    #[prost(uint64, optional, tag = "12")]
257    pub max_unfinished_jobs: ::core::option::Option<u64>,
258}
259#[derive(Clone, Copy, PartialEq, ::prost::Message)]
260pub struct QuietGroupMetrics {
261    #[prost(double, tag = "1")]
262    pub arrival_rate: f64,
263    #[prost(double, tag = "2")]
264    pub drain_rate: f64,
265    /// -1 when arrival >= drain
266    #[prost(int64, tag = "3")]
267    pub time_to_drain_ms: i64,
268    /// -1 when no quiet job is available
269    #[prost(int64, tag = "4")]
270    pub oldest_available_ms: i64,
271    #[prost(uint32, tag = "5")]
272    pub noisy_partitions: u32,
273    #[prost(bool, tag = "6")]
274    pub approximate: bool,
275}
276/// lifecycle state machine The state machine is a declared table, not a match with holes.
277#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
278#[repr(i32)]
279pub enum State {
280    Unspecified = 0,
281    /// scheduled_at in the future
282    Scheduled = 1,
283    /// ready to be admitted
284    Available = 2,
285    /// claimed, lease held
286    Running = 3,
287    /// failed, will return to AVAILABLE
288    Retryable = 4,
289    /// terminal, retained per policy
290    Completed = 5,
291    /// terminal, inspectable, re-runnable (the DLQ)
292    Archived = 6,
293    /// terminal, operator action
294    Cancelled = 7,
295    /// crash quarantine terminal, fingerprint blocked
296    Quarantined = 8,
297    /// payload versioning terminal, no upcast path for this schema_version
298    Undecodable = 9,
299    /// durable but ineligible until explicit promotion
300    Pending = 10,
301}
302impl State {
303    /// String value of the enum field names used in the ProtoBuf definition.
304    ///
305    /// The values are not transformed in any way and thus are considered stable
306    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
307    pub fn as_str_name(&self) -> &'static str {
308        match self {
309            Self::Unspecified => "STATE_UNSPECIFIED",
310            Self::Scheduled => "STATE_SCHEDULED",
311            Self::Available => "STATE_AVAILABLE",
312            Self::Running => "STATE_RUNNING",
313            Self::Retryable => "STATE_RETRYABLE",
314            Self::Completed => "STATE_COMPLETED",
315            Self::Archived => "STATE_ARCHIVED",
316            Self::Cancelled => "STATE_CANCELLED",
317            Self::Quarantined => "STATE_QUARANTINED",
318            Self::Undecodable => "STATE_UNDECODABLE",
319            Self::Pending => "STATE_PENDING",
320        }
321    }
322    /// Creates an enum from field names used in the ProtoBuf definition.
323    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
324        match value {
325            "STATE_UNSPECIFIED" => Some(Self::Unspecified),
326            "STATE_SCHEDULED" => Some(Self::Scheduled),
327            "STATE_AVAILABLE" => Some(Self::Available),
328            "STATE_RUNNING" => Some(Self::Running),
329            "STATE_RETRYABLE" => Some(Self::Retryable),
330            "STATE_COMPLETED" => Some(Self::Completed),
331            "STATE_ARCHIVED" => Some(Self::Archived),
332            "STATE_CANCELLED" => Some(Self::Cancelled),
333            "STATE_QUARANTINED" => Some(Self::Quarantined),
334            "STATE_UNDECODABLE" => Some(Self::Undecodable),
335            "STATE_PENDING" => Some(Self::Pending),
336            _ => None,
337        }
338    }
339}
340#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
341#[repr(i32)]
342pub enum Outcome {
343    Unspecified = 0,
344    Success = 1,
345    /// handler returned an error
346    Retry = 2,
347    /// handler said: stop retrying, archive
348    Skip = 3,
349    /// handler said: drop entirely
350    Revoke = 4,
351    /// reschedule without consuming an attempt
352    Snooze = 5,
353    /// crash quarantine crash-attributed: worker died, never acked
354    LeaseLost = 6,
355    /// payload versioning payload could not be decoded
356    Undecodable = 7,
357    /// surveyed policy behavior NOT a failure: re-queue without consuming an attempt
358    RateLimited = 8,
359}
360impl Outcome {
361    /// String value of the enum field names used in the ProtoBuf definition.
362    ///
363    /// The values are not transformed in any way and thus are considered stable
364    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
365    pub fn as_str_name(&self) -> &'static str {
366        match self {
367            Self::Unspecified => "OUTCOME_UNSPECIFIED",
368            Self::Success => "OUTCOME_SUCCESS",
369            Self::Retry => "OUTCOME_RETRY",
370            Self::Skip => "OUTCOME_SKIP",
371            Self::Revoke => "OUTCOME_REVOKE",
372            Self::Snooze => "OUTCOME_SNOOZE",
373            Self::LeaseLost => "OUTCOME_LEASE_LOST",
374            Self::Undecodable => "OUTCOME_UNDECODABLE",
375            Self::RateLimited => "OUTCOME_RATE_LIMITED",
376        }
377    }
378    /// Creates an enum from field names used in the ProtoBuf definition.
379    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
380        match value {
381            "OUTCOME_UNSPECIFIED" => Some(Self::Unspecified),
382            "OUTCOME_SUCCESS" => Some(Self::Success),
383            "OUTCOME_RETRY" => Some(Self::Retry),
384            "OUTCOME_SKIP" => Some(Self::Skip),
385            "OUTCOME_REVOKE" => Some(Self::Revoke),
386            "OUTCOME_SNOOZE" => Some(Self::Snooze),
387            "OUTCOME_LEASE_LOST" => Some(Self::LeaseLost),
388            "OUTCOME_UNDECODABLE" => Some(Self::Undecodable),
389            "OUTCOME_RATE_LIMITED" => Some(Self::RateLimited),
390            _ => None,
391        }
392    }
393}