Skip to content

Commit

Permalink
rename func
Browse files Browse the repository at this point in the history
  • Loading branch information
leon3s committed Jan 9, 2024
1 parent 7fd9daa commit 1fa270f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bin/nanocld/src/objects/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl ObjPutByPk for CargoDb {
Ok(instances) => instances,
};
// start created containers
match CargoDb::start_process_by_kind_pk(pk, state).await {
match CargoDb::start_process_by_kind_key(pk, state).await {
Err(err) => {
log::error!(
"Unable to start cargo instance {} : {err}",
Expand Down
8 changes: 4 additions & 4 deletions bin/nanocld/src/objects/generic/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub trait ObjProcess {
Process::try_from(process).map_err(HttpError::from)
}

async fn start_process_by_kind_pk(
async fn start_process_by_kind_key(
kind_pk: &str,
state: &SystemState,
) -> HttpResult<()> {
Expand All @@ -130,7 +130,7 @@ pub trait ObjProcess {
Ok(())
}

async fn stop_process_by_kind_pk(
async fn stop_process_by_kind_key(
kind_pk: &str,
state: &SystemState,
) -> HttpResult<()> {
Expand All @@ -153,7 +153,7 @@ pub trait ObjProcess {
Ok(())
}

async fn restart_process_by_kind_pk(
async fn restart_process_by_kind_key(
pk: &str,
state: &SystemState,
) -> HttpResult<()> {
Expand All @@ -176,7 +176,7 @@ pub trait ObjProcess {
Ok(())
}

async fn kill_process_by_kind_pk(
async fn kill_process_by_kind_key(
pk: &str,
opts: &CargoKillOptions,
state: &SystemState,
Expand Down
4 changes: 2 additions & 2 deletions bin/nanocld/src/objects/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl ObjPutByPk for VmDb {
) -> HttpResult<Self::ObjPutOut> {
let vm = VmDb::transform_read_by_pk(pk, &state.pool).await?;
let container_name = format!("{}.v", &vm.spec.vm_key);
VmDb::stop_process_by_kind_pk(pk, state).await?;
VmDb::stop_process_by_kind_key(pk, state).await?;
VmDb::del_process_by_pk(

Check warning on line 102 in bin/nanocld/src/objects/vm.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/objects/vm.rs#L101-L102

Added lines #L101 - L102 were not covered by tests
&container_name,
None::<RemoveContainerOptions>,
Expand All @@ -114,7 +114,7 @@ impl ObjPutByPk for VmDb {
.await?;
let image = VmImageDb::read_by_pk(&vm.spec.disk.image, &state.pool).await?;
utils::vm::create_instance(&vm, &image, false, state).await?;
VmDb::start_process_by_kind_pk(&vm.spec.vm_key, state).await?;
VmDb::start_process_by_kind_key(&vm.spec.vm_key, state).await?;

Check warning on line 117 in bin/nanocld/src/objects/vm.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/objects/vm.rs#L117

Added line #L117 was not covered by tests
Ok(vm)
}
}
Expand Down
24 changes: 12 additions & 12 deletions bin/nanocld/src/services/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ pub async fn start_process(
let kind_pk = utils::key::gen_kind_key(&kind, &name, &qs.namespace);
match &kind {
ProcessKind::Vm => {
VmDb::start_process_by_kind_pk(&kind_pk, &state).await?;
VmDb::start_process_by_kind_key(&kind_pk, &state).await?;

Check warning on line 140 in bin/nanocld/src/services/process.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/services/process.rs#L140

Added line #L140 was not covered by tests
}
ProcessKind::Job => {
JobDb::start_process_by_kind_pk(&kind_pk, &state).await?;
JobDb::start_process_by_kind_key(&kind_pk, &state).await?;
}
ProcessKind::Cargo => {
CargoDb::start_process_by_kind_pk(&kind_pk, &state).await?;
CargoDb::start_process_by_kind_key(&kind_pk, &state).await?;
}
}
Ok(web::HttpResponse::Accepted().finish())
Expand Down Expand Up @@ -174,13 +174,13 @@ pub async fn restart_process(
let kind_pk = utils::key::gen_kind_key(&kind, &name, &qs.namespace);
match &kind {
ProcessKind::Vm => {
VmDb::restart_process_by_kind_pk(&kind_pk, &state).await?;
VmDb::restart_process_by_kind_key(&kind_pk, &state).await?;

Check warning on line 177 in bin/nanocld/src/services/process.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/services/process.rs#L177

Added line #L177 was not covered by tests
}
ProcessKind::Job => {
JobDb::restart_process_by_kind_pk(&kind_pk, &state).await?;
JobDb::restart_process_by_kind_key(&kind_pk, &state).await?;

Check warning on line 180 in bin/nanocld/src/services/process.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/services/process.rs#L180

Added line #L180 was not covered by tests
}
ProcessKind::Cargo => {
CargoDb::restart_process_by_kind_pk(&kind_pk, &state).await?;
CargoDb::restart_process_by_kind_key(&kind_pk, &state).await?;
}
}
Ok(web::HttpResponse::Accepted().finish())
Expand Down Expand Up @@ -211,13 +211,13 @@ pub async fn stop_process(
let kind_pk = utils::key::gen_kind_key(&kind, &name, &qs.namespace);
match &kind {
ProcessKind::Vm => {
VmDb::stop_process_by_kind_pk(&kind_pk, &state).await?;
VmDb::stop_process_by_kind_key(&kind_pk, &state).await?;

Check warning on line 214 in bin/nanocld/src/services/process.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/services/process.rs#L214

Added line #L214 was not covered by tests
}
ProcessKind::Job => {
JobDb::stop_process_by_kind_pk(&kind_pk, &state).await?;
JobDb::stop_process_by_kind_key(&kind_pk, &state).await?;

Check warning on line 217 in bin/nanocld/src/services/process.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/services/process.rs#L217

Added line #L217 was not covered by tests
}
ProcessKind::Cargo => {
CargoDb::stop_process_by_kind_pk(&kind_pk, &state).await?;
CargoDb::stop_process_by_kind_key(&kind_pk, &state).await?;
}
}
Ok(web::HttpResponse::Accepted().finish())
Expand Down Expand Up @@ -250,13 +250,13 @@ pub async fn kill_process(
let kind_pk = utils::key::gen_kind_key(&kind, &name, &qs.namespace);
match &kind {
ProcessKind::Vm => {
VmDb::kill_process_by_kind_pk(&kind_pk, &payload, &state).await?;
VmDb::kill_process_by_kind_key(&kind_pk, &payload, &state).await?;

Check warning on line 253 in bin/nanocld/src/services/process.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/services/process.rs#L253

Added line #L253 was not covered by tests
}
ProcessKind::Job => {
JobDb::kill_process_by_kind_pk(&kind_pk, &payload, &state).await?;
JobDb::kill_process_by_kind_key(&kind_pk, &payload, &state).await?;

Check warning on line 256 in bin/nanocld/src/services/process.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocld/src/services/process.rs#L256

Added line #L256 was not covered by tests
}
ProcessKind::Cargo => {
CargoDb::kill_process_by_kind_pk(&kind_pk, &payload, &state).await?;
CargoDb::kill_process_by_kind_key(&kind_pk, &payload, &state).await?;
}
}
Ok(web::HttpResponse::Ok().into())
Expand Down

0 comments on commit 1fa270f

Please sign in to comment.