rename worker to actor

This commit is contained in:
Timur Gordon
2025-08-05 15:44:33 +02:00
parent 5283f383b3
commit 89e953ca1d
67 changed files with 1629 additions and 1737 deletions

View File

@@ -0,0 +1,3 @@
# Baobab WASM App
The Baobab WASM app is a simple web interface for interacting with the backend. It provides a simple way to supervise workers, view and manage jobs, and to execute scripts.

View File

@@ -5,7 +5,7 @@ An OpenRPC WebSocket Server to interface with the [cores](../../core) of authori
- [OpenRPC Specification](openrpc.json) defines the API.
- There are RPC Operations specified to authorize a websocket connection.
- Authorized clients can manage jobs.
- The server uses the [supervisor] to dispatch [jobs] to the [workers].
- The server uses the [supervisor] to dispatch [jobs] to the [actors].
## Circles

View File

@@ -88,7 +88,6 @@ async fn main() -> std::io::Result<()> {
cert: args.cert.clone(),
key: args.key.clone(),
tls_port: args.tls_port,
webhooks: args.webhooks,
circles: std::collections::HashMap::new(), // Empty circles when using CLI
}
};

View File

@@ -30,7 +30,7 @@ graph TB
subgraph "Backend"
L[Redis]
M[Rhai Worker]
M[Rhai Actor]
end
A --> |POST /webhooks/stripe/{circle_pk}| E
@@ -94,7 +94,7 @@ sequenceDiagram
participant WV as Webhook Verifier
participant SD as Script Supervisor
participant RC as RhaiSupervisor
participant RW as Rhai Worker
participant RW as Rhai Actor
WS->>CS: POST /webhooks/stripe/{circle_pk}
CS->>CS: Extract circle_pk from URL

View File

@@ -1,8 +1,8 @@
use circle_ws_lib::{spawn_circle_server, ServerConfig};
use rhailib_engine::create_heromodels_engine;
use baobab_engine::create_heromodels_engine;
use futures_util::{SinkExt, StreamExt};
use heromodels::db::hero::OurDB;
use rhailib_worker::spawn_rhai_worker;
use baobab_actor::spawn_rhai_actor;
use serde_json::json;
use std::sync::Arc;
use tokio::sync::mpsc;
@@ -14,13 +14,13 @@ async fn test_server_startup_and_play() {
let circle_pk = Uuid::new_v4().to_string();
let redis_url = "redis://127.0.0.1/";
// --- Worker Setup ---
// --- Actor Setup ---
let (shutdown_tx, shutdown_rx) = mpsc::channel(1);
let db = Arc::new(OurDB::new("file:memdb_test_server?mode=memory&cache=shared", true).unwrap());
let engine = create_heromodels_engine();
let worker_id = Uuid::new_v4().to_string();
let worker_handle = spawn_rhai_worker(
worker_id,
let actor_id = Uuid::new_v4().to_string();
let actor_handle = spawn_rhai_actor(
actor_id,
circle_pk.to_string(),
engine,
redis_url.to_string(),
@@ -37,7 +37,7 @@ async fn test_server_startup_and_play() {
let (server_task, server_handle) = spawn_circle_server(config).unwrap();
let server_join_handle = tokio::spawn(server_task);
// Give server and worker a moment to start
// Give server and actor a moment to start
tokio::time::sleep(std::time::Duration::from_millis(500)).await;
// --- Client Connection and Test ---
@@ -72,5 +72,5 @@ async fn test_server_startup_and_play() {
server_handle.stop(true).await;
let _ = server_join_handle.await;
let _ = shutdown_tx.send(()).await;
let _ = worker_handle.await;
let _ = actor_handle.await;
}