wire types: WireTime newtype for timestamps instead of adaptor-annotated i64
This commit is contained in:
parent
cf1f7288bf
commit
1e205289c5
12 changed files with 148 additions and 162 deletions
|
|
@ -1,5 +1,6 @@
|
|||
//! Wire types shared between `hive-c0re` and the in-container harness.
|
||||
|
||||
use crate::wire_time::WireTime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod assets;
|
||||
|
|
@ -209,15 +210,10 @@ pub struct Approval {
|
|||
/// hive-c0re refreshes this + re-renders the card for re-review.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub fetched_sha: Option<String>,
|
||||
#[serde(with = "crate::wire_time::iso")]
|
||||
pub requested_at: i64,
|
||||
pub requested_at: WireTime,
|
||||
pub status: ApprovalStatus,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "crate::wire_time::iso_opt"
|
||||
)]
|
||||
pub resolved_at: Option<i64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub resolved_at: Option<WireTime>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub note: Option<String>,
|
||||
/// Free-text description the manager attached at submission time;
|
||||
|
|
@ -453,8 +449,7 @@ pub enum LooseEnd {
|
|||
id: i64,
|
||||
owner: String,
|
||||
message: String,
|
||||
#[serde(with = "crate::wire_time::iso")]
|
||||
due_at: i64,
|
||||
due_at: WireTime,
|
||||
age_seconds: u64,
|
||||
},
|
||||
/// Undelivered inbox messages waiting to be `recv`'d by this agent.
|
||||
|
|
@ -1419,27 +1414,17 @@ pub struct WireSchedule {
|
|||
pub body: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub interval_seconds: Option<u64>,
|
||||
#[serde(with = "crate::wire_time::iso")]
|
||||
pub next_fire_at_unix: i64,
|
||||
#[serde(with = "crate::wire_time::iso")]
|
||||
pub created_at_unix: i64,
|
||||
pub next_fire_at_unix: WireTime,
|
||||
pub created_at_unix: WireTime,
|
||||
pub source: WireScheduleSource,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "crate::wire_time::iso_opt"
|
||||
)]
|
||||
pub cancelled_at_unix: Option<i64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub cancelled_at_unix: Option<WireTime>,
|
||||
/// Set while the schedule is paused. Worker skips paused rows;
|
||||
/// they keep their `next_fire_at_unix` so resuming at any time
|
||||
/// fires at the next intended instant (no catch-up clamp needed
|
||||
/// — a paused schedule simply slips its next fire).
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "crate::wire_time::iso_opt"
|
||||
)]
|
||||
pub paused_at_unix: Option<i64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub paused_at_unix: Option<WireTime>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
pub targets: Vec<WireScheduleTarget>,
|
||||
|
|
@ -1455,18 +1440,10 @@ pub enum WireScheduleSource {
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WireScheduleTarget {
|
||||
pub target: String,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "crate::wire_time::iso_opt"
|
||||
)]
|
||||
pub cancelled_at_unix: Option<i64>,
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "crate::wire_time::iso_opt"
|
||||
)]
|
||||
pub last_fired_at_unix: Option<i64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub cancelled_at_unix: Option<WireTime>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub last_fired_at_unix: Option<WireTime>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub last_result: Option<String>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue