You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue tracks a suggestion during the review of #7046:
If possible it might be nice to have volume_repair_insert_in_txn return its own error enum so that we're not relying on it returning this specific message appearing in this error.
Something like:
diff --git a/nexus/db-queries/src/db/datastore/volume_repair.rs b/nexus/db-queries/src/db/datastore/volume_repair.rs
index 598d9d77a..a910a12ef 100644
--- a/nexus/db-queries/src/db/datastore/volume_repair.rs+++ b/nexus/db-queries/src/db/datastore/volume_repair.rs@@ -20,6 +20,30 @@ use diesel::result::Error as DieselError;
use omicron_common::api::external::Error;
use uuid::Uuid;
+pub enum VolumeRepairInsertError {+ /// Another lock exists for this Volume+ Conflict,++ /// Volume was hard-deleted or never existed+ VolumeNotFound { volume_id },+}++impl VolumeRepairInsertError {+ pub fn into_external_error(self) -> Error {+ match self {+ Self::Conflict => {+ Error::conflict("volume repair lock")+ }++ Self::VolumeNotFound { volume_id } => {+ Error::invalid_request(format!(+ "cannot create record: volume {volume_id} does not exist"+ ))+ }+ }+ }+}+
impl DataStore {
/// Insert a volume repair record, taking a "lock" on the volume pointed to
/// by volume id with some repair id.
with the required propagation of this enum up from functions that call it, so that those callers can decide what to do.
The text was updated successfully, but these errors were encountered:
This issue tracks a suggestion during the review of #7046:
Something like:
with the required propagation of this enum up from functions that call it, so that those callers can decide what to do.
The text was updated successfully, but these errors were encountered: