Add validation for service methods
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
@@ -5,13 +5,13 @@ use crate::time::Timestamp;
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Context {
|
||||
/// Redis DB to use
|
||||
id: u32,
|
||||
pub id: u32,
|
||||
/// Actor ids which have admin rights on this context
|
||||
admins: Vec<u32>,
|
||||
pub admins: Vec<u32>,
|
||||
/// Actor ids which can read the context info
|
||||
readers: Vec<u32>,
|
||||
pub readers: Vec<u32>,
|
||||
/// Actor ids which can execute jobs in this context
|
||||
executors: Vec<u32>,
|
||||
created_at: Timestamp,
|
||||
updated_at: Timestamp,
|
||||
pub executors: Vec<u32>,
|
||||
pub created_at: Timestamp,
|
||||
pub updated_at: Timestamp,
|
||||
}
|
||||
|
@@ -7,25 +7,26 @@ use crate::time::Timestamp;
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Flow {
|
||||
/// Job Id set tby the actor which created it
|
||||
id: u32,
|
||||
pub id: u32,
|
||||
/// Actor Id who created this job
|
||||
caller_id: u32,
|
||||
pub caller_id: u32,
|
||||
/// The context in which this job is executed
|
||||
context_id: u32,
|
||||
pub context_id: u32,
|
||||
/// List of jobs which make up the flow
|
||||
jobs: Vec<u32>,
|
||||
pub jobs: Vec<u32>,
|
||||
/// Environment variables, passed to every job when executed
|
||||
env_vars: HashMap<String, String>,
|
||||
pub env_vars: HashMap<String, String>,
|
||||
/// The result of the flow
|
||||
result: HashMap<String, String>,
|
||||
created_at: Timestamp,
|
||||
updated_at: Timestamp,
|
||||
status: FlowStatus,
|
||||
pub result: HashMap<String, String>,
|
||||
pub created_at: Timestamp,
|
||||
pub updated_at: Timestamp,
|
||||
pub status: FlowStatus,
|
||||
}
|
||||
|
||||
/// The status of a flow
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum FlowStatus {
|
||||
Created,
|
||||
Dispatched,
|
||||
Started,
|
||||
Error,
|
||||
|
@@ -7,25 +7,25 @@ use crate::{models::ScriptType, time::Timestamp};
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct Job {
|
||||
/// Job Id, this is given by the actor who created the job
|
||||
id: u32,
|
||||
pub id: u32,
|
||||
/// Actor ID which created this job
|
||||
caller_id: u32,
|
||||
pub caller_id: u32,
|
||||
/// Context in which the job is executed
|
||||
context_id: u32,
|
||||
script: String,
|
||||
script_type: ScriptType,
|
||||
pub context_id: u32,
|
||||
pub script: String,
|
||||
pub script_type: ScriptType,
|
||||
/// Timeout in seconds for this job
|
||||
timeout: u32,
|
||||
pub timeout: u32,
|
||||
/// Max amount of times to retry this job
|
||||
retries: u8,
|
||||
env_vars: HashMap<String, String>,
|
||||
result: HashMap<String, String>,
|
||||
prerequisites: Vec<String>,
|
||||
pub retries: u8,
|
||||
pub env_vars: HashMap<String, String>,
|
||||
pub result: HashMap<String, String>,
|
||||
pub prerequisites: Vec<String>,
|
||||
/// Ids of jobs this job depends on, i.e. this job can't start until those have finished
|
||||
depends: Vec<u32>,
|
||||
created_at: Timestamp,
|
||||
updated_at: Timestamp,
|
||||
status: JobStatus,
|
||||
pub depends: Vec<u32>,
|
||||
pub created_at: Timestamp,
|
||||
pub updated_at: Timestamp,
|
||||
pub status: JobStatus,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||
|
@@ -8,25 +8,25 @@ use crate::{
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct Message {
|
||||
/// Unique ID for the message, set by the caller
|
||||
id: u32,
|
||||
pub id: u32,
|
||||
/// Id of the actor who sent this message
|
||||
caller_id: u32,
|
||||
pub caller_id: u32,
|
||||
/// Id of the context in which this message was sent
|
||||
context_id: u32,
|
||||
message: String,
|
||||
message_type: ScriptType,
|
||||
message_format_type: MessageFormatType,
|
||||
pub context_id: u32,
|
||||
pub message: String,
|
||||
pub message_type: ScriptType,
|
||||
pub message_format_type: MessageFormatType,
|
||||
/// Seconds for the message to arrive at the destination
|
||||
timeout: u32,
|
||||
pub timeout: u32,
|
||||
/// Seconds for the receiver to acknowledge receipt of the message
|
||||
timeout_ack: u32,
|
||||
pub timeout_ack: u32,
|
||||
/// Seconds for the receiver to send us a reply
|
||||
timeout_result: u32,
|
||||
job: Vec<Job>,
|
||||
logs: Vec<Log>,
|
||||
created_at: Timestamp,
|
||||
updated_at: Timestamp,
|
||||
status: MessageStatus,
|
||||
pub timeout_result: u32,
|
||||
pub job: Vec<Job>,
|
||||
pub logs: Vec<Log>,
|
||||
pub created_at: Timestamp,
|
||||
pub updated_at: Timestamp,
|
||||
pub status: MessageStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -36,7 +36,7 @@ pub enum MessageType {
|
||||
Mail,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum MessageStatus {
|
||||
Dispatched,
|
||||
Acknowledged,
|
||||
|
@@ -6,17 +6,17 @@ use crate::time::Timestamp;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Runner {
|
||||
id: u32,
|
||||
pub id: u32,
|
||||
/// Mycelium public key
|
||||
pubkey: String,
|
||||
pub pubkey: String,
|
||||
/// Mycelium address
|
||||
address: IpAddr,
|
||||
pub address: IpAddr,
|
||||
/// Needs to be set by the runner, usually `runner<runnerid`
|
||||
topic: String,
|
||||
pub topic: String,
|
||||
/// If this is true, the runner also listens on a local redis queue
|
||||
local: bool,
|
||||
created_at: Timestamp,
|
||||
updated_at: Timestamp,
|
||||
pub local: bool,
|
||||
pub created_at: Timestamp,
|
||||
pub updated_at: Timestamp,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
|
Reference in New Issue
Block a user