Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion nexus/src/app/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::db;
use crate::db::identity::Resource;
use crate::db::lookup::LookupPath;
use crate::db::model::Name;
use crate::db::subnet_allocation::NetworkInterfaceError;
use crate::db::queries::network_interface::NetworkInterfaceError;
use crate::external_api::params;
use omicron_common::api::external;
use omicron_common::api::external::CreateResult;
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/app/sagas/instance_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::app::{MAX_DISKS_PER_INSTANCE, MAX_NICS_PER_INSTANCE};
use crate::context::OpContext;
use crate::db::identity::Resource;
use crate::db::lookup::LookupPath;
use crate::db::queries::network_interface::NetworkInterfaceError;
use crate::external_api::params;
use crate::saga_interface::SagaContext;
use crate::{authn, authz, db};
Expand Down Expand Up @@ -331,7 +332,6 @@ async fn sic_create_custom_network_interfaces(
)
.await;

use crate::db::subnet_allocation::NetworkInterfaceError;
match result {
Ok(_) => Ok(()),

Expand Down Expand Up @@ -432,7 +432,7 @@ async fn sic_create_default_network_interface(
interface,
)
.await
.map_err(db::subnet_allocation::NetworkInterfaceError::into_external)
.map_err(NetworkInterfaceError::into_external)
.map_err(ActionError::action_failed)?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/vpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::db;
use crate::db::lookup::LookupPath;
use crate::db::model::Name;
use crate::db::model::VpcRouterKind;
use crate::db::subnet_allocation::SubnetError;
use crate::db::queries::vpc_subnet::SubnetError;
use crate::defaults;
use crate::external_api::params;
use omicron_common::api::external;
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/vpc_subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::db::identity::Resource;
use crate::db::lookup::LookupPath;
use crate::db::model::Name;
use crate::db::model::VpcSubnet;
use crate::db::subnet_allocation::SubnetError;
use crate::db::queries::vpc_subnet::SubnetError;
use crate::defaults;
use crate::external_api::params;
use omicron_common::api::external;
Expand Down
8 changes: 4 additions & 4 deletions nexus/src/db/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ use crate::db::fixed_data::role_builtin::BUILTIN_ROLES;
use crate::db::fixed_data::silo::{DEFAULT_SILO, SILO_ID};
use crate::db::lookup::LookupPath;
use crate::db::model::DatabaseString;
use crate::db::queries::network_interface::InsertNetworkInterfaceQuery;
use crate::db::queries::network_interface::NetworkInterfaceError;
use crate::db::queries::vpc_subnet::FilterConflictingVpcSubnetRangesQuery;
use crate::db::queries::vpc_subnet::SubnetError;
use crate::db::{
self,
error::{public_error_from_diesel_pool, ErrorHandler, TransactionError},
Expand All @@ -49,10 +53,6 @@ use crate::db::{
},
pagination::paginated,
pagination::paginated_multicolumn,
subnet_allocation::FilterConflictingVpcSubnetRangesQuery,
subnet_allocation::InsertNetworkInterfaceQuery,
subnet_allocation::NetworkInterfaceError,
subnet_allocation::SubnetError,
update_and_check::{UpdateAndCheck, UpdateStatus},
};
use crate::external_api::{params, shared};
Expand Down
4 changes: 3 additions & 1 deletion nexus/src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ pub mod ipv6;
pub mod lookup;
mod pagination;
mod pool;
// This is marked public because the error types are used elsewhere, e.g., in
// sagas.
pub(crate) mod queries;
mod saga_recovery;
mod saga_types;
mod sec_store;
pub(crate) mod subnet_allocation;
mod update_and_check;

#[cfg(test)]
Expand Down
12 changes: 12 additions & 0 deletions nexus/src/db/queries/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Specialized queries for inserting database records, usually to maintain
//! complex invariants that are most accurately expressed in a single query.

#[macro_use]
mod next_item;
pub mod network_interface;
pub mod vni;
pub mod vpc_subnet;
Loading