feat: don't use nightly features
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -544,7 +544,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nocontrol"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
@@ -3,7 +3,7 @@ members = ["crates/*", "examples/*"]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
|
||||
[workspace.dependencies]
|
||||
nocontrol = { path = "crates/nocontrol" }
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#![feature(associated_type_defaults)]
|
||||
|
||||
mod control_plane;
|
||||
pub use control_plane::ControlPlane;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ pub trait Specification: Clone + Serialize + DeserializeOwned {
|
||||
#[allow(dead_code, unused_variables)]
|
||||
pub trait Operator: Send + Sync + 'static {
|
||||
type Specifications: Specification;
|
||||
type Error = anyhow::Error;
|
||||
type Error;
|
||||
|
||||
fn reconcile(
|
||||
&self,
|
||||
|
||||
@@ -51,6 +51,7 @@ pub struct MyOperator {}
|
||||
|
||||
impl Operator for MyOperator {
|
||||
type Specifications = Specifications;
|
||||
type Error = anyhow::Error;
|
||||
|
||||
async fn reconcile(
|
||||
&self,
|
||||
|
||||
@@ -103,6 +103,7 @@ impl ProcessOperator {
|
||||
|
||||
impl Operator for ProcessOperator {
|
||||
type Specifications = Specifications;
|
||||
type Error = anyhow::Error;
|
||||
|
||||
async fn reconcile(
|
||||
&self,
|
||||
@@ -127,10 +128,7 @@ impl Operator for ProcessOperator {
|
||||
Some(ProcessState::Running) => {
|
||||
// Process is running as desired
|
||||
manifest_state.status.status = ManifestStatusState::Running;
|
||||
tracing::info!(
|
||||
"Process {} is running as desired",
|
||||
spec.name
|
||||
);
|
||||
tracing::info!("Process {} is running as desired", spec.name);
|
||||
}
|
||||
Some(ProcessState::Pending) | Some(ProcessState::Stopped) => {
|
||||
// Process is pending or stopped, start it
|
||||
@@ -153,10 +151,7 @@ impl Operator for ProcessOperator {
|
||||
}
|
||||
None => {
|
||||
// Process doesn't exist in manager, recreate
|
||||
tracing::info!(
|
||||
"Process {} not found, creating new",
|
||||
spec.name
|
||||
);
|
||||
tracing::info!("Process {} not found, creating new", spec.name);
|
||||
let new_id = self
|
||||
.process_manager
|
||||
.add_process(Process::new(WorkerProcess {
|
||||
@@ -194,10 +189,7 @@ impl Operator for ProcessOperator {
|
||||
match status {
|
||||
Some(ProcessState::Running) => {
|
||||
// Process is running but should be stopped
|
||||
tracing::info!(
|
||||
"Stopping process {} as requested",
|
||||
spec.name
|
||||
);
|
||||
tracing::info!("Stopping process {} as requested", spec.name);
|
||||
manifest_state.status.status = ManifestStatusState::Stopping;
|
||||
self.process_manager.stop_process(id).await?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user