aboutsummaryrefslogblamecommitdiff
path: root/src/proto.rs
blob: 3a950c6c03558706cfdcc70bda520ec696b756d4 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                         

                                    

                   




                                        
                                



                                              




                                        
                               

                          
                              


                                

                                               

                             
 
use std::net::SocketAddr;
use serde::{Serialize, Deserialize};

use crate::data::*;

#[derive(Debug, Serialize, Deserialize)]
pub enum Message {
	Ok,
	Error(String),

	Ping(PingMessage),	
	PullStatus,
	PullConfig,
	AdvertiseNodesUp(Vec<AdvertisedNode>),
	AdvertiseConfig(NetworkConfig),
}

#[derive(Debug, Serialize, Deserialize)]
pub struct PingMessage {
	pub id: UUID,
	pub datacenter: String,
	pub rpc_port: u16,

	pub status_hash: Hash,
	pub config_version: u64,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AdvertisedNode {
	pub id: UUID,
	pub addr: SocketAddr,
}