-
Notifications
You must be signed in to change notification settings - Fork 345
/
Copy pathschema.proto
2015 lines (1527 loc) · 47.3 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright 2022 Codenotary Inc. All rights reserved.
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";
package immudb.schema;
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
import "protoc-gen-swagger/options/annotations.proto";
option go_package = "github.com/codenotary/immudb/pkg/api/schema";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
base_path: "/api",
info: {
title: "immudb REST API";
description: "<b>IMPORTANT</b>: All <code>get</code> and <code>safeget</code> functions return <u>base64-encoded</u> keys and values, while all <code>set</code> and <code>safeset</code> functions expect <u>base64-encoded</u> inputs."
};
security_definitions: {
security: {
key: "bearer"
value: {
type: TYPE_API_KEY
in: IN_HEADER
name: "Authorization"
description: "Authentication token, prefixed by Bearer: Bearer <token>"
}
}
}
security: {
security_requirement: {
key: "bearer"
}
}
};
message Key {
bytes key = 1;
}
message Permission {
// Database name
string database = 1;
// Permission, 1 - read permission, 2 - read+write permission, 254 - admin, 255 - sysadmin
uint32 permission = 2;
}
message User {
// Username
bytes user = 1;
// List of permissions for the user
repeated Permission permissions = 3;
// Name of the creator user
string createdby = 4;
// Time when the user was created
string createdat = 5;
// Flag indicating whether the user is active or not
bool active = 6;
// List of SQL privileges
repeated SQLPrivilege sqlPrivileges = 7;
}
message SQLPrivilege {
// Database name
string database = 1;
// Privilege: SELECT, CREATE, INSERT, UPDATE, DELETE, DROP, ALTER
string privilege = 2;
}
message UserList {
// List of users
repeated User users = 1;
}
message CreateUserRequest {
// Username
bytes user = 1;
// Login password
bytes password = 2;
// Permission, 1 - read permission, 2 - read+write permission, 254 - admin
uint32 permission = 3;
// Database name
string database = 4;
}
message UserRequest {
// Username
bytes user = 1;
}
message ChangePasswordRequest {
// Username
bytes user = 1;
// Old password
bytes oldPassword = 2;
// New password
bytes newPassword = 3;
}
message LoginRequest {
// Username
bytes user = 1;
// User's password
bytes password = 2;
}
message LoginResponse {
// Deprecated: use session-based authentication
string token = 1;
// Optional: additional warning message sent to the user (e.g. request to change the password)
bytes warning = 2;
}
// DEPRECATED
message AuthConfig {
uint32 kind = 1;
}
// DEPRECATED
message MTLSConfig {
bool enabled = 1;
}
message OpenSessionRequest {
// Username
bytes username = 1;
// Password
bytes password = 2;
// Database name
string databaseName = 3;
}
message OpenSessionResponse {
// Id of the new session
string sessionID = 1;
// UUID of the server
string serverUUID = 2;
}
////////////////////////////////////////////////////////
message Precondition {
// Only succeed if given key exists
message KeyMustExistPrecondition {
// key to check
bytes key = 1;
}
// Only succeed if given key does not exists
message KeyMustNotExistPrecondition {
// key to check
bytes key = 1;
}
// Only succeed if given key was not modified after given transaction
message KeyNotModifiedAfterTXPrecondition {
// key to check
bytes key = 1;
// transaction id to check against
uint64 txID = 2;
}
oneof precondition {
KeyMustExistPrecondition keyMustExist = 1;
KeyMustNotExistPrecondition keyMustNotExist = 2;
KeyNotModifiedAfterTXPrecondition keyNotModifiedAfterTX = 3;
}
}
message KeyValue {
bytes key = 1;
bytes value = 2;
KVMetadata metadata = 3;
}
message Entry {
// Transaction id at which the target value was set (i.e. not the reference transaction id)
uint64 tx = 1;
// Key of the target value (i.e. not the reference entry)
bytes key = 2;
// Value
bytes value = 3;
// If the request was for a reference, this field will keep information about the reference entry
Reference referencedBy = 4;
// Metadata of the target entry (i.e. not the reference entry)
KVMetadata metadata = 5;
// If set to true, this entry has expired and the value is not retrieved
bool expired = 6;
// Key's revision, in case of GetAt it will be 0
uint64 revision = 7;
}
message Reference {
// Transaction if when the reference key was set
uint64 tx = 1;
// Reference key
bytes key = 2;
// At which transaction the key is bound, 0 if reference is not bound and should read the most recent reference
uint64 atTx = 3;
// Metadata of the reference entry
KVMetadata metadata = 4;
// Revision of the reference entry
uint64 revision = 5;
}
message Op {
oneof operation {
// Modify / add simple KV value
KeyValue kv = 1;
// Modify / add sorted set entry
ZAddRequest zAdd = 2;
// Modify / add reference
ReferenceRequest ref = 3;
}
}
message ExecAllRequest {
// List of operations to perform
repeated Op Operations = 1;
// If set to true, do not wait for indexing to process this transaction
bool noWait = 2;
// Preconditions to check
repeated Precondition preconditions = 3;
}
message Entries {
// List of entries
repeated Entry entries = 1;
}
message ZEntry {
// Name of the sorted set
bytes set = 1;
// Referenced key
bytes key = 2;
// Referenced entry
Entry entry = 3;
// Sorted set element's score
double score = 4;
// At which transaction the key is bound,
// 0 if reference is not bound and should read the most recent reference
uint64 atTx = 5;
}
message ZEntries {
repeated ZEntry entries = 1;
}
message ScanRequest {
// If not empty, continue scan at (when inclusiveSeek == true)
// or after (when inclusiveSeek == false) that key
bytes seekKey = 1;
// stop at (when inclusiveEnd == true)
// or before (when inclusiveEnd == false) that key
bytes endKey = 7;
// search for entries with this prefix only
bytes prefix = 2;
// If set to true, sort items in descending order
bool desc = 3;
// maximum number of entries to get, if not specified, the default value is used
uint64 limit = 4;
// If non-zero, only require transactions up to this transaction to be
// indexed, newer transaction may still be pending
uint64 sinceTx = 5;
// Deprecated: If set to true, do not wait for indexing to be done before finishing this call
bool noWait = 6;
// If set to true, results will include seekKey
bool inclusiveSeek = 8;
// If set to true, results will include endKey if needed
bool inclusiveEnd = 9;
// Specify the initial entry to be returned by excluding the initial set of entries
uint64 offset = 10;
}
message KeyPrefix {
bytes prefix = 1;
}
message EntryCount {
uint64 count = 1;
}
///////////////
message Signature {
bytes publicKey = 1;
bytes signature = 2;
}
message TxHeader {
// Transaction ID
uint64 id = 1;
// State value (Accumulative Hash - Alh) of the previous transaction
bytes prevAlh = 2;
// Unix timestamp of the transaction (in seconds)
int64 ts = 3;
// Number of entries in a transaction
int32 nentries = 4;
// Entries Hash - cumulative hash of all entries in the transaction
bytes eH = 5;
// Binary linking tree transaction ID
// (ID of last transaction already in the main Merkle Tree)
uint64 blTxId = 6;
// Binary linking tree root (Root hash of the Merkle Tree)
bytes blRoot = 7;
// Header version
int32 version = 8;
// Transaction metadata
TxMetadata metadata = 9;
}
// TxMetadata contains metadata set to whole transaction
message TxMetadata {
// Entry expiration information
uint64 truncatedTxID = 1;
// Extra data
bytes extra = 2;
}
// LinearProof contains the linear part of the proof (outside the main Merkle Tree)
message LinearProof {
// Starting transaction of the proof
uint64 sourceTxId = 1;
// End transaction of the proof
uint64 TargetTxId = 2;
// List of terms (inner hashes of transaction entries)
repeated bytes terms = 3;
}
// LinearAdvanceProof contains the proof of consistency between the consumed part of the older linear chain
// and the new Merkle Tree
message LinearAdvanceProof {
// terms for the linear chain
repeated bytes linearProofTerms = 1;
// inclusion proofs for steps on the linear chain
repeated InclusionProof inclusionProofs = 2;
}
// DualProof contains inclusion and consistency proofs for dual Merkle-Tree + Linear proofs
message DualProof {
// Header of the source (earlier) transaction
TxHeader sourceTxHeader = 1;
// Header of the target (latter) transaction
TxHeader targetTxHeader = 2;
// Inclusion proof of the source transaction hash in the main Merkle Tree
repeated bytes inclusionProof = 3;
// Consistency proof between Merkle Trees in the source and target transactions
repeated bytes consistencyProof = 4;
// Accumulative hash (Alh) of the last transaction that's part of the target Merkle Tree
bytes targetBlTxAlh = 5;
// Inclusion proof of the targetBlTxAlh in the target Merkle Tree
repeated bytes lastInclusionProof = 6;
// Linear proof starting from targetBlTxAlh to the final state value
LinearProof linearProof = 7;
// Proof of consistency between some part of older linear chain and newer Merkle Tree
LinearAdvanceProof LinearAdvanceProof = 8;
}
// DualProofV2 contains inclusion and consistency proofs
message DualProofV2 {
// Header of the source (earlier) transaction
TxHeader sourceTxHeader = 1;
// Header of the target (latter) transaction
TxHeader targetTxHeader = 2;
// Inclusion proof of the source transaction hash in the main Merkle Tree
repeated bytes inclusionProof = 3;
// Consistency proof between Merkle Trees in the source and target transactions
repeated bytes consistencyProof = 4;
}
message Tx {
// Transaction header
TxHeader header = 1;
// Raw entry values
repeated TxEntry entries = 2;
// KV entries in the transaction (parsed)
repeated Entry kvEntries = 3;
// Sorted Set entries in the transaction (parsed)
repeated ZEntry zEntries = 4;
}
message TxEntry {
// Raw key value (contains 1-byte prefix for kind of the key)
bytes key = 1;
// Value hash
bytes hValue = 2;
// Value length
int32 vLen = 3;
// Entry metadata
KVMetadata metadata = 4;
// value, must be ignored when len(value) == 0 and vLen > 0.
// Otherwise sha256(value) must be equal to hValue.
bytes value = 5;
}
message KVMetadata {
// True if this entry denotes a logical deletion
bool deleted = 1;
// Entry expiration information
Expiration expiration = 2;
// If set to true, this entry will not be indexed and will only be accessed through GetAt calls
bool nonIndexable = 3;
}
message Expiration {
// Entry expiration time (unix timestamp in seconds)
int64 expiresAt = 1;
}
message VerifiableTx {
// Transaction to verify
Tx tx = 1;
// Proof for the transaction
DualProof dualProof = 2;
// Signature for the new state value
Signature signature = 3;
}
message VerifiableTxV2 {
// Transaction to verify
Tx tx = 1;
// Proof for the transaction
DualProofV2 dualProof = 2;
// Signature for the new state value
Signature signature = 3;
}
//////////////////
message VerifiableEntry {
// Entry to verify
Entry entry = 1;
// Transaction to verify
VerifiableTx verifiableTx = 2;
// Proof for inclusion of the entry within the transaction
InclusionProof inclusionProof = 3;
}
message InclusionProof {
// Index of the leaf for which the proof is generated
int32 leaf = 1;
// Width of the tree at the leaf level
int32 width = 2;
// Proof terms (selected hashes from the tree)
repeated bytes terms = 3;
}
message SetRequest {
// List of KV entries to set
repeated KeyValue KVs = 1;
// If set to true, do not wait for indexer to index ne entries
bool noWait = 2;
// Preconditions to be met to perform the write
repeated Precondition preconditions = 3;
}
message KeyRequest {
// Key to query for
bytes key = 1;
// If > 0, query for the value exactly at given transaction
uint64 atTx = 2;
// If 0 (and noWait=false), wait for the index to be up-to-date,
// If > 0 (and noWait=false), wait for at lest the sinceTx transaction to be indexed
uint64 sinceTx = 3;
// If set to true - do not wait for any indexing update considering only the currently indexed state
bool noWait = 4;
// If > 0, get the nth version of the value, 1 being the first version, 2 being the second and so on
// If < 0, get the historical nth value of the key, -1 being the previous version, -2 being the one before and so on
int64 atRevision = 5;
}
message KeyListRequest {
// List of keys to query for
repeated bytes keys = 1;
// If 0, wait for index to be up-to-date,
// If > 0, wait for at least sinceTx transaction to be indexed
uint64 sinceTx = 2;
}
message DeleteKeysRequest {
// List of keys to delete logically
repeated bytes keys = 1;
// If 0, wait for index to be up-to-date,
// If > 0, wait for at least sinceTx transaction to be indexed
uint64 sinceTx = 2;
// If set to true, do not wait for the indexer to index this operation
bool noWait = 3;
}
message VerifiableSetRequest {
// Keys to set
SetRequest setRequest = 1;
// When generating the proof, generate consistency proof with state from this transaction
uint64 proveSinceTx = 2;
}
message VerifiableGetRequest {
// Key to read
KeyRequest keyRequest = 1;
// When generating the proof, generate consistency proof with state from this transaction
uint64 proveSinceTx = 2;
}
// ServerInfoRequest exists to provide extensibility for rpc ServerInfo.
message ServerInfoRequest {}
// ServerInfoResponse contains information about the server instance.
message ServerInfoResponse {
// The version of the server instance.
string version = 1;
// Unix timestamp (seconds) indicating when the server process has been started.
int64 startedAt = 2;
// Total number of transactions across all databases.
int64 numTransactions = 3;
// Total number of databases present.
int32 numDatabases = 4;
// Total disk size used by all databases.
int64 databasesDiskSize = 5;
}
message HealthResponse {
// If true, server considers itself to be healthy
bool status = 1;
// The version of the server instance
string version = 2;
}
message DatabaseHealthResponse {
// Number of requests currently being executed
uint32 pendingRequests = 1;
// Timestamp at which the last request was completed
int64 lastRequestCompletedAt = 2;
}
message ImmutableState {
// The db name
string db = 1;
// Id of the most recent transaction
uint64 txId = 2;
// State of the most recent transaction
bytes txHash = 3;
// Signature of the hash
Signature signature = 4;
// following fields are not part of the signature
// Id of the most recent precommitted transaction
uint64 precommittedTxId = 5;
// State of the most recent precommitted transaction
bytes precommittedTxHash = 6;
}
message ReferenceRequest {
// Key for the reference
bytes key = 1;
// Key to be referenced
bytes referencedKey = 2;
// If boundRef == true, id of transaction to bind with the reference
uint64 atTx = 3;
// If true, bind the reference to particular transaction,
// if false, use the most recent value of the key
bool boundRef = 4;
// If true, do not wait for the indexer to index this write operation
bool noWait = 5;
// Preconditions to be met to perform the write
repeated Precondition preconditions = 6;
}
message VerifiableReferenceRequest {
// Reference data
ReferenceRequest referenceRequest = 1;
// When generating the proof, generate consistency proof with state from this
// transaction
uint64 proveSinceTx = 2;
}
message ZAddRequest {
// Name of the sorted set
bytes set = 1;
// Score of the new entry
double score = 2;
// Referenced key
bytes key = 3;
// If boundRef == true, id of the transaction to bind with the reference
uint64 atTx = 4;
// If true, bind the reference to particular transaction, if false, use the
// most recent value of the key
bool boundRef = 5;
// If true, do not wait for the indexer to index this write operation
bool noWait = 6;
}
message Score {
// Entry's score value
double score = 1;
}
message ZScanRequest {
// Name of the sorted set
bytes set = 1;
// Key to continue the search at
bytes seekKey = 2;
// Score of the entry to continue the search at
double seekScore = 3;
// AtTx of the entry to continue the search at
uint64 seekAtTx = 4;
// If true, include the entry given with the `seekXXX` attributes, if false,
// skip the entry and start after that one
bool inclusiveSeek = 5;
// Maximum number of entries to return, if 0, the default limit will be used
uint64 limit = 6;
// If true, scan entries in descending order
bool desc = 7;
// Minimum score of entries to scan
Score minScore = 8;
// Maximum score of entries to scan
Score maxScore = 9;
// If > 0, do not wait for the indexer to index all entries, only require
// entries up to sinceTx to be indexed
uint64 sinceTx = 10;
// Deprecated: If set to true, do not wait for the indexer to be up to date
bool noWait = 11;
// Specify the index of initial entry to be returned by excluding the initial
// set of entries (alternative to seekXXX attributes)
uint64 offset = 12;
}
message HistoryRequest {
// Name of the key to query for the history
bytes key = 1;
// Specify the initial entry to be returned by excluding the initial set of
// entries
uint64 offset = 2;
// Maximum number of entries to return
int32 limit = 3;
// If true, search in descending order
bool desc = 4;
// If > 0, do not wait for the indexer to index all entries, only require
// entries up to sinceTx to be indexed
uint64 sinceTx = 5;
}
message VerifiableZAddRequest {
// Data for new sorted set entry
ZAddRequest zAddRequest = 1;
// When generating the proof, generate consistency proof with state from this transaction
uint64 proveSinceTx = 2;
}
message TxRequest {
// Transaction id to query for
uint64 tx = 1;
// Specification for parsing entries, if empty, entries are returned in raw form
EntriesSpec entriesSpec = 2;
// If > 0, do not wait for the indexer to index all entries, only require
// entries up to sinceTx to be indexed, will affect resolving references
uint64 sinceTx = 3;
// Deprecated: If set to true, do not wait for the indexer to be up to date
bool noWait = 4;
// If set to true, do not resolve references (avoid looking up final values if not needed)
bool keepReferencesUnresolved = 5;
}
message EntriesSpec {
// Specification for parsing KV entries
EntryTypeSpec kvEntriesSpec = 1;
// Specification for parsing sorted set entries
EntryTypeSpec zEntriesSpec = 2;
// Specification for parsing SQL entries
EntryTypeSpec sqlEntriesSpec = 3;
}
message EntryTypeSpec {
// Action to perform on entries
EntryTypeAction action = 1;
}
enum EntryTypeAction {
// Exclude entries from the result
EXCLUDE = 0;
// Provide keys in raw (unparsed) form and only the digest of the value
ONLY_DIGEST = 1;
// Provide keys and values in raw form
RAW_VALUE = 2;
// Provide parsed keys and values and resolve values if needed
RESOLVE = 3;
}
message VerifiableTxRequest {
// Transaction ID
uint64 tx = 1;
// When generating the proof, generate consistency proof with state from this
// transaction
uint64 proveSinceTx = 2;
// Specification of how to parse entries
EntriesSpec entriesSpec = 3;
// If > 0, do not wait for the indexer to index all entries, only require
// entries up to sinceTx to be indexed, will affect resolving references
uint64 sinceTx = 4;
// Deprecated: If set to true, do not wait for the indexer to be up to date
bool noWait = 5;
// If set to true, do not resolve references (avoid looking up final values if not needed)
bool keepReferencesUnresolved = 6;
}
message TxScanRequest {
// ID of the transaction where scanning should start
uint64 initialTx = 1;
// Maximum number of transactions to scan, when not specified the default limit is used
uint32 limit = 2;
// If set to true, scan transactions in descending order
bool desc = 3;
// Specification of how to parse entries
EntriesSpec entriesSpec = 4;
// If > 0, do not wait for the indexer to index all entries, only require
// entries up to sinceTx to be indexed, will affect resolving references
uint64 sinceTx = 5;
// Deprecated: If set to true, do not wait for the indexer to be up to date
bool noWait = 6;
}
message TxList {
// List of transactions
repeated Tx txs = 1;
}
message ExportTxRequest {
// Id of transaction to export
uint64 tx = 1;
// If set to true, non-committed transactions can be exported
bool allowPreCommitted = 2;
// Used on synchronous replication to notify the primary about replica state
ReplicaState replicaState = 3;
// If set to true, integrity checks are skipped when reading data
bool skipIntegrityCheck = 4;
}
message ReplicaState {
string UUID = 1;
uint64 committedTxID = 2;
bytes committedAlh = 3;
uint64 precommittedTxID = 4;
bytes precommittedAlh = 5;
}
message Database {
// Name of the database
string databaseName = 1;
}
message DatabaseSettings {
// Name of the database
string databaseName = 1;
// If set to true, this database is replicating another database
bool replica = 2;
// Name of the database to replicate
string primaryDatabase = 3;
// Hostname of the immudb instance with database to replicate
string primaryHost = 4;
// Port of the immudb instance with database to replicate
uint32 primaryPort = 5;
// Username of the user with read access of the database to replicate
string primaryUsername = 6;
// Password of the user with read access of the database to replicate
string primaryPassword = 7;
// Size of files stored on disk
uint32 fileSize = 8;
// Maximum length of keys
uint32 maxKeyLen = 9;
// Maximum length of values
uint32 maxValueLen = 10;
// Maximum number of entries in a single transaction
uint32 maxTxEntries = 11;
// If set to true, do not include commit timestamp in transaction headers
bool excludeCommitTime = 12;
}
message CreateDatabaseRequest {
// Database name
string name = 1;
// Database settings
DatabaseNullableSettings settings = 2;
// If set to true, do not fail if the database already exists
bool ifNotExists = 3;
}
message CreateDatabaseResponse {
// Database name
string name = 1;
// Current database settings
DatabaseNullableSettings settings = 2;
// Set to true if given database already existed
bool alreadyExisted = 3;
}
message UpdateDatabaseRequest {
// Database name
string database = 1;
// Updated settings
DatabaseNullableSettings settings = 2;
}
// Reserved to reply with more advanced response later
message UpdateDatabaseResponse {
// Database name
string database = 1;
// Current database settings
DatabaseNullableSettings settings = 2;
}
message DatabaseSettingsRequest {}
message DatabaseSettingsResponse {
// Database name
string database = 1;
// Database settings
DatabaseNullableSettings settings = 2;
}