Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

461 changes: 87 additions & 374 deletions nexus/db-queries/src/db/datastore/db_metadata.rs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions nexus/db-queries/src/db/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ impl Pool {
})
}

/// Returns a connection from the pool, bypassing the quiesce check
///
/// This is only intended for use *during* quiesce to update our final
/// database record.
pub async fn claim_quiesced(
&self,
) -> Result<qorb::claim::Handle<AsyncConnection>, Error> {
self.inner.claim().await.map_err(|err| {
Error::unavail(&format!("Failed to access DB connection: {err}"))
})
}

/// Disables creation of all new database claims
///
/// This is currently a one-way trip. The pool cannot be un-quiesced.
Expand Down
9 changes: 9 additions & 0 deletions nexus/db-queries/src/db/pub_test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ impl TestDatabase {
}
}

pub async fn extra_datastore(&self, log: &Logger) -> Arc<DataStore> {
let pool = new_pool(log, &self.db);
Arc::new(
DataStore::new(&log, pool, None, IdentityCheckPolicy::DontCare)
.await
.unwrap(),
)
}

pub fn opctx(&self) -> &OpContext {
match &self.kind {
TestKind::NoPool
Expand Down
1 change: 1 addition & 0 deletions nexus/reconfigurator/execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async-bb8-diesel.workspace = true
diesel.workspace = true
httptest.workspace = true
ipnet.workspace = true
ipnetwork.workspace = true
nexus-db-queries = { workspace = true, features = ["testing"] }
nexus-db-schema.workspace = true
nexus-reconfigurator-planning.workspace = true
Expand Down
Loading
Loading