garage/src/proto.rs

32 lines
561 B
Rust
Raw Normal View History

2020-04-06 17:55:39 +00:00
use std::net::SocketAddr;
use serde::{Serialize, Deserialize};
2020-04-06 17:55:39 +00:00
use crate::data::*;
#[derive(Debug, Serialize, Deserialize)]
pub enum Message {
Ok,
Error(String),
2020-04-06 17:55:39 +00:00
Ping(PingMessage),
2020-04-06 20:27:51 +00:00
PullStatus,
PullConfig,
AdvertiseNodesUp(Vec<AdvertisedNode>),
AdvertiseConfig(NetworkConfig),
2020-04-06 17:55:39 +00:00
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PingMessage {
pub id: UUID,
pub rpc_port: u16,
2020-04-06 20:27:51 +00:00
pub status_hash: Hash,
2020-04-06 17:55:39 +00:00
pub config_version: u64,
}
2020-04-06 20:27:51 +00:00
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AdvertisedNode {
2020-04-06 17:55:39 +00:00
pub id: UUID,
pub addr: SocketAddr,
}