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