Skip to content

Protocol Documentation

ImmuService

Here a list of services exposed by immudb GRPc interface

Database services

immudb gRPC & REST service IMPORTANT: All get and safeget functions return base64-encoded keys and values, while all set and safeset functions expect base64-encoded inputs.

Database operational services

Following methods grant the basic immudb capabilities. Set and Get are the primitive. SafeSet and SafeGet counterparts do the primitive job but in addition they produce also inclusion and consistency proofs.

Method NameRequest TypeResponse TypeDescription
SetKeyValueIndex
SafeSetSafeSetOptionsProof
GetKeyItem
SafeGetSafeGetOptionsSafeItem

Insertion order index services

Following methods rely on internal immudb insertion order index. Insertion order index is a special index appended on every leaf in the merkle tree. With this we benefit of the internal merkle tree natural insertion order index. When we retrieve elements by index a first lookup is made on the leaf at the same index to discover the element key, then a second lookup is realized to retrieve the value. BySafeIndex counterpart produces also the inclusion and consistency proofs.

Method NameRequest TypeResponse TypeDescription
ByIndexIndexItem
BySafeIndexSafeIndexOptionsSafeItem

Secondary indexes services

Thanks to the lexicographical order in which internal data is structured we exposed following methods. Reference is like a "tag" operation, it append a reference on a key. As a consequence when we retrieve that reference/key with a Get or SafeGet the value retrieved will be the original value associated to the original key. SafeReference counterpart is the same but in addition it produces also the inclusion and consistency proofs. ZAdd operates internally in a similar manner to Reference but it introduces the concept of set. Inside a set we can organize collection of similar elements. When we add an elements to a collection we can specify his score using a float value. In ZAdd It's possible to specify also the index of the reference. In this way if there are multiple equals keys it will be inserted in the set the specified version. To retrieve elements we can use Zscan methods with return elements sorted by their score. If elements are inserted with same score they are returned in a lexicographical order. SafeZAdd counterpart produces also the inclusion and consistency proofs.

Method NameRequest TypeResponse TypeDescription
ReferenceReferenceOptionsIndex
SafeReferenceSafeReferenceOptionsProof
ZAddZAddOptionsIndex
ZScanZScanOptionsItemList
SafeZAddSafeZAddOptionsProof

Tamperproofing services

Inclusion returns a path of nodes that can be used to prove that a node was correctly inserted inside the merkle tree. Consistency returns a path of nodes that can be used to prove that a subtree contained in the main merkle tree is still the same. CurrentRoot the last root of the tree. The suggest approach to detect malicious action is to use an SDK and safe* family methods.

Method NameRequest TypeResponse TypeDescription
InclusionIndexInclusionProof
ConsistencyIndexConsistencyProof
CurrentRoot.google.protobuf.EmptyRoot
Method NameRequest TypeResponse TypeDescription
IScanIScanOptionsPage
ScanScanOptionsItemList
CountKeyPrefixItemsCount
HistoryKeyItemList

Administrative services

Method NameRequest TypeResponse TypeDescription
Health.google.protobuf.EmptyHealthResponse
ListUsers.google.protobuf.EmptyUserList
CreateUserCreateUserRequestUserResponse
ChangePasswordChangePasswordRequest.google.protobuf.Empty
UpdateAuthConfigAuthConfig.google.protobuf.Empty
UpdateMTLSConfigMTLSConfig.google.protobuf.Empty
PrintTree.google.protobuf.EmptyTree
LoginLoginRequestLoginResponse
Logout.google.protobuf.Empty.google.protobuf.Empty
Dump.google.protobuf.Empty.pb.KVList stream
CreateDatabaseDatabaseCreateDatabaseReplytodo(joe-dz): Enable restore when the feature is required again rpc Restore(stream pb.KVList) returns (ItemsCount) { option (google.api.http) = { post: "/v1/immurestproxy/restore" body: "*" }; }
UseDatabaseDatabaseUseDatabaseReply
ChangePermissionChangePermissionRequestError
SetActiveUserSetActiveUserRequest.google.protobuf.Empty
DatabaseList.google.protobuf.EmptyDatabaseListResponse

Table of Contents

Top

schema.proto

AuthConfig

FieldTypeLabelDescription
kinduint32

ChangePasswordRequest

FieldTypeLabelDescription
userbytes
oldPasswordbytes
newPasswordbytes

ChangePermissionRequest

FieldTypeLabelDescription
actionPermissionAction
usernamestring
databasestring
permissionuint32

ConsistencyProof

FieldTypeLabelDescription
firstuint64
seconduint64
firstRootbytes
secondRootbytes
pathbytesrepeated

Content

FieldTypeLabelDescription
timestampuint64
payloadbytes

CreateDatabaseReply

FieldTypeLabelDescription
errorError

CreateUserRequest

FieldTypeLabelDescription
userbytes
passwordbytes
permissionuint32
databasestring

Database

FieldTypeLabelDescription
databasenamestring

DatabaseListResponse

FieldTypeLabelDescription
databasesDatabaserepeated

Error

FieldTypeLabelDescription
errorcodeErrorCodes
errormessagestring

HealthResponse

FieldTypeLabelDescription
statusbool
versionstring

IScanOptions

FieldTypeLabelDescription
pageSizeuint64
pageNumberuint64

InclusionProof

FieldTypeLabelDescription
atuint64
indexuint64
rootbytes
leafbytes
pathbytesrepeated

Index

FieldTypeLabelDescription
indexuint64

Item

FieldTypeLabelDescription
keybytes
valuebytes
indexuint64

ItemList

FieldTypeLabelDescription
itemsItemrepeated

ItemsCount

FieldTypeLabelDescription
countuint64

KVList

FieldTypeLabelDescription
KVsKeyValuerepeated

Key

FieldTypeLabelDescription
keybytes

KeyList

FieldTypeLabelDescription
keysKeyrepeated

KeyPrefix

FieldTypeLabelDescription
prefixbytes

KeyValue

FieldTypeLabelDescription
keybytes
valuebytes

Layer

FieldTypeLabelDescription
lNoderepeated

LoginRequest

FieldTypeLabelDescription
userbytes
passwordbytes

LoginResponse

FieldTypeLabelDescription
tokenbytes
warningbytes

MTLSConfig

FieldTypeLabelDescription
enabledbool

Node

FieldTypeLabelDescription
ibytes
hbytes
refkbytes
refbool
cachebool
rootbool

Page

FieldTypeLabelDescription
itemsItemrepeated
morebool

Permission

FieldTypeLabelDescription
databasestring
permissionuint32

Proof

FieldTypeLabelDescription
leafbytes
indexuint64
rootbytes
atuint64
inclusionPathbytesrepeated
consistencyPathbytesrepeated

ReferenceOptions

FieldTypeLabelDescription
referencebytes
keybytes

Root

FieldTypeLabelDescription
indexuint64
rootbytes

SKVList

FieldTypeLabelDescription
SKVsStructuredKeyValuerepeated

SPage

FieldTypeLabelDescription
itemsStructuredItemrepeated
pageNumuint64
morebool

SafeGetOptions

FieldTypeLabelDescription
keybytes
rootIndexIndex

SafeIndexOptions

FieldTypeLabelDescription
indexuint64
rootIndexIndex

SafeItem

FieldTypeLabelDescription
itemItem
proofProof

SafeReferenceOptions

FieldTypeLabelDescription
roReferenceOptions
rootIndexIndex

SafeSetOptions

FieldTypeLabelDescription
kvKeyValue
rootIndexIndex

SafeSetSVOptions

FieldTypeLabelDescription
skvStructuredKeyValue
rootIndexIndex

SafeStructuredItem

FieldTypeLabelDescription
itemStructuredItem
proofProof

SafeZAddOptions

FieldTypeLabelDescription
zoptsZAddOptions
rootIndexIndex

ScanOptions

FieldTypeLabelDescription
prefixbytes
offsetbytes
limituint64
reversebool
deepbool

SetActiveUserRequest

FieldTypeLabelDescription
activebool
usernamestring

StructuredItem

FieldTypeLabelDescription
keybytes
valueContent
indexuint64

StructuredItemList

FieldTypeLabelDescription
itemsStructuredItemrepeated

StructuredKeyValue

FieldTypeLabelDescription
keybytes
valueContent

Tree

FieldTypeLabelDescription
tLayerrepeated

UseDatabaseReply

FieldTypeLabelDescription
errorError
tokenstring

User

FieldTypeLabelDescription
userbytes
permissionuint32
permissionsPermissionrepeated
createdbystring
createdatstring
activebool

UserList

FieldTypeLabelDescription
usersUserrepeated

UserRequest

FieldTypeLabelDescription
userbytes

UserResponse

FieldTypeLabelDescription
userbytes
permissionuint32

ZAddOptions

FieldTypeLabelDescription
setbytes
scoredouble
keybytes

ZScanOptions

FieldTypeLabelDescription
setbytes
offsetbytes
limituint64
reversebool

ErrorCodes

NameNumberDescription
Ok0
ERROR_SELECTING_DATABASE1
ERROR_NO_PERMISSION_FOR_THIS_DATABASE2
ERROR_USER_HAS_NOT_LOGGED_IN3
ERROR_DB_DOES_NOT_EXIST4

PermissionAction

NameNumberDescription
GRANT0
REVOKE1

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)

Released under the Apache 2.0 License.