Armada KVArmada KV
/vmain

gRPC API Reference

armada.proto

Service: Cluster

Cluster service ops.

MethodRequestResponseDescription
MemberListMemberListRequestMemberListResponseMemberList lists all the members in the cluster.
StatusStatusRequestStatusResponseStatus gets the status of the member.

Service: KV

KV for handling the read/put requests

MethodRequestResponseDescription
RangeRangeRequestRangeResponseRange gets the keys in the range from the key-value store.
IterateRangeRangeRequestRangeResponseIterateRange gets the keys in the range from the key-value store.
PutPutRequestPutResponsePut puts the given key into the key-value store.
DeleteRangeDeleteRangeRequestDeleteRangeResponseDeleteRange deletes the given range from the key-value store.
TxnTxnRequestTxnResponseTxn processes multiple requests in a single transaction. A txn request increments the revision of the key-value store and generates events with the same revision for every completed request. It is allowed to modify the same key several times within one txn (the result will be the last Op that modified the key).

Service: Tables

API for managing tables.

MethodRequestResponseDescription
CreateCreateTableRequestCreateTableResponseCreate a table. All followers will automatically replicate the table. This procedure is available only in the leader cluster.
DeleteDeleteTableRequestDeleteTableResponseDelete a table. All followers will automatically delete the table. This procedure is available only in the leader cluster.
ListListTablesRequestListTablesResponseGet names of all the tables present in the cluster. This procedure is available in both leader and follower clusters.

CreateTableRequest {#createtablerequest}

CreateTableRequest describes the table to be created.

FieldTypeLabelDescription
namestringName of the table to be created.
configgoogle.protobuf.Structconfig the table configuration values.

CreateTableResponse {#createtableresponse}

CreateTableResponse describes the newly created table.

FieldTypeLabelDescription
idstringid the created table.

DeleteRangeRequest {#deleterangerequest}

FieldTypeLabelDescription
tablebytestable name of the table
keybyteskey is the first key to delete in the range.
range_endbytesrange_end is the key following the last key to delete for the range [key, range_end). If range_end is not given, the range is defined to contain only the key argument. If range_end is one bit larger than the given key, then the range is all the keys with the prefix (the given key). If range_end is '\0', the range is all keys greater than or equal to the key argument.
prev_kvboolIf prev_kv is set, regatta gets the previous key-value pairs before deleting it. The previous key-value pairs will be returned in the delete response. Beware that getting previous records could have serious performance impact on a delete range spanning a large dataset.
countboolIf count is set, regatta gets the count of previous key-value pairs before deleting it. The deleted field will be set to number of deleted key-value pairs in the response. Beware that counting records could have serious performance impact on a delete range spanning a large dataset.

DeleteRangeResponse {#deleterangeresponse}

FieldTypeLabelDescription
headerResponseHeader
deletedint64deleted is the number of keys deleted by the delete range request.
prev_kvsmvcc.v1.KeyValuerepeatedif prev_kv is set in the request, the previous key-value pairs will be returned.

DeleteTableRequest {#deletetablerequest}

DeleteTableRequest describes the table to be deleted.

FieldTypeLabelDescription
namestringname of the table to be deleted.

DeleteTableResponse {#deletetableresponse}

DeleteTableResponse when the table was successfully deleted.

ListTablesRequest {#listtablesrequest}

ListTablesRequest requests the list of currently registered tables.

ListTablesResponse {#listtablesresponse}

FollowerGetTablesResponse contains information about tables stored in the cluster.

FieldTypeLabelDescription
tablesTableInforepeated

Member {#member}

FieldTypeLabelDescription
idstringid is the member ID of this member.
namestringname is the human-readable name of the member. If the member is not started, the name will be an empty string.
peerURLsstringrepeatedpeerURLs is the list of URLs the member exposes to the cluster for communication.
clientURLsstringrepeatedclientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.

MemberListRequest {#memberlistrequest}

MemberListResponse {#memberlistresponse}

FieldTypeLabelDescription
clusterstringcluster is a name of the cluster.
membersMemberrepeatedmembers is a list of all members associated with the cluster.

PutRequest {#putrequest}

FieldTypeLabelDescription
tablebytestable name of the table
keybyteskey is the key, in bytes, to put into the key-value store.
valuebytesvalue is the value, in bytes, to associate with the key in the key-value store.
prev_kvboolprev_kv if true the previous key-value pair will be returned in the put response.

PutResponse {#putresponse}

FieldTypeLabelDescription
headerResponseHeader
prev_kvmvcc.v1.KeyValueif prev_kv is set in the request, the previous key-value pair will be returned.

RangeRequest {#rangerequest}

FieldTypeLabelDescription
tablebytestable name of the table
keybyteskey is the first key for the range. If range_end is not given, the request only looks up key.
range_endbytesrange_end is the upper bound on the requested range [key, range_end). If range_end is '\0', the range is all keys >= key. If range_end is key plus one (e.g., "aa"+1 == "ab", "a\xff"+1 == "b"), then the range request gets all keys prefixed with key. If both key and range_end are '\0', then the range request returns all keys.
limitint64limit is a limit on the number of keys returned for the request. When limit is set to 0, it is treated as no limit.
linearizableboollinearizable sets the range request to use linearizable read. Linearizable requests have higher latency and lower throughput than serializable requests but reflect the current consensus of the cluster. For better performance, in exchange for possible stale reads, a serializable range request is served locally without needing to reach consensus with other nodes in the cluster. The serializable request is default option.
keys_onlyboolkeys_only when set returns only the keys and not the values.
count_onlyboolcount_only when set returns only the count of the keys in the range.
min_mod_revisionint64min_mod_revision is the lower bound for returned key mod revisions; all keys with lesser mod revisions will be filtered away.
max_mod_revisionint64max_mod_revision is the upper bound for returned key mod revisions; all keys with greater mod revisions will be filtered away.
min_create_revisionint64min_create_revision is the lower bound for returned key create revisions; all keys with lesser create revisions will be filtered away.
max_create_revisionint64max_create_revision is the upper bound for returned key create revisions; all keys with greater create revisions will be filtered away.

RangeResponse {#rangeresponse}

FieldTypeLabelDescription
headerResponseHeader
kvsmvcc.v1.KeyValuerepeatedkvs is the list of key-value pairs matched by the range request. kvs is empty when count is requested.
moreboolmore indicates if there are more keys to return in the requested range.
countint64count is set to the number of keys within the range when requested.

ResponseHeader {#responseheader}

FieldTypeLabelDescription
shard_iduint64shard_id is the ID of the shard which sent the response.
replica_iduint64replica_id is the ID of the member which sent the response.
revisionuint64revision is the key-value store revision when the request was applied.
raft_termuint64raft_term is the raft term when the request was applied.
raft_leader_iduint64raft_leader_id is the ID of the actual raft quorum leader.

StatusRequest {#statusrequest}

FieldTypeLabelDescription
configboolconfig controls if the configuration values should be fetched as well.

StatusResponse {#statusresponse}

FieldTypeLabelDescription
idstringid is the member ID of this member.
versionstringversion is the semver version used by the responding member.
infostringinfo is the additional server info.
tablesregatta.v1.StatusResponse.TablesEntrytables is a status of tables of the responding member.
configgoogle.protobuf.Structconfig the node configuration values.
errorsstringrepeatederrors contains alarm/health information and status.

StatusResponse.TablesEntry {#statusresponsetablesentry}

FieldTypeLabelDescription
keystring
valueTableStatus

TableInfo {#tableinfo}

TableInfo describes a single table.

FieldTypeLabelDescription
namestringname of the table.
idstringid of the table.
configgoogle.protobuf.Structconfig the table configuration values.

TableStatus {#tablestatus}

FieldTypeLabelDescription
leaderstringleader is the member ID which the responding member believes is the current leader.
raftIndexuint64raftIndex is the current raft committed index of the responding member.
raftTermuint64raftTerm is the current raft term of the responding member.
raftAppliedIndexuint64raftAppliedIndex is the current raft applied index of the responding member.

TxnRequest {#txnrequest}

From google paxosdb paper: Our implementation hinges around a powerful primitive which we call MultiOp. All other database operations except for iteration are implemented as a single call to MultiOp. A MultiOp is applied atomically and consists of three components:

  1. A list of tests called guard. Each test in guard checks a single entry in the database. It may check for the absence or presence of a value, or compare with a given value. Two different tests in the guard may apply to the same or different entries in the database. All tests in the guard are applied and MultiOp returns the results. If all tests are true, MultiOp executes t op (see item 2 below), otherwise it executes f op (see item 3 below).
  2. A list of database operations called t op. Each operation in the list is either an insert, delete, or lookup operation, and applies to a database entry(ies). Two different operations in the list may apply to the same or different entries in the database. These operations are executed if guard evaluates to true.
  3. A list of database operations called f op. Like t op, but executed if guard evaluates to false.
FieldTypeLabelDescription
tablebytestable name of the table
comparemvcc.v1.Comparerepeatedcompare is a list of predicates representing a conjunction of terms. If the comparisons succeed, then the success requests will be processed in order, and the response will contain their respective responses in order. If the comparisons fail, then the failure requests will be processed in order, and the response will contain their respective responses in order.
successmvcc.v1.RequestOprepeatedsuccess is a list of requests which will be applied when compare evaluates to true.
failuremvcc.v1.RequestOprepeatedfailure is a list of requests which will be applied when compare evaluates to false.

TxnResponse {#txnresponse}

FieldTypeLabelDescription
headerResponseHeader
succeededboolsucceeded is set to true if the compare evaluated to true or false otherwise.
responsesmvcc.v1.ResponseOprepeatedresponses is a list of responses corresponding to the results from applying success if succeeded is true or failure if succeeded is false.

maintenance.proto

Service: Maintenance

Maintenance service provides methods for maintenance purposes.

MethodRequestResponseDescription
BackupBackupRequest.replication.v1.SnapshotChunk
RestoreRestoreMessageRestoreResponseRestore streams backup data to the server to restore one or more tables from a backup. The stream must begin with a RestoreMessage containing RestoreInfo, followed by one or more RestoreMessages containing SnapshotChunk data. This is a destructive operation — existing table data is replaced by the backup.
ResetResetRequestResetResponse

BackupRequest {#backuprequest}

BackupRequest requests and opens a stream with backup data.

FieldTypeLabelDescription
tablebytestable is name of the table to stream.

ResetRequest {#resetrequest}

ResetRequest resets either a single or multiple tables in the cluster, meaning that their data will be repopulated from the Leader.

FieldTypeLabelDescription
tablebytestable is a table name to reset.
reset_allboolreset_all if true all the tables will be reset, use with caution.

ResetResponse {#resetresponse}

RestoreInfo {#restoreinfo}

RestoreInfo metadata of restore snapshot that is going to be uploaded.

FieldTypeLabelDescription
tablebytestable is name of the table in the stream.

RestoreMessage {#restoremessage}

RestoreMessage contains either info of the table being restored or chunk of a backup data.

FieldTypeLabelDescription
infoRestoreInfo
chunkreplication.v1.SnapshotChunk

RestoreResponse {#restoreresponse}

metrics.proto

Service: Metrics

Metrics service for retrieving Prometheus metrics data via gRPC

MethodRequestResponseDescription
GetMetricsMetricsRequestMetricsResponseGetMetrics returns all available Prometheus metrics data.

MetricsRequest {#metricsrequest}

MetricsRequest is used to request metrics data.

FieldTypeLabelDescription
formatstringformat can be used to specify the desired format of metrics (default: prometheus text format)

MetricsResponse {#metricsresponse}

MetricsResponse contains the requested metrics data.

FieldTypeLabelDescription
metrics_datastringmetrics_data contains the metrics data in the requested format (typically prometheus text format)
timestampint64timestamp represents when these metrics were collected

mvcc.proto

Command {#command}

FieldTypeLabelDescription
tablebytestable name of the table
typeCommand.CommandTypetype is the kind of event. If type is a PUT, it indicates new data has been stored to the key. If type is a DELETE, it indicates the key was deleted.
kvKeyValuekv holds the KeyValue for the event. A PUT event contains current kv pair. A PUT event with kv.Version=1 indicates the creation of a key. A DELETE/EXPIRE event contains the deleted key with its modification revision set to the revision of deletion.
leader_indexuint64optionalleader_index holds the value of the log index of a leader cluster from which this command was replicated from.
batchKeyValuerepeatedbatch is an atomic batch of KVs to either PUT or DELETE. (faster, no read, no mix of types, no conditions).
txnTxnoptionaltxn is an atomic transaction (slow, supports reads and conditions).
range_endbytesoptionalrange_end is the key following the last key to affect for the range [kv.key, range_end). If range_end is not given, the range is defined to contain only the kv.key argument. If range_end is one bit larger than the given kv.key, then the range is all the keys with the prefix (the given key). If range_end is '\0', the range is all keys greater than or equal to the key argument.
prev_kvsboolprev_kvs if to fetch previous KVs.
sequenceCommandrepeatedsequence is the sequence of commands to be applied as a single FSM step.
countboolcount if to count number of records affected by a command.

CommandResult {#commandresult}

FieldTypeLabelDescription
responsesResponseOprepeatedresponses are the responses (if any) in order of application.
revisionuint64revision is the key-value store revision when the request was applied.

Compare {#compare}

Compare property target for every KV from DB in [key, range_end) with target_union using the operation result. e.g. DB[key].target result target_union.target, that means that for asymmetric operations LESS and GREATER the target property of the key from the DB is the left-hand side of the comparison. Examples:

  • DB[key][value] EQUAL target_union.value
  • DB[key][value] GREATER target_union.value
  • DB[key...range_end][value] GREATER target_union.value
  • DB[key][value] LESS target_union.value
FieldTypeLabelDescription
resultCompare.CompareResultresult is logical comparison operation for this comparison.
targetCompare.CompareTargettarget is the key-value field to inspect for the comparison.
keybyteskey is the subject key for the comparison operation.
valuebytesvalue is the value of the given key, in bytes.
range_endbytesrange_end compares the given target to all keys in the range [key, range_end). See RangeRequest for more details on key ranges. TODO: fill out with most of the rest of RangeRequest fields when needed.

KeyValue {#keyvalue}

FieldTypeLabelDescription
keybyteskey is the key in bytes. An empty key is not allowed.
create_revisionint64create_revision is the revision of last creation on this key.
mod_revisionint64mod_revision is the revision of last modification on this key.
valuebytesvalue is the value held by the key, in bytes.

RequestOp {#requestop}

FieldTypeLabelDescription
request_rangeRequestOp.Range
request_putRequestOp.Put
request_delete_rangeRequestOp.DeleteRange

RequestOp.DeleteRange {#requestopdeleterange}

FieldTypeLabelDescription
keybyteskey is the first key to delete in the range.
range_endbytesrange_end is the key following the last key to delete for the range [key, range_end). If range_end is not given, the range is defined to contain only the key argument. If range_end is one bit larger than the given key, then the range is all the keys with the prefix (the given key). If range_end is '\0', the range is all keys greater than or equal to the key argument.
prev_kvboolIf prev_kv is set, regatta gets the previous key-value pairs before deleting it. The previous key-value pairs will be returned in the delete response. Beware that getting previous records could have serious performance impact on a delete range spanning a large dataset.
countboolIf count is set, regatta gets the count of previous key-value pairs before deleting it. The deleted field will be set to number of deleted key-value pairs in the response. Beware that counting records could have serious performance impact on a delete range spanning a large dataset.

RequestOp.Put {#requestopput}

FieldTypeLabelDescription
keybyteskey is the key, in bytes, to put into the key-value store.
valuebytesvalue is the value, in bytes, to associate with the key in the key-value store.
prev_kvboolprev_kv if true the previous key-value pair will be returned in the put response.

RequestOp.Range {#requestoprange}

FieldTypeLabelDescription
keybyteskey is the first key for the range. If range_end is not given, the request only looks up key.
range_endbytesrange_end is the upper bound on the requested range [key, range_end). If range_end is '\0', the range is all keys >= key. If range_end is key plus one (e.g., "aa"+1 == "ab", "a\xff"+1 == "b"), then the range request gets all keys prefixed with key. If both key and range_end are '\0', then the range request returns all keys.
limitint64limit is a limit on the number of keys returned for the request. When limit is set to 0, it is treated as no limit.
keys_onlyboolkeys_only when set returns only the keys and not the values.
count_onlyboolcount_only when set returns only the count of the keys in the range.

ResponseOp {#responseop}

FieldTypeLabelDescription
response_rangeResponseOp.Range
response_putResponseOp.Put
response_delete_rangeResponseOp.DeleteRange

ResponseOp.DeleteRange {#responseopdeleterange}

FieldTypeLabelDescription
deletedint64deleted is the number of keys deleted by the delete range request.
prev_kvsKeyValuerepeatedif prev_kv is set in the request, the previous key-value pairs will be returned.

ResponseOp.Put {#responseopput}

FieldTypeLabelDescription
prev_kvKeyValueif prev_kv is set in the request, the previous key-value pair will be returned.

ResponseOp.Range {#responseoprange}

FieldTypeLabelDescription
kvsKeyValuerepeatedkvs is the list of key-value pairs matched by the range request. kvs is empty when count is requested.
moreboolmore indicates if there are more keys to return in the requested range.
countint64count is set to the number of keys within the range when requested.

Txn {#txn}

FieldTypeLabelDescription
compareComparerepeatedcompare is a list of predicates representing a conjunction of terms. If the comparisons succeed, then the success requests will be processed in order, and the response will contain their respective responses in order. If the comparisons fail, then the failure requests will be processed in order, and the response will contain their respective responses in order.
successRequestOprepeatedsuccess is a list of requests which will be applied when compare evaluates to true.
failureRequestOprepeatedfailure is a list of requests which will be applied when compare evaluates to false.

Command.CommandType {#commandcommandtype}

NameNumberDescription
PUT0
DELETE1
DUMMY2
PUT_BATCH3
DELETE_BATCH4
TXN5
SEQUENCE6
GC7

Compare.CompareResult {#comparecompareresult}

NameNumberDescription
EQUAL0
GREATER1
LESS2
NOT_EQUAL3

Compare.CompareTarget {#comparecomparetarget}

NameNumberDescription
VALUE0

replication.proto

Service: Log

Log service provides methods to replicate data from Armada leader's log to Armada followers' logs.

MethodRequestResponseDescription
ReplicateReplicateRequestReplicateResponseReplicate is method to ask for data of specified table from the specified index.

Service: Metadata

Metadata service provides method to get Armada metadata, e.g. tables.

MethodRequestResponseDescription
GetMetadataRequestMetadataResponse

Service: Snapshot

MethodRequestResponseDescription
StreamSnapshotRequestSnapshotChunk

MetadataRequest {#metadatarequest}

MetadataResponse {#metadataresponse}

FieldTypeLabelDescription
tablesTablerepeated

ReplicateCommand {#replicatecommand}

FieldTypeLabelDescription
leader_indexuint64leaderIndex represents the leader raft index of the given command
commandmvcc.v1.Commandcommand holds the leader raft log command at leaderIndex

ReplicateCommandsResponse {#replicatecommandsresponse}

ReplicateCommandsResponse sequence of replication commands

FieldTypeLabelDescription
commandsReplicateCommandrepeatedcommands represent the

ReplicateErrResponse {#replicateerrresponse}

FieldTypeLabelDescription
errorReplicateError

ReplicateRequest {#replicaterequest}

ReplicateRequest request of the replication data at given leader_index

FieldTypeLabelDescription
tablebytestable is name of the table to replicate
leader_indexuint64leader_index is the index in the leader raft log of the last stored item in the follower

ReplicateResponse {#replicateresponse}

ReplicateResponse response to the ReplicateRequest

FieldTypeLabelDescription
commands_responseReplicateCommandsResponse
error_responseReplicateErrResponse
leader_indexuint64leader_index is the largest applied leader index at the time of the client RPC.

SnapshotChunk {#snapshotchunk}

FieldTypeLabelDescription
databytesdata is chunk of snapshot
lenuint64len is a length of data bytes
indexuint64index the index for which the snapshot was created

SnapshotRequest {#snapshotrequest}

FieldTypeLabelDescription
tablebytestable is name of the table to stream
incrementalboolincremental indicates that the client wants an incremental snapshot starting from leader_index. If false, a full snapshot is produced regardless of leader_index.
leader_indexuint64leader_index is the last leader index the follower already has applied. Only meaningful when incremental is true. The server will stream only the changes (puts and deletes) with seqno > leader_index.

Table {#table}

FieldTypeLabelDescription
namestring
typeTable.Type

ReplicateError {#replicateerror}

NameNumberDescription
USE_SNAPSHOT0USE_SNAPSHOT occurs when leader has no longer the specified leader_index in the log. Follower must use GetSnapshot to catch up.
LEADER_BEHIND1LEADER_BEHIND occurs when the index of the leader is smaller than requested leader_index. This should never happen. Manual intervention needed.

Table.Type {#tabletype}

NameNumberDescription
REPLICATED0REPLICATED indicates a table that is replicated from the leader cluster to this follower cluster.
LOCAL1LOCAL indicates a table that exists only in this cluster and is not replicated from a leader.

Scalar Value Types

TypeNotesGoJavaPython
doublefloat64doublefloat
floatfloat32floatfloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intint
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/long
uint32Uses variable-length encoding.uint32intint/long
uint64Uses variable-length encoding.uint64longint/long
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intint
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/long
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intint
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/long
sfixed32Always four bytes.int32intint
sfixed64Always eight bytes.int64longint/long
boolboolbooleanboolean
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicode
bytesMay contain any arbitrary sequence of bytes.[]byteByteStringstr