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
use crate::io::codec::RRCodec;
use crate::io::provider::{Description, EntryId, Path};
use crate::io::transport::{DirectId, Envelope, Origin, WideEnvelope};
use meio_protocol::Protocol;
use serde::{Deserialize, Serialize};
pub type ClientReqId = DirectId<ClientProtocol>;
#[derive(Debug, Default, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct ClientProtocol;
impl Protocol for ClientProtocol {
type ToServer = Envelope<Self, ClientRequest>;
type ToClient = WideEnvelope<Self, ClientResponse>;
type Codec = RRCodec;
}
impl Origin for ClientProtocol {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ClientRequest {
ControlStream { path: Path, active: bool },
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ClientResponse {
Declare(EntryId),
Paths(Vec<Description>),
State(Vec<u8>),
Delta(Vec<u8>),
Done,
}