immudb 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,426 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: schema.proto
3
+
4
+ require 'google/protobuf/empty_pb'
5
+ require 'google/protobuf/struct_pb'
6
+ require 'google/protobuf'
7
+
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_file("schema.proto", :syntax => :proto3) do
10
+ add_message "immudb.schema.Key" do
11
+ optional :key, :bytes, 1
12
+ end
13
+ add_message "immudb.schema.Permission" do
14
+ optional :database, :string, 1
15
+ optional :permission, :uint32, 2
16
+ end
17
+ add_message "immudb.schema.User" do
18
+ optional :user, :bytes, 1
19
+ repeated :permissions, :message, 3, "immudb.schema.Permission"
20
+ optional :createdby, :string, 4
21
+ optional :createdat, :string, 5
22
+ optional :active, :bool, 6
23
+ end
24
+ add_message "immudb.schema.UserList" do
25
+ repeated :users, :message, 1, "immudb.schema.User"
26
+ end
27
+ add_message "immudb.schema.CreateUserRequest" do
28
+ optional :user, :bytes, 1
29
+ optional :password, :bytes, 2
30
+ optional :permission, :uint32, 3
31
+ optional :database, :string, 4
32
+ end
33
+ add_message "immudb.schema.UserRequest" do
34
+ optional :user, :bytes, 1
35
+ end
36
+ add_message "immudb.schema.ChangePasswordRequest" do
37
+ optional :user, :bytes, 1
38
+ optional :oldPassword, :bytes, 2
39
+ optional :newPassword, :bytes, 3
40
+ end
41
+ add_message "immudb.schema.LoginRequest" do
42
+ optional :user, :bytes, 1
43
+ optional :password, :bytes, 2
44
+ end
45
+ add_message "immudb.schema.LoginResponse" do
46
+ optional :token, :string, 1
47
+ optional :warning, :bytes, 2
48
+ end
49
+ add_message "immudb.schema.AuthConfig" do
50
+ optional :kind, :uint32, 1
51
+ end
52
+ add_message "immudb.schema.MTLSConfig" do
53
+ optional :enabled, :bool, 1
54
+ end
55
+ add_message "immudb.schema.KeyValue" do
56
+ optional :key, :bytes, 1
57
+ optional :value, :bytes, 2
58
+ end
59
+ add_message "immudb.schema.Entry" do
60
+ optional :tx, :uint64, 1
61
+ optional :key, :bytes, 2
62
+ optional :value, :bytes, 3
63
+ optional :referencedBy, :message, 4, "immudb.schema.Reference"
64
+ end
65
+ add_message "immudb.schema.Reference" do
66
+ optional :tx, :uint64, 1
67
+ optional :key, :bytes, 2
68
+ optional :atTx, :uint64, 3
69
+ end
70
+ add_message "immudb.schema.Op" do
71
+ oneof :operation do
72
+ optional :kv, :message, 1, "immudb.schema.KeyValue"
73
+ optional :zAdd, :message, 2, "immudb.schema.ZAddRequest"
74
+ optional :ref, :message, 3, "immudb.schema.ReferenceRequest"
75
+ end
76
+ end
77
+ add_message "immudb.schema.ExecAllRequest" do
78
+ repeated :Operations, :message, 1, "immudb.schema.Op"
79
+ optional :noWait, :bool, 2
80
+ end
81
+ add_message "immudb.schema.Entries" do
82
+ repeated :entries, :message, 1, "immudb.schema.Entry"
83
+ end
84
+ add_message "immudb.schema.ZEntry" do
85
+ optional :set, :bytes, 1
86
+ optional :key, :bytes, 2
87
+ optional :entry, :message, 3, "immudb.schema.Entry"
88
+ optional :score, :double, 4
89
+ optional :atTx, :uint64, 5
90
+ end
91
+ add_message "immudb.schema.ZEntries" do
92
+ repeated :entries, :message, 1, "immudb.schema.ZEntry"
93
+ end
94
+ add_message "immudb.schema.ScanRequest" do
95
+ optional :seekKey, :bytes, 1
96
+ optional :prefix, :bytes, 2
97
+ optional :desc, :bool, 3
98
+ optional :limit, :uint64, 4
99
+ optional :sinceTx, :uint64, 5
100
+ optional :noWait, :bool, 6
101
+ end
102
+ add_message "immudb.schema.KeyPrefix" do
103
+ optional :prefix, :bytes, 1
104
+ end
105
+ add_message "immudb.schema.EntryCount" do
106
+ optional :count, :uint64, 1
107
+ end
108
+ add_message "immudb.schema.Signature" do
109
+ optional :publicKey, :bytes, 1
110
+ optional :signature, :bytes, 2
111
+ end
112
+ add_message "immudb.schema.TxMetadata" do
113
+ optional :id, :uint64, 1
114
+ optional :prevAlh, :bytes, 2
115
+ optional :ts, :int64, 3
116
+ optional :nentries, :int32, 4
117
+ optional :eH, :bytes, 5
118
+ optional :blTxId, :uint64, 6
119
+ optional :blRoot, :bytes, 7
120
+ end
121
+ add_message "immudb.schema.LinearProof" do
122
+ optional :sourceTxId, :uint64, 1
123
+ optional :TargetTxId, :uint64, 2
124
+ repeated :terms, :bytes, 3
125
+ end
126
+ add_message "immudb.schema.DualProof" do
127
+ optional :sourceTxMetadata, :message, 1, "immudb.schema.TxMetadata"
128
+ optional :targetTxMetadata, :message, 2, "immudb.schema.TxMetadata"
129
+ repeated :inclusionProof, :bytes, 3
130
+ repeated :consistencyProof, :bytes, 4
131
+ optional :targetBlTxAlh, :bytes, 5
132
+ repeated :lastInclusionProof, :bytes, 6
133
+ optional :linearProof, :message, 7, "immudb.schema.LinearProof"
134
+ end
135
+ add_message "immudb.schema.Tx" do
136
+ optional :metadata, :message, 1, "immudb.schema.TxMetadata"
137
+ repeated :entries, :message, 2, "immudb.schema.TxEntry"
138
+ end
139
+ add_message "immudb.schema.TxEntry" do
140
+ optional :key, :bytes, 1
141
+ optional :hValue, :bytes, 2
142
+ optional :vOff, :int64, 3
143
+ optional :vLen, :int32, 4
144
+ end
145
+ add_message "immudb.schema.VerifiableTx" do
146
+ optional :tx, :message, 1, "immudb.schema.Tx"
147
+ optional :dualProof, :message, 2, "immudb.schema.DualProof"
148
+ optional :signature, :message, 3, "immudb.schema.Signature"
149
+ end
150
+ add_message "immudb.schema.VerifiableEntry" do
151
+ optional :entry, :message, 1, "immudb.schema.Entry"
152
+ optional :verifiableTx, :message, 2, "immudb.schema.VerifiableTx"
153
+ optional :inclusionProof, :message, 3, "immudb.schema.InclusionProof"
154
+ end
155
+ add_message "immudb.schema.InclusionProof" do
156
+ optional :leaf, :int32, 1
157
+ optional :width, :int32, 2
158
+ repeated :terms, :bytes, 3
159
+ end
160
+ add_message "immudb.schema.SetRequest" do
161
+ repeated :KVs, :message, 1, "immudb.schema.KeyValue"
162
+ optional :noWait, :bool, 2
163
+ end
164
+ add_message "immudb.schema.KeyRequest" do
165
+ optional :key, :bytes, 1
166
+ optional :atTx, :uint64, 2
167
+ optional :sinceTx, :uint64, 3
168
+ end
169
+ add_message "immudb.schema.KeyListRequest" do
170
+ repeated :keys, :bytes, 1
171
+ optional :sinceTx, :uint64, 2
172
+ end
173
+ add_message "immudb.schema.VerifiableSetRequest" do
174
+ optional :setRequest, :message, 1, "immudb.schema.SetRequest"
175
+ optional :proveSinceTx, :uint64, 2
176
+ end
177
+ add_message "immudb.schema.VerifiableGetRequest" do
178
+ optional :keyRequest, :message, 1, "immudb.schema.KeyRequest"
179
+ optional :proveSinceTx, :uint64, 2
180
+ end
181
+ add_message "immudb.schema.HealthResponse" do
182
+ optional :status, :bool, 1
183
+ optional :version, :string, 2
184
+ end
185
+ add_message "immudb.schema.ImmutableState" do
186
+ optional :db, :string, 1
187
+ optional :txId, :uint64, 2
188
+ optional :txHash, :bytes, 3
189
+ optional :signature, :message, 4, "immudb.schema.Signature"
190
+ end
191
+ add_message "immudb.schema.ReferenceRequest" do
192
+ optional :key, :bytes, 1
193
+ optional :referencedKey, :bytes, 2
194
+ optional :atTx, :uint64, 3
195
+ optional :boundRef, :bool, 4
196
+ optional :noWait, :bool, 5
197
+ end
198
+ add_message "immudb.schema.VerifiableReferenceRequest" do
199
+ optional :referenceRequest, :message, 1, "immudb.schema.ReferenceRequest"
200
+ optional :proveSinceTx, :uint64, 2
201
+ end
202
+ add_message "immudb.schema.ZAddRequest" do
203
+ optional :set, :bytes, 1
204
+ optional :score, :double, 2
205
+ optional :key, :bytes, 3
206
+ optional :atTx, :uint64, 4
207
+ optional :boundRef, :bool, 5
208
+ optional :noWait, :bool, 6
209
+ end
210
+ add_message "immudb.schema.Score" do
211
+ optional :score, :double, 1
212
+ end
213
+ add_message "immudb.schema.ZScanRequest" do
214
+ optional :set, :bytes, 1
215
+ optional :seekKey, :bytes, 2
216
+ optional :seekScore, :double, 3
217
+ optional :seekAtTx, :uint64, 4
218
+ optional :inclusiveSeek, :bool, 5
219
+ optional :limit, :uint64, 6
220
+ optional :desc, :bool, 7
221
+ optional :minScore, :message, 8, "immudb.schema.Score"
222
+ optional :maxScore, :message, 9, "immudb.schema.Score"
223
+ optional :sinceTx, :uint64, 10
224
+ optional :noWait, :bool, 11
225
+ end
226
+ add_message "immudb.schema.HistoryRequest" do
227
+ optional :key, :bytes, 1
228
+ optional :offset, :uint64, 2
229
+ optional :limit, :int32, 3
230
+ optional :desc, :bool, 4
231
+ optional :sinceTx, :uint64, 5
232
+ end
233
+ add_message "immudb.schema.VerifiableZAddRequest" do
234
+ optional :zAddRequest, :message, 1, "immudb.schema.ZAddRequest"
235
+ optional :proveSinceTx, :uint64, 2
236
+ end
237
+ add_message "immudb.schema.TxRequest" do
238
+ optional :tx, :uint64, 1
239
+ end
240
+ add_message "immudb.schema.VerifiableTxRequest" do
241
+ optional :tx, :uint64, 1
242
+ optional :proveSinceTx, :uint64, 2
243
+ end
244
+ add_message "immudb.schema.TxScanRequest" do
245
+ optional :initialTx, :uint64, 1
246
+ optional :limit, :uint32, 2
247
+ optional :desc, :bool, 3
248
+ end
249
+ add_message "immudb.schema.TxList" do
250
+ repeated :txs, :message, 1, "immudb.schema.Tx"
251
+ end
252
+ add_message "immudb.schema.Database" do
253
+ optional :databaseName, :string, 1
254
+ end
255
+ add_message "immudb.schema.Table" do
256
+ optional :tableName, :string, 1
257
+ end
258
+ add_message "immudb.schema.SQLGetRequest" do
259
+ optional :table, :string, 1
260
+ optional :pkValue, :message, 2, "immudb.schema.SQLValue"
261
+ optional :atTx, :uint64, 3
262
+ optional :sinceTx, :uint64, 4
263
+ end
264
+ add_message "immudb.schema.VerifiableSQLGetRequest" do
265
+ optional :sqlGetRequest, :message, 1, "immudb.schema.SQLGetRequest"
266
+ optional :proveSinceTx, :uint64, 2
267
+ end
268
+ add_message "immudb.schema.SQLEntry" do
269
+ optional :tx, :uint64, 1
270
+ optional :key, :bytes, 2
271
+ optional :value, :bytes, 3
272
+ end
273
+ add_message "immudb.schema.VerifiableSQLEntry" do
274
+ optional :sqlEntry, :message, 1, "immudb.schema.SQLEntry"
275
+ optional :verifiableTx, :message, 2, "immudb.schema.VerifiableTx"
276
+ optional :inclusionProof, :message, 3, "immudb.schema.InclusionProof"
277
+ optional :DatabaseId, :uint64, 4
278
+ optional :TableId, :uint64, 5
279
+ optional :PKName, :string, 6
280
+ map :ColIdsById, :uint64, :string, 8
281
+ map :ColIdsByName, :string, :uint64, 9
282
+ map :ColTypesById, :uint64, :string, 10
283
+ end
284
+ add_message "immudb.schema.UseDatabaseReply" do
285
+ optional :token, :string, 1
286
+ end
287
+ add_message "immudb.schema.ChangePermissionRequest" do
288
+ optional :action, :enum, 1, "immudb.schema.PermissionAction"
289
+ optional :username, :string, 2
290
+ optional :database, :string, 3
291
+ optional :permission, :uint32, 4
292
+ end
293
+ add_message "immudb.schema.SetActiveUserRequest" do
294
+ optional :active, :bool, 1
295
+ optional :username, :string, 2
296
+ end
297
+ add_message "immudb.schema.DatabaseListResponse" do
298
+ repeated :databases, :message, 1, "immudb.schema.Database"
299
+ end
300
+ add_message "immudb.schema.Chunk" do
301
+ optional :content, :bytes, 1
302
+ end
303
+ add_message "immudb.schema.UseSnapshotRequest" do
304
+ optional :sinceTx, :uint64, 1
305
+ optional :asBeforeTx, :uint64, 2
306
+ end
307
+ add_message "immudb.schema.SQLExecRequest" do
308
+ optional :sql, :string, 1
309
+ repeated :params, :message, 2, "immudb.schema.NamedParam"
310
+ optional :noWait, :bool, 3
311
+ end
312
+ add_message "immudb.schema.SQLQueryRequest" do
313
+ optional :sql, :string, 1
314
+ repeated :params, :message, 2, "immudb.schema.NamedParam"
315
+ optional :reuseSnapshot, :bool, 3
316
+ end
317
+ add_message "immudb.schema.NamedParam" do
318
+ optional :name, :string, 1
319
+ optional :value, :message, 2, "immudb.schema.SQLValue"
320
+ end
321
+ add_message "immudb.schema.SQLExecResult" do
322
+ repeated :ctxs, :message, 1, "immudb.schema.TxMetadata"
323
+ repeated :dtxs, :message, 2, "immudb.schema.TxMetadata"
324
+ end
325
+ add_message "immudb.schema.SQLQueryResult" do
326
+ repeated :columns, :message, 2, "immudb.schema.Column"
327
+ repeated :rows, :message, 1, "immudb.schema.Row"
328
+ end
329
+ add_message "immudb.schema.Column" do
330
+ optional :name, :string, 1
331
+ optional :type, :string, 2
332
+ end
333
+ add_message "immudb.schema.Row" do
334
+ repeated :columns, :string, 1
335
+ repeated :values, :message, 2, "immudb.schema.SQLValue"
336
+ end
337
+ add_message "immudb.schema.SQLValue" do
338
+ oneof :value do
339
+ optional :null, :enum, 1, "google.protobuf.NullValue"
340
+ optional :n, :uint64, 2
341
+ optional :s, :string, 3
342
+ optional :b, :bool, 4
343
+ optional :bs, :bytes, 5
344
+ end
345
+ end
346
+ add_enum "immudb.schema.PermissionAction" do
347
+ value :GRANT, 0
348
+ value :REVOKE, 1
349
+ end
350
+ end
351
+ end
352
+
353
+ module Immudb
354
+ module Schema
355
+ Key = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Key").msgclass
356
+ Permission = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Permission").msgclass
357
+ User = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.User").msgclass
358
+ UserList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UserList").msgclass
359
+ CreateUserRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.CreateUserRequest").msgclass
360
+ UserRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UserRequest").msgclass
361
+ ChangePasswordRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ChangePasswordRequest").msgclass
362
+ LoginRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LoginRequest").msgclass
363
+ LoginResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LoginResponse").msgclass
364
+ AuthConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.AuthConfig").msgclass
365
+ MTLSConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.MTLSConfig").msgclass
366
+ KeyValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyValue").msgclass
367
+ Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Entry").msgclass
368
+ Reference = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Reference").msgclass
369
+ Op = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Op").msgclass
370
+ ExecAllRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ExecAllRequest").msgclass
371
+ Entries = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Entries").msgclass
372
+ ZEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZEntry").msgclass
373
+ ZEntries = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZEntries").msgclass
374
+ ScanRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ScanRequest").msgclass
375
+ KeyPrefix = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyPrefix").msgclass
376
+ EntryCount = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.EntryCount").msgclass
377
+ Signature = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Signature").msgclass
378
+ TxMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxMetadata").msgclass
379
+ LinearProof = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.LinearProof").msgclass
380
+ DualProof = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DualProof").msgclass
381
+ Tx = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Tx").msgclass
382
+ TxEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxEntry").msgclass
383
+ VerifiableTx = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableTx").msgclass
384
+ VerifiableEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableEntry").msgclass
385
+ InclusionProof = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.InclusionProof").msgclass
386
+ SetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SetRequest").msgclass
387
+ KeyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyRequest").msgclass
388
+ KeyListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.KeyListRequest").msgclass
389
+ VerifiableSetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableSetRequest").msgclass
390
+ VerifiableGetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableGetRequest").msgclass
391
+ HealthResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.HealthResponse").msgclass
392
+ ImmutableState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ImmutableState").msgclass
393
+ ReferenceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ReferenceRequest").msgclass
394
+ VerifiableReferenceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableReferenceRequest").msgclass
395
+ ZAddRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZAddRequest").msgclass
396
+ Score = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Score").msgclass
397
+ ZScanRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ZScanRequest").msgclass
398
+ HistoryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.HistoryRequest").msgclass
399
+ VerifiableZAddRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableZAddRequest").msgclass
400
+ TxRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxRequest").msgclass
401
+ VerifiableTxRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableTxRequest").msgclass
402
+ TxScanRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxScanRequest").msgclass
403
+ TxList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.TxList").msgclass
404
+ Database = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Database").msgclass
405
+ Table = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Table").msgclass
406
+ SQLGetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLGetRequest").msgclass
407
+ VerifiableSQLGetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableSQLGetRequest").msgclass
408
+ SQLEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLEntry").msgclass
409
+ VerifiableSQLEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.VerifiableSQLEntry").msgclass
410
+ UseDatabaseReply = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UseDatabaseReply").msgclass
411
+ ChangePermissionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.ChangePermissionRequest").msgclass
412
+ SetActiveUserRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SetActiveUserRequest").msgclass
413
+ DatabaseListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.DatabaseListResponse").msgclass
414
+ Chunk = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Chunk").msgclass
415
+ UseSnapshotRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.UseSnapshotRequest").msgclass
416
+ SQLExecRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLExecRequest").msgclass
417
+ SQLQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLQueryRequest").msgclass
418
+ NamedParam = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.NamedParam").msgclass
419
+ SQLExecResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLExecResult").msgclass
420
+ SQLQueryResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLQueryResult").msgclass
421
+ Column = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Column").msgclass
422
+ Row = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.Row").msgclass
423
+ SQLValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.SQLValue").msgclass
424
+ PermissionAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("immudb.schema.PermissionAction").enummodule
425
+ end
426
+ end
@@ -0,0 +1,89 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: schema.proto for package 'immudb.schema'
3
+ # Original file comments:
4
+ #
5
+ # Copyright 2021 CodeNotary, Inc. All rights reserved.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ require 'grpc'
21
+
22
+ module Immudb
23
+ module Schema
24
+ module ImmuService
25
+ # immudb gRPC & REST service
26
+ # IMPORTANT: All get and safeget functions return base64-encoded keys and values, while all set and safeset functions expect base64-encoded inputs.
27
+ class Service
28
+
29
+ include ::GRPC::GenericService
30
+
31
+ self.marshal_class_method = :encode
32
+ self.unmarshal_class_method = :decode
33
+ self.service_name = 'immudb.schema.ImmuService'
34
+
35
+ rpc :ListUsers, ::Google::Protobuf::Empty, ::Immudb::Schema::UserList
36
+ rpc :CreateUser, ::Immudb::Schema::CreateUserRequest, ::Google::Protobuf::Empty
37
+ rpc :ChangePassword, ::Immudb::Schema::ChangePasswordRequest, ::Google::Protobuf::Empty
38
+ rpc :UpdateAuthConfig, ::Immudb::Schema::AuthConfig, ::Google::Protobuf::Empty
39
+ rpc :UpdateMTLSConfig, ::Immudb::Schema::MTLSConfig, ::Google::Protobuf::Empty
40
+ rpc :Login, ::Immudb::Schema::LoginRequest, ::Immudb::Schema::LoginResponse
41
+ rpc :Logout, ::Google::Protobuf::Empty, ::Google::Protobuf::Empty
42
+ rpc :Set, ::Immudb::Schema::SetRequest, ::Immudb::Schema::TxMetadata
43
+ rpc :VerifiableSet, ::Immudb::Schema::VerifiableSetRequest, ::Immudb::Schema::VerifiableTx
44
+ rpc :Get, ::Immudb::Schema::KeyRequest, ::Immudb::Schema::Entry
45
+ rpc :VerifiableGet, ::Immudb::Schema::VerifiableGetRequest, ::Immudb::Schema::VerifiableEntry
46
+ rpc :GetAll, ::Immudb::Schema::KeyListRequest, ::Immudb::Schema::Entries
47
+ rpc :ExecAll, ::Immudb::Schema::ExecAllRequest, ::Immudb::Schema::TxMetadata
48
+ rpc :Scan, ::Immudb::Schema::ScanRequest, ::Immudb::Schema::Entries
49
+ rpc :Count, ::Immudb::Schema::KeyPrefix, ::Immudb::Schema::EntryCount
50
+ rpc :CountAll, ::Google::Protobuf::Empty, ::Immudb::Schema::EntryCount
51
+ rpc :TxById, ::Immudb::Schema::TxRequest, ::Immudb::Schema::Tx
52
+ rpc :VerifiableTxById, ::Immudb::Schema::VerifiableTxRequest, ::Immudb::Schema::VerifiableTx
53
+ rpc :TxScan, ::Immudb::Schema::TxScanRequest, ::Immudb::Schema::TxList
54
+ rpc :History, ::Immudb::Schema::HistoryRequest, ::Immudb::Schema::Entries
55
+ rpc :Health, ::Google::Protobuf::Empty, ::Immudb::Schema::HealthResponse
56
+ rpc :CurrentState, ::Google::Protobuf::Empty, ::Immudb::Schema::ImmutableState
57
+ rpc :SetReference, ::Immudb::Schema::ReferenceRequest, ::Immudb::Schema::TxMetadata
58
+ rpc :VerifiableSetReference, ::Immudb::Schema::VerifiableReferenceRequest, ::Immudb::Schema::VerifiableTx
59
+ rpc :ZAdd, ::Immudb::Schema::ZAddRequest, ::Immudb::Schema::TxMetadata
60
+ rpc :VerifiableZAdd, ::Immudb::Schema::VerifiableZAddRequest, ::Immudb::Schema::VerifiableTx
61
+ rpc :ZScan, ::Immudb::Schema::ZScanRequest, ::Immudb::Schema::ZEntries
62
+ rpc :CreateDatabase, ::Immudb::Schema::Database, ::Google::Protobuf::Empty
63
+ rpc :DatabaseList, ::Google::Protobuf::Empty, ::Immudb::Schema::DatabaseListResponse
64
+ rpc :UseDatabase, ::Immudb::Schema::Database, ::Immudb::Schema::UseDatabaseReply
65
+ rpc :CompactIndex, ::Google::Protobuf::Empty, ::Google::Protobuf::Empty
66
+ rpc :ChangePermission, ::Immudb::Schema::ChangePermissionRequest, ::Google::Protobuf::Empty
67
+ rpc :SetActiveUser, ::Immudb::Schema::SetActiveUserRequest, ::Google::Protobuf::Empty
68
+ # Streams
69
+ rpc :streamGet, ::Immudb::Schema::KeyRequest, stream(::Immudb::Schema::Chunk)
70
+ rpc :streamSet, stream(::Immudb::Schema::Chunk), ::Immudb::Schema::TxMetadata
71
+ rpc :streamVerifiableGet, ::Immudb::Schema::VerifiableGetRequest, stream(::Immudb::Schema::Chunk)
72
+ rpc :streamVerifiableSet, stream(::Immudb::Schema::Chunk), ::Immudb::Schema::VerifiableTx
73
+ rpc :streamScan, ::Immudb::Schema::ScanRequest, stream(::Immudb::Schema::Chunk)
74
+ rpc :streamZScan, ::Immudb::Schema::ZScanRequest, stream(::Immudb::Schema::Chunk)
75
+ rpc :streamHistory, ::Immudb::Schema::HistoryRequest, stream(::Immudb::Schema::Chunk)
76
+ rpc :streamExecAll, stream(::Immudb::Schema::Chunk), ::Immudb::Schema::TxMetadata
77
+ # SQL
78
+ rpc :UseSnapshot, ::Immudb::Schema::UseSnapshotRequest, ::Google::Protobuf::Empty
79
+ rpc :SQLExec, ::Immudb::Schema::SQLExecRequest, ::Immudb::Schema::SQLExecResult
80
+ rpc :SQLQuery, ::Immudb::Schema::SQLQueryRequest, ::Immudb::Schema::SQLQueryResult
81
+ rpc :ListTables, ::Google::Protobuf::Empty, ::Immudb::Schema::SQLQueryResult
82
+ rpc :DescribeTable, ::Immudb::Schema::Table, ::Immudb::Schema::SQLQueryResult
83
+ rpc :VerifiableSQLGet, ::Immudb::Schema::VerifiableSQLGetRequest, ::Immudb::Schema::VerifiableSQLEntry
84
+ end
85
+
86
+ Stub = Service.rpc_stub_class
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,120 @@
1
+ # Copyright 2021 CodeNotary, Inc. All rights reserved.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Immudb
14
+ class HTree
15
+ attr_reader :root
16
+
17
+ def initialize(max_width)
18
+ return if max_width < 1
19
+
20
+ @max_width = max_width
21
+ lw = 1
22
+ while lw < max_width
23
+ lw = lw << 1
24
+ end
25
+ height = (max_width - 1).bit_length + 1
26
+ @levels = [nil] * height
27
+ height.times do |l|
28
+ @levels[l] = [nil] * (lw >> l)
29
+ end
30
+ end
31
+
32
+ def build_with(digests)
33
+ if digests.length > @max_width
34
+ raise ArgumentError, "Max width exceeded"
35
+ end
36
+ if digests.length == 0
37
+ raise ArgumentError, "Illegal arguments"
38
+ end
39
+ digests.length.times do |i|
40
+ leaf = LEAF_PREFIX + digests[i]
41
+ @levels[0][i] = Digest::SHA256.digest(leaf)
42
+ end
43
+ l = 0
44
+ w = digests.length
45
+ while w > 1
46
+ wn = 0
47
+ i = 0
48
+ while i + 1 < w
49
+ b = NODE_PREFIX + @levels[l][i] + @levels[l][i + 1]
50
+ @levels[l + 1][wn] = Digest::SHA256.digest(b)
51
+ wn = wn + 1
52
+ i = i + 2
53
+ end
54
+ if w % 2 == 1
55
+ @levels[l + 1][wn] = @levels[l][w - 1]
56
+ wn = wn + 1
57
+ end
58
+ l += 1
59
+ w = wn
60
+ end
61
+ @width = digests.length
62
+ @root = @levels[l][0]
63
+ end
64
+
65
+ def inclusion_proof(i)
66
+ if i >= @width
67
+ raise ArgumentError, "Illegal arguments"
68
+ end
69
+ m = i
70
+ n = @width
71
+ offset = 0
72
+ proof = InclusionProof.new
73
+ proof.leaf = i
74
+ proof.width = @width
75
+ if @width == 1
76
+ return proof
77
+ end
78
+ loop do
79
+ d = (n - 1).bit_length
80
+ k = 1 << (d - 1)
81
+ if m < k
82
+ l, r = offset + k, offset + n - 1
83
+ n = k
84
+ else
85
+ l, r = offset, offset + k - 1
86
+ m = m - k
87
+ n = n - k
88
+ offset = offset + k
89
+ end
90
+ layer = (r - l).bit_length
91
+ index = (l / (1 << layer)).to_i
92
+ proof.terms = @levels[layer][index] + proof.terms
93
+ if n < 1 || (n == 1 && m == 0)
94
+ return proof
95
+ end
96
+ end
97
+ end
98
+
99
+ def self.inclusion_proof_from(iproof)
100
+ h = InclusionProof.new
101
+ h.leaf = iproof.leaf.to_i
102
+ h.width = iproof.width.to_i
103
+ h.terms = Store.digest_from(iproof.terms)
104
+ h
105
+ end
106
+
107
+ def self.dual_proof_from(dproof)
108
+ dp = DualProof.new
109
+ dp.sourceTxMetadata = Store.tx_metadata_from(dproof.sourceTxMetadata)
110
+ dp.targetTxMetadata = Store.tx_metadata_from(dproof.targetTxMetadata)
111
+ dp.inclusionProof = Store.digest_from(dproof.inclusionProof)
112
+ # use digests_from?
113
+ dp.consistencyProof = Store.digests_from(dproof.consistencyProof)
114
+ dp.targetBlTxAlh = Store.digest_from(dproof.targetBlTxAlh)
115
+ dp.lastInclusionProof = Store.digests_from(dproof.lastInclusionProof)
116
+ dp.linearProof = Store.linear_proof_from(dproof.linearProof)
117
+ dp
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,21 @@
1
+ # Copyright 2021 CodeNotary, Inc. All rights reserved.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Immudb
14
+ class InclusionProof
15
+ attr_accessor :leaf, :width, :terms
16
+
17
+ def initialize
18
+ @terms = []
19
+ end
20
+ end
21
+ end