forked from latticexyz/mud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecs-snapshot.proto
110 lines (88 loc) · 3.22 KB
/
ecs-snapshot.proto
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
syntax = "proto3";
package ecssnapshot;
option go_package = "protobuf/go/ecs-snapshot";
message ECSState {
uint32 component_id_idx = 1;
uint32 entity_id_idx = 2;
bytes value = 3;
}
message ECSStateSnapshot {
repeated ECSState state = 1;
repeated string stateComponents = 2;
repeated string stateEntities = 3;
string stateHash = 4;
uint32 startBlockNumber = 5;
uint32 endBlockNumber = 6;
string worldAddress = 7;
}
message Worlds {
repeated string worldAddress = 1;
}
// The Snapshot Service definition.
service ECSStateSnapshotService {
// Requests the latest ECS state.
rpc GetStateLatest (ECSStateRequestLatest) returns (ECSStateReply) {}
// Requests the latest ECS state in stream format, which will chunk the state.
rpc GetStateLatestStream (ECSStateRequestLatestStream) returns (stream ECSStateReply) {}
// Requests the latest ECS state in stream format, which will chunk the state.
//
// V2 version optimized to return entities as raw bytes.
rpc GetStateLatestStreamV2 (ECSStateRequestLatestStream) returns (stream ECSStateReplyV2) {}
// Requests the latest ECS state, with aditional pruning.
rpc GetStateLatestStreamPruned (ECSStateRequestLatestStreamPruned) returns (stream ECSStateReply) {}
// Requests the latest ECS state, with aditional pruning.
//
// V2 version optimized to return entities as raw bytes.
rpc GetStateLatestStreamPrunedV2 (ECSStateRequestLatestStreamPruned) returns (stream ECSStateReplyV2) {}
// Requests the latest block number based on the latest ECS state.
rpc GetStateBlockLatest (ECSStateBlockRequestLatest) returns (ECSStateBlockReply) {}
// Requests the ECS state at specific block.
rpc GetStateAtBlock (ECSStateRequestAtBlock) returns (ECSStateReply) {}
// Requests a list of known worlds based on chain state.
rpc GetWorlds (WorldsRequest) returns (Worlds) {}
}
// The request message for the latest ECS state.
message ECSStateRequestLatest {
string worldAddress = 1;
}
// The request message for the latest ECS statem, pruned for specific address.
message ECSStateRequestLatestStreamPruned {
string worldAddress = 1;
string pruneAddress = 2;
optional string pruneComponentId = 3;
optional uint32 chunkPercentage = 4;
}
// The request message for the latest chunked ECS state.
message ECSStateRequestLatestStream {
string worldAddress = 1;
optional uint32 chunkPercentage = 2;
}
// The request message for the latest block based on latest ECS state.
message ECSStateBlockRequestLatest {
string worldAddress = 1;
}
// The request message for the ECS state given a block number.
message ECSStateRequestAtBlock {
uint64 blockNumber = 1;
}
// The request message for all worlds.
message WorldsRequest {
}
// The response message containing the current state, hash of that state, and the block number of that state.
message ECSStateReply {
repeated ECSState state = 1;
repeated string stateComponents = 2;
repeated string stateEntities = 3;
string stateHash = 4;
uint32 blockNumber = 5;
}
message ECSStateReplyV2 {
repeated ECSState state = 1;
repeated string stateComponents = 2;
repeated bytes stateEntities = 3;
string stateHash = 4;
uint32 blockNumber = 5;
}
message ECSStateBlockReply {
uint32 blockNumber = 1;
}