Skip to main content

gary_core/
comm.rs

1use super::data::*;
2use super::network::*;
3use chrono::{DateTime, Utc};
4use std::collections::HashMap;
5
6/*
7* Node to node private cluster communication
8* */
9pub trait ClusterCommunicator {
10    /*
11     * Cluster management
12     * */
13    fn send_message(&self, target: &str, msg: &Message) -> bool;
14    fn handle_message(&mut self, msg: &Message);
15    fn get_nghbr_sample(&self, a: &HashMap<String, DateTime<Utc>>) -> Vec<String>;
16    fn comm_recv_gossip(&mut self, payload: &Vec<String>);
17    // fn comm_recv_heartbeat(&mut self);  // Currently handled in Node.run() by 'responder.send("ACK", 0).unwrap();'
18    fn update_neighbors(&mut self);
19    fn delinquent_node_check(&mut self);
20}
21
22/* not sure if I like these could be part of the same trait*/
23pub trait ClusterCommunicationReceiver {
24    fn heartbeat_response(peer: &str);
25    fn sync_response(info: MachineInfo);
26}
27
28/*
29* Node to node private deployment communication00
30* */
31pub trait DeploymentCommunicator {
32    /*
33     * Deployment management
34     * */
35    fn request_run_deployment(deployment: Deployment);
36}
37
38/* not sure if I like these */
39pub trait DeploymentCommunicationReceiver {}