remove preserve tasks from actor trait
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -467,9 +467,11 @@ dependencies = [
|
|||||||
name = "baobab_actor"
|
name = "baobab_actor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
|
"crossterm",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"hero_job",
|
"hero_job",
|
||||||
"hero_supervisor",
|
"hero_supervisor",
|
||||||
@@ -477,6 +479,7 @@ dependencies = [
|
|||||||
"heromodels-derive 0.1.0 (git+https://git.ourworld.tf/herocode/db.git)",
|
"heromodels-derive 0.1.0 (git+https://git.ourworld.tf/herocode/db.git)",
|
||||||
"heromodels_core 0.1.0 (git+https://git.ourworld.tf/herocode/db.git)",
|
"heromodels_core 0.1.0 (git+https://git.ourworld.tf/herocode/db.git)",
|
||||||
"log",
|
"log",
|
||||||
|
"ratatui",
|
||||||
"redis 0.25.4",
|
"redis 0.25.4",
|
||||||
"rhai",
|
"rhai",
|
||||||
"serde",
|
"serde",
|
||||||
|
@@ -1,32 +1,3 @@
|
|||||||
//! # Actor Trait Abstraction
|
|
||||||
//!
|
|
||||||
//! This module provides a trait-based abstraction for Rhai actors that eliminates
|
|
||||||
//! code duplication between synchronous and asynchronous actor implementations.
|
|
||||||
//!
|
|
||||||
//! The `Actor` trait defines the common interface and behavior, while specific
|
|
||||||
//! implementations handle job processing differently (sync vs async).
|
|
||||||
//!
|
|
||||||
//! ## Architecture
|
|
||||||
//!
|
|
||||||
//! ```text
|
|
||||||
//! ┌─────────────────┐ ┌─────────────────┐
|
|
||||||
//! │ SyncActor │ │ AsyncActor │
|
|
||||||
//! │ │ │ │
|
|
||||||
//! │ process_job() │ │ process_job() │
|
|
||||||
//! │ (sequential) │ │ (concurrent) │
|
|
||||||
//! └─────────────────┘ └─────────────────┘
|
|
||||||
//! │ │
|
|
||||||
//! └───────┬───────────────┘
|
|
||||||
//! │
|
|
||||||
//! ┌───────▼───────┐
|
|
||||||
//! │ Actor Trait │
|
|
||||||
//! │ │
|
|
||||||
//! │ spawn() │
|
|
||||||
//! │ config │
|
|
||||||
//! │ common loop │
|
|
||||||
//! └───────────────┘
|
|
||||||
//! ```
|
|
||||||
|
|
||||||
use hero_job::Job;
|
use hero_job::Job;
|
||||||
use log::{debug, error, info};
|
use log::{debug, error, info};
|
||||||
use redis::AsyncCommands;
|
use redis::AsyncCommands;
|
||||||
@@ -44,7 +15,6 @@ pub struct ActorConfig {
|
|||||||
pub actor_id: String,
|
pub actor_id: String,
|
||||||
pub db_path: String,
|
pub db_path: String,
|
||||||
pub redis_url: String,
|
pub redis_url: String,
|
||||||
pub preserve_tasks: bool,
|
|
||||||
pub default_timeout: Option<Duration>, // Only used by async actors
|
pub default_timeout: Option<Duration>, // Only used by async actors
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,13 +24,11 @@ impl ActorConfig {
|
|||||||
actor_id: String,
|
actor_id: String,
|
||||||
db_path: String,
|
db_path: String,
|
||||||
redis_url: String,
|
redis_url: String,
|
||||||
preserve_tasks: bool,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
actor_id,
|
actor_id,
|
||||||
db_path,
|
db_path,
|
||||||
redis_url,
|
redis_url,
|
||||||
preserve_tasks,
|
|
||||||
default_timeout: None,
|
default_timeout: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user