diff --git a/Cargo.lock b/Cargo.lock index 5c65ce2aeaa..80cb83026c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3540,6 +3540,7 @@ version = "0.1.0" dependencies = [ "base64 0.22.1", "chrono", + "daft", "gateway-messages", "omicron-workspace-hack", "progenitor 0.9.1", diff --git a/clients/gateway-client/Cargo.toml b/clients/gateway-client/Cargo.toml index 96f6484122c..56ae822a249 100644 --- a/clients/gateway-client/Cargo.toml +++ b/clients/gateway-client/Cargo.toml @@ -10,6 +10,7 @@ workspace = true [dependencies] base64.workspace = true chrono.workspace = true +daft.workspace = true gateway-messages.workspace = true progenitor.workspace = true rand.workspace = true diff --git a/clients/gateway-client/src/lib.rs b/clients/gateway-client/src/lib.rs index a78204d731b..2f1d48cf4de 100644 --- a/clients/gateway-client/src/lib.rs +++ b/clients/gateway-client/src/lib.rs @@ -69,6 +69,9 @@ progenitor::generate_api!( SpIgnition = { derives = [PartialEq, Eq, PartialOrd, Ord] }, SpIgnitionSystemType = { derives = [Copy, PartialEq, Eq, PartialOrd, Ord] }, SpState = { derives = [PartialEq, Eq, PartialOrd, Ord] }, + SpType = { derives = [daft::Diffable] }, + SpUpdateStatus = { derives = [PartialEq, Hash, Eq] }, + UpdatePreparationProgress = { derives = [PartialEq, Hash, Eq] }, }, ); diff --git a/common/src/update.rs b/common/src/update.rs index deec3016098..8f560d7485d 100644 --- a/common/src/update.rs +++ b/common/src/update.rs @@ -4,6 +4,7 @@ use std::fmt; +use daft::Diffable; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use tufaceous_artifact::{Artifact, ArtifactKind, ArtifactVersion}; @@ -15,6 +16,7 @@ use tufaceous_artifact::{Artifact, ArtifactKind, ArtifactVersion}; // TODO: move this to tufaceous-artifact in the future #[derive( Debug, + Diffable, Clone, PartialEq, Eq, diff --git a/nexus/types/src/inventory.rs b/nexus/types/src/inventory.rs index 95c4f80e05f..7f0bbdf1652 100644 --- a/nexus/types/src/inventory.rs +++ b/nexus/types/src/inventory.rs @@ -14,6 +14,7 @@ use crate::external_api::params::UninitializedSledId; use chrono::DateTime; use chrono::Utc; use clickhouse_admin_types::ClickhouseKeeperClusterMembership; +use daft::Diffable; pub use gateway_client::types::PowerState; pub use gateway_client::types::RotImageError; pub use gateway_client::types::RotSlot; @@ -34,6 +35,7 @@ use omicron_uuid_kinds::CollectionUuid; use omicron_uuid_kinds::DatasetUuid; use omicron_uuid_kinds::SledUuid; use omicron_uuid_kinds::ZpoolUuid; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use std::collections::BTreeMap; @@ -205,7 +207,16 @@ impl Collection { /// the same part number and serial number but a new revision number, we'd want /// to treat that as the same baseboard as one with a different revision number. #[derive( - Clone, Debug, Ord, Eq, PartialOrd, PartialEq, Deserialize, Serialize, + Clone, + Debug, + Diffable, + Ord, + Eq, + PartialOrd, + PartialEq, + Deserialize, + Serialize, + JsonSchema, )] pub struct BaseboardId { /// Oxide Part Number @@ -226,6 +237,17 @@ impl From for BaseboardId { } } +impl slog::KV for BaseboardId { + fn serialize( + &self, + _record: &slog::Record, + serializer: &mut dyn slog::Serializer, + ) -> slog::Result { + serializer.emit_str("part_number".into(), &self.part_number)?; + serializer.emit_str("serial_number".into(), &self.serial_number) + } +} + /// Caboose contents found during a collection /// /// These are normalized in the database. Each distinct `Caboose` is assigned a