-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.proto
169 lines (144 loc) · 3.4 KB
/
schema.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
Copyright 2019-2020 vChain, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
import "google/protobuf/empty.proto";
package immudb.schema;
message Key {
bytes key = 1;
}
message KeyValue {
bytes key = 1;
bytes value = 2;
}
message StructuredKeyValue {
bytes key = 1;
Content value = 2;
}
message Content {
uint64 timestamp = 1;
bytes payload = 2;
}
message Index {
uint64 index = 1;
}
message Item {
bytes key = 1;
bytes value = 2;
uint64 index = 3;
}
message StructuredItem {
bytes key = 1;
Content value = 2;
uint64 index = 3;
}
message KVList {
repeated KeyValue KVs = 1;
}
message SKVList {
repeated StructuredKeyValue KVs = 1;
}
message KeyList {
repeated Key keys = 1;
}
message ItemList {
repeated Item items = 1;
}
message StructuredItemList {
repeated StructuredItem items = 1;
}
message Root {
uint64 index = 1;
bytes root = 2;
}
message ScanOptions {
bytes prefix = 1;
bytes offset = 2;
uint64 limit = 3;
bool reverse = 4;
}
message KeyPrefix {
bytes prefix = 1;
}
message ItemsCount {
uint64 count = 1;
}
message InclusionProof {
uint64 at = 1;
uint64 index = 2;
bytes root = 3;
bytes leaf = 4;
repeated bytes path = 5;
}
message ConsistencyProof {
uint64 first = 1;
uint64 second = 2;
bytes firstRoot = 3;
bytes secondRoot = 4;
repeated bytes path = 5;
}
message Proof {
bytes leaf = 1;
uint64 index = 2;
bytes root = 3;
uint64 at = 4;
repeated bytes inclusionPath = 5;
repeated bytes consistencyPath = 6;
}
message SafeItem {
Item item = 1;
Proof proof = 2;
}
message SafeStructuredItem {
StructuredItem item = 1;
Proof proof = 2;
}
message SafeSetOptions {
KeyValue kv = 1;
Index rootIndex = 2;
}
message SafeSetSVOptions {
StructuredKeyValue skv = 1;
Index rootIndex = 2;
}
message SafeGetOptions {
Key key = 1;
Index rootIndex = 2;
}
message HealthResponse {
bool status = 1;
}
service ImmuService {
rpc Set (KeyValue) returns (Index);
rpc SetSV (StructuredKeyValue) returns (Index);
rpc SafeSet(SafeSetOptions) returns (Proof);
rpc SafeSetSV(SafeSetSVOptions) returns (Proof);
rpc Get (Key) returns (Item);
rpc GetSV (Key) returns (StructuredItem);
rpc SafeGet(SafeGetOptions) returns (SafeItem);
rpc SafeGetSV(SafeGetOptions) returns (SafeStructuredItem);
rpc SetBatch (KVList) returns (Index);
rpc SetBatchSV (SKVList) returns (Index);
rpc GetBatch (KeyList) returns (ItemList);
rpc GetBatchSV (KeyList) returns (StructuredItemList);
rpc Scan(ScanOptions) returns (ItemList);
rpc ScanSV(ScanOptions) returns (StructuredItemList);
rpc Count(KeyPrefix) returns (ItemsCount);
rpc CurrentRoot(google.protobuf.Empty) returns (Root);
rpc Inclusion(Index) returns (InclusionProof);
rpc Consistency(Index) returns (ConsistencyProof);
rpc ByIndex(Index) returns (Item);
rpc ByIndexSV(Index) returns (StructuredItem);
rpc History(Key) returns (ItemList);
rpc HistorySV(Key) returns (StructuredItemList);
rpc Health (google.protobuf.Empty) returns (HealthResponse);
}