forked from herocode/horus
fix coordinator compilation
This commit is contained in:
3
bin/coordinator/src/storage/mod.rs
Normal file
3
bin/coordinator/src/storage/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
mod redis;
|
||||
|
||||
pub use redis::RedisDriver;
|
||||
@@ -7,7 +7,7 @@ use serde_json::{Map as JsonMap, Value};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::models::{
|
||||
Actor, Context, Flow, FlowStatus, Job, JobStatus, Message, MessageStatus, Runner,
|
||||
Context, Flow, FlowStatus, Job, JobStatus, Message, MessageStatus, Runner,
|
||||
TransportStatus,
|
||||
};
|
||||
use tracing::{error, warn};
|
||||
@@ -201,41 +201,12 @@ impl RedisDriver {
|
||||
}
|
||||
|
||||
// -----------------------------
|
||||
// Actor
|
||||
// Actor (deprecated - renamed to Runner)
|
||||
// -----------------------------
|
||||
|
||||
/// Save an Actor to the given DB (tenant/context DB)
|
||||
pub async fn save_actor(&self, db: u32, actor: &Actor) -> Result<()> {
|
||||
let json = serde_json::to_value(actor)?;
|
||||
let id = json
|
||||
.get("id")
|
||||
.and_then(|v| v.as_u64())
|
||||
.ok_or("Actor.id missing or not a number")? as u32;
|
||||
let key = Self::actor_key(id);
|
||||
self.hset_model(db, &key, actor).await
|
||||
}
|
||||
|
||||
/// Load an Actor by id from the given DB
|
||||
pub async fn load_actor(&self, db: u32, id: u32) -> Result<Actor> {
|
||||
let key = Self::actor_key(id);
|
||||
self.hget_model(db, &key).await
|
||||
}
|
||||
/// Save an Actor globally in DB 0 (Actor is context-independent)
|
||||
pub async fn save_actor_global(&self, actor: &Actor) -> Result<()> {
|
||||
let json = serde_json::to_value(actor)?;
|
||||
let id = json
|
||||
.get("id")
|
||||
.and_then(|v| v.as_u64())
|
||||
.ok_or("Actor.id missing or not a number")? as u32;
|
||||
let key = Self::actor_key(id);
|
||||
self.hset_model(0, &key, actor).await
|
||||
}
|
||||
|
||||
/// Load an Actor globally from DB 0 by id
|
||||
pub async fn load_actor_global(&self, id: u32) -> Result<Actor> {
|
||||
let key = Self::actor_key(id);
|
||||
self.hget_model(0, &key).await
|
||||
}
|
||||
// pub async fn save_actor(&self, db: u32, actor: &Actor) -> Result<()> { ... }
|
||||
// pub async fn load_actor(&self, db: u32, id: u32) -> Result<Actor> { ... }
|
||||
// pub async fn save_actor_global(&self, actor: &Actor) -> Result<()> { ... }
|
||||
// pub async fn load_actor_global(&self, id: u32) -> Result<Actor> { ... }
|
||||
|
||||
// -----------------------------
|
||||
// Runner
|
||||
|
||||
Reference in New Issue
Block a user