interstice_core/network/
protocol.rs1use interstice_abi::NodeSchema;
2use interstice_abi::{IntersticeValue, Row};
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize)]
6pub enum NetworkPacket {
7 Handshake {
8 node_id: String,
9 address: String,
10 token: String,
11 },
12 Close,
13 ReducerCall {
14 module_name: String,
15 reducer_name: String,
16 input: IntersticeValue,
17 },
18 QueryCall {
19 request_id: String,
20 module_name: String,
21 query_name: String,
22 input: IntersticeValue,
23 },
24 QueryResponse {
25 request_id: String,
26 result: IntersticeValue,
27 },
28 RequestSubscription(RequestSubscription),
29 TableEvent(TableEventInstance),
30 ModuleEvent(ModuleEventInstance),
31 SchemaRequest {
32 request_id: String,
33 node_name: String,
34 },
35 SchemaResponse {
36 request_id: String,
37 schema: NodeSchema,
38 },
39 Error(String),
40}
41
42#[derive(Debug, Serialize, Deserialize, Clone)]
43pub struct RequestSubscription {
44 pub module_name: String,
45 pub table_name: String,
46 pub event: TableEvent,
47}
48
49#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
50pub enum TableEvent {
51 Insert,
52 Update,
53 Delete,
54}
55
56#[derive(Debug, Serialize, Deserialize)]
57pub enum TableEventInstance {
58 TableInsertEvent {
59 module_name: String,
60 table_name: String,
61 inserted_row: Row,
62 },
63 TableUpdateEvent {
64 module_name: String,
65 table_name: String,
66 old_row: Row,
67 new_row: Row,
68 },
69 TableDeleteEvent {
70 module_name: String,
71 table_name: String,
72 deleted_row: Row,
73 },
74}
75
76#[derive(Debug, Serialize, Deserialize)]
77pub enum ModuleEventInstance {
78 Publish { wasm_binary: Vec<u8> },
79 Remove { module_name: String },
80}