1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
//! This module handle the execution for the agent.
use crate::{agent, delegation, module, utils, uuid};
pub mod default;
pub mod tst;
// ___ _ __ __
// |_ _|_ __ _ __ _ _| |_| \/ | ___ ___ ___ __ _ __ _ ___
// | || '_ \| '_ \| | | | __| |\/| |/ _ \/ __/ __|/ _` |/ _` |/ _ \
// | || | | | |_) | |_| | |_| | | | __/\__ \__ \ (_| | (_| | __/
// |___|_| |_| .__/ \__,_|\__|_| |_|\___||___/___/\__,_|\__, |\___|
// |_| |___/
/// Input message for the execution module
#[derive(Clone)]
pub enum InputMessage
{
/// Queue the execution of the given task
QueueExecution
{
/// uuid of the task to execute
uuid: uuid::Uuid,
},
/// Cancel the execution of the given task
CancelExecution
{
/// uuid of the task to cancel
uuid: uuid::Uuid,
},
}
// ___ _ _ __ __
// / _ \ _ _| |_ _ __ _ _| |_| \/ | ___ ___ ___ __ _ __ _ ___
// | | | | | | | __| '_ \| | | | __| |\/| |/ _ \/ __/ __|/ _` |/ _` |/ _ \
// | |_| | |_| | |_| |_) | |_| | |_| | | | __/\__ \__ \ (_| | (_| | __/
// \___/ \__,_|\__| .__/ \__,_|\__|_| |_|\___||___/___/\__,_|\__, |\___|
// |_| |___/
/// Output message for the execution module
#[derive(Clone)]
pub enum OutputMessage {}
// __ __ _ _ ___ _ __
// | \/ | ___ __| |_ _| | ___|_ _|_ __ | |_ ___ _ __ / _| __ _ ___ ___
// | |\/| |/ _ \ / _` | | | | |/ _ \| || '_ \| __/ _ \ '__| |_ / _` |/ __/ _ \
// | | | | (_) | (_| | |_| | | __/| || | | | || __/ | | _| (_| | (_| __/
// |_| |_|\___/ \__,_|\__,_|_|\___|___|_| |_|\__\___|_| |_| \__,_|\___\___|
pub type ModuleInterface = module::ModuleInterface<InputMessage, OutputMessage>;
// __ __ _ _
// | \/ | ___ __| |_ _| | ___
// | |\/| |/ _ \ / _` | | | | |/ _ \
// | | | | (_) | (_| | |_| | | __/
// |_| |_|\___/ \__,_|\__,_|_|\___|
/// Trait to define the interface to execution module
pub trait Module:
module::Module<InputMessage = InputMessage, OutputMessage = OutputMessage> + Sized
{
/// Creation options for the execution module
type Options;
/// Start an execution module
fn start(
agent_data: agent::AgentData,
module_interfaces: (
module::ModuleInterface<InputMessage, OutputMessage>,
Self::ModulePrivateInterface,
),
options: Self::Options,
) -> impl std::future::Future<Output = ()> + std::marker::Send + 'static;
}