Skip to content

Commit

Permalink
remove upsert_service
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Feb 8, 2024
1 parent 7c6d77f commit fce2953
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions nexus/src/app/sled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ use std::net::SocketAddrV6;
use std::sync::Arc;
use uuid::Uuid;

#[cfg(test)]
use nexus_db_queries::db::model::ServiceKind;

impl super::Nexus {
// Sleds
pub fn sled_lookup<'a>(
Expand Down Expand Up @@ -276,41 +273,6 @@ impl super::Nexus {
Ok(())
}

// Services

/// Upserts a Service into the database, updating it if it already exists.
#[cfg(test)]
pub(crate) async fn upsert_service(
&self,
opctx: &OpContext,
id: Uuid,
sled_id: Uuid,
zone_id: Option<Uuid>,
address: SocketAddrV6,
kind: ServiceKind,
) -> Result<(), Error> {
info!(
self.log,
"upserting service";
"sled_id" => sled_id.to_string(),
"service_id" => id.to_string(),
"address" => address.to_string(),
);
let service =
db::model::Service::new(id, sled_id, zone_id, address, kind);
self.db_datastore.service_upsert(opctx, service).await?;

if kind == ServiceKind::ExternalDns {
self.background_tasks
.activate(&self.background_tasks.task_external_dns_servers);
} else if kind == ServiceKind::InternalDns {
self.background_tasks
.activate(&self.background_tasks.task_internal_dns_servers);
}

Ok(())
}

/// Ensure firewall rules for internal services get reflected on all the relevant sleds.
pub(crate) async fn plumb_service_firewall_rules(
&self,
Expand Down

0 comments on commit fce2953

Please sign in to comment.