diff options
| author | Heyang Zhou <zhy20000919@hotmail.com> | 2023-08-22 13:56:00 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-22 13:56:00 +0800 |
| commit | 6d4a005e4108a5dd762b339a02bc4d802755ba0d (patch) | |
| tree | 69679038bfbd3127f6c1e1b85dbc347c8c52e36e /ext/kv/proto/datapath.proto | |
| parent | 5834d282d4de5d0b5cacb9bf068f3896bef0a48a (diff) | |
feat(ext/kv): connect to remote database (#20178)
This patch adds a `remote` backend for `ext/kv`. This supports
connection to Deno Deploy and potentially other services compatible with
the KV Connect protocol.
Diffstat (limited to 'ext/kv/proto/datapath.proto')
| -rw-r--r-- | ext/kv/proto/datapath.proto | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/ext/kv/proto/datapath.proto b/ext/kv/proto/datapath.proto new file mode 100644 index 000000000..ea48f2385 --- /dev/null +++ b/ext/kv/proto/datapath.proto @@ -0,0 +1,96 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. + +syntax = "proto3"; + +package datapath; + +message SnapshotRead { + repeated ReadRange ranges = 1; +} + +message SnapshotReadOutput { + repeated ReadRangeOutput ranges = 1; + bool read_disabled = 2; + repeated string regions_if_read_disabled = 3; + bool read_is_strongly_consistent = 4; + string primary_if_not_strongly_consistent = 5; +} + +message ReadRange { + bytes start = 1; + bytes end = 2; + int32 limit = 3; + bool reverse = 4; +} + +message ReadRangeOutput { + repeated KvEntry values = 1; +} + +message AtomicWrite { + repeated KvCheck kv_checks = 1; + repeated KvMutation kv_mutations = 2; + repeated Enqueue enqueues = 3; +} + +message AtomicWriteOutput { + AtomicWriteStatus status = 1; + bytes versionstamp = 2; + string primary_if_write_disabled = 3; +} + +message KvCheck { + bytes key = 1; + bytes versionstamp = 2; // 10-byte raw versionstamp +} + +message KvMutation { + bytes key = 1; + KvValue value = 2; + KvMutationType mutation_type = 3; +} + +message KvValue { + bytes data = 1; + KvValueEncoding encoding = 2; +} + +message KvEntry { + bytes key = 1; + bytes value = 2; + KvValueEncoding encoding = 3; + bytes versionstamp = 4; +} + +enum KvMutationType { + M_UNSPECIFIED = 0; + M_SET = 1; + M_CLEAR = 2; + M_SUM = 3; + M_MAX = 4; + M_MIN = 5; +} + +enum KvValueEncoding { + VE_UNSPECIFIED = 0; + VE_V8 = 1; + VE_LE64 = 2; + VE_BYTES = 3; +} + +enum AtomicWriteStatus { + AW_UNSPECIFIED = 0; + AW_SUCCESS = 1; + AW_CHECK_FAILURE = 2; + AW_UNSUPPORTED_WRITE = 3; + AW_USAGE_LIMIT_EXCEEDED = 4; + AW_WRITE_DISABLED = 5; + AW_QUEUE_BACKLOG_LIMIT_EXCEEDED = 6; +} + +message Enqueue { + bytes payload = 1; + int64 deadline_ms = 2; + repeated bytes kv_keys_if_undelivered = 3; + repeated uint32 backoff_schedule = 4; +} |
