From 0192832732f0af02211fda6bd0db48e3580c21bc Mon Sep 17 00:00:00 2001 From: Arnau Orriols Date: Wed, 28 Aug 2024 11:57:19 +0200 Subject: [PATCH 1/3] Chore: upgrade rusqlite --- Cargo.lock | 60 ++++++++++++++++++++++++++++++------------------------ Cargo.toml | 2 +- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bdec743..d5d6911 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -605,9 +605,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -642,11 +642,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" dependencies = [ - "libc", + "shlex", ] [[package]] @@ -954,9 +954,9 @@ dependencies = [ [[package]] name = "fallible-iterator" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fallible-streaming-iterator" @@ -1143,9 +1143,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -1153,11 +1153,11 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.4" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown 0.14.2", + "hashbrown 0.14.5", ] [[package]] @@ -1414,7 +1414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.5", ] [[package]] @@ -1481,9 +1481,9 @@ checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libsqlite3-sys" -version = "0.26.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", @@ -1940,11 +1940,11 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.29.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -1973,7 +1973,7 @@ version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -2154,6 +2154,12 @@ dependencies = [ "digest", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2398,7 +2404,7 @@ dependencies = [ "futures-io", "futures-sink", "futures-util", - "hashbrown 0.14.2", + "hashbrown 0.14.5", "pin-project-lite", "slab", "tokio", @@ -2549,7 +2555,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97599c400fc79925922b58303e98fcb8fa88f573379a08ddb652e72cbd2e70f6" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.6.0", "encoding_rs", "indexmap 2.1.0", "num-bigint", @@ -2823,18 +2829,18 @@ checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" [[package]] name = "zerocopy" -version = "0.7.25" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.25" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 497ce82..014f1e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ prost = "0.11" prost-build = "0.11" rand = "0.8.5" reqwest = { version = "0.12.4", default-features = false, features = ["json", "stream"] } -rusqlite = "0.29.0" +rusqlite = "0.32.0" serde = { version = "1", features = ["derive"] } serde_json = "1.0.107" tempfile = "3" From 1c9d766b65610c31860b8aef7154b79228d99188 Mon Sep 17 00:00:00 2001 From: Arnau Orriols Date: Wed, 28 Aug 2024 14:26:59 +0200 Subject: [PATCH 2/3] Update npm/napi --- npm/napi/Cargo.toml | 2 +- proto/protobuf/com.deno.kv.backup.rs | 112 +++-- proto/protobuf/com.deno.kv.datapath.rs | 551 ++++++++++++------------- 3 files changed, 326 insertions(+), 339 deletions(-) diff --git a/npm/napi/Cargo.toml b/npm/napi/Cargo.toml index 5943525..136fca5 100644 --- a/npm/napi/Cargo.toml +++ b/npm/napi/Cargo.toml @@ -21,7 +21,7 @@ tokio = { version = "1.33.0", features = ["full"] } anyhow = "1" prost = "0.11" once_cell = "1.18.0" -rusqlite = { version = "0.29.0", features = ["bundled"] } +rusqlite = { version = "0.32.0", features = ["bundled"] } [build-dependencies] napi-build = "2" diff --git a/proto/protobuf/com.deno.kv.backup.rs b/proto/protobuf/com.deno.kv.backup.rs index ea054f8..10eebd0 100644 --- a/proto/protobuf/com.deno.kv.backup.rs +++ b/proto/protobuf/com.deno.kv.backup.rs @@ -5,80 +5,78 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupSnapshotRange { - #[prost(message, repeated, tag = "1")] - pub data_list: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub metadata_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "1")] + pub data_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub metadata_list: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupKvPair { - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupMutationRange { - #[prost(message, repeated, tag = "1")] - pub entries: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "2")] - pub timestamp_ms: u64, + #[prost(message, repeated, tag = "1")] + pub entries: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "2")] + pub timestamp_ms: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupReplicationLogEntry { - #[prost(bytes = "vec", tag = "1")] - pub versionstamp: ::prost::alloc::vec::Vec, - #[prost(enumeration = "BackupKvMutationKind", tag = "2")] - pub kind: i32, - #[prost(bytes = "vec", tag = "3")] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "4")] - pub value: ::prost::alloc::vec::Vec, - #[prost(int32, tag = "5")] - pub value_encoding: i32, - #[prost(uint64, tag = "6")] - pub expire_at_ms: u64, + #[prost(bytes = "vec", tag = "1")] + pub versionstamp: ::prost::alloc::vec::Vec, + #[prost(enumeration = "BackupKvMutationKind", tag = "2")] + pub kind: i32, + #[prost(bytes = "vec", tag = "3")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "4")] + pub value: ::prost::alloc::vec::Vec, + #[prost(int32, tag = "5")] + pub value_encoding: i32, + #[prost(uint64, tag = "6")] + pub expire_at_ms: u64, } -#[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum BackupKvMutationKind { - MkUnspecified = 0, - MkSet = 1, - MkClear = 2, - MkSum = 3, - MkMax = 4, - MkMin = 5, + MkUnspecified = 0, + MkSet = 1, + MkClear = 2, + MkSum = 3, + MkMax = 4, + MkMin = 5, } impl BackupKvMutationKind { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - BackupKvMutationKind::MkUnspecified => "MK_UNSPECIFIED", - BackupKvMutationKind::MkSet => "MK_SET", - BackupKvMutationKind::MkClear => "MK_CLEAR", - BackupKvMutationKind::MkSum => "MK_SUM", - BackupKvMutationKind::MkMax => "MK_MAX", - BackupKvMutationKind::MkMin => "MK_MIN", + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + BackupKvMutationKind::MkUnspecified => "MK_UNSPECIFIED", + BackupKvMutationKind::MkSet => "MK_SET", + BackupKvMutationKind::MkClear => "MK_CLEAR", + BackupKvMutationKind::MkSum => "MK_SUM", + BackupKvMutationKind::MkMax => "MK_MAX", + BackupKvMutationKind::MkMin => "MK_MIN", + } } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "MK_UNSPECIFIED" => Some(Self::MkUnspecified), - "MK_SET" => Some(Self::MkSet), - "MK_CLEAR" => Some(Self::MkClear), - "MK_SUM" => Some(Self::MkSum), - "MK_MAX" => Some(Self::MkMax), - "MK_MIN" => Some(Self::MkMin), - _ => None, + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "MK_UNSPECIFIED" => Some(Self::MkUnspecified), + "MK_SET" => Some(Self::MkSet), + "MK_CLEAR" => Some(Self::MkClear), + "MK_SUM" => Some(Self::MkSum), + "MK_MAX" => Some(Self::MkMax), + "MK_MIN" => Some(Self::MkMin), + _ => None, + } } - } } diff --git a/proto/protobuf/com.deno.kv.datapath.rs b/proto/protobuf/com.deno.kv.datapath.rs index 5dc1a8b..cb0e5b4 100644 --- a/proto/protobuf/com.deno.kv.datapath.rs +++ b/proto/protobuf/com.deno.kv.datapath.rs @@ -6,9 +6,9 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SnapshotRead { - /// The key ranges to read. - #[prost(message, repeated, tag = "1")] - pub ranges: ::prost::alloc::vec::Vec, + /// The key ranges to read. + #[prost(message, repeated, tag = "1")] + pub ranges: ::prost::alloc::vec::Vec, } /// The response to a read request. /// @@ -17,378 +17,367 @@ pub struct SnapshotRead { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SnapshotReadOutput { - /// The read ranges. The ranges are in the same order as the read ranges in the - /// request. - #[prost(message, repeated, tag = "1")] - pub ranges: ::prost::alloc::vec::Vec, - /// The request failed because this region does not support reading data. This - /// is equivalent to status being SR_READ_DISABLED. - #[prost(bool, tag = "2")] - pub read_disabled: bool, - /// Whether the read was strongly consistent. - #[prost(bool, tag = "4")] - pub read_is_strongly_consistent: bool, - /// The status of the read. - #[prost(enumeration = "SnapshotReadStatus", tag = "8")] - pub status: i32, + /// The read ranges. The ranges are in the same order as the read ranges in the + /// request. + #[prost(message, repeated, tag = "1")] + pub ranges: ::prost::alloc::vec::Vec, + /// The request failed because this region does not support reading data. This + /// is equivalent to status being SR_READ_DISABLED. + #[prost(bool, tag = "2")] + pub read_disabled: bool, + /// Whether the read was strongly consistent. + #[prost(bool, tag = "4")] + pub read_is_strongly_consistent: bool, + /// The status of the read. + #[prost(enumeration = "SnapshotReadStatus", tag = "8")] + pub status: i32, } /// A key range to read. The range is inclusive of the start and exclusive of the /// end. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReadRange { - /// The first key to read. - #[prost(bytes = "vec", tag = "1")] - pub start: ::prost::alloc::vec::Vec, - /// The key after the last key to read. - #[prost(bytes = "vec", tag = "2")] - pub end: ::prost::alloc::vec::Vec, - /// How many values to read. The backend may return fewer values than this if - /// there are not enough values in the range. - #[prost(int32, tag = "3")] - pub limit: i32, - /// If true, the values are returned in reverse order (from end to start). This - /// does not change inclusive/exclusive semantics. - #[prost(bool, tag = "4")] - pub reverse: bool, + /// The first key to read. + #[prost(bytes = "vec", tag = "1")] + pub start: ::prost::alloc::vec::Vec, + /// The key after the last key to read. + #[prost(bytes = "vec", tag = "2")] + pub end: ::prost::alloc::vec::Vec, + /// How many values to read. The backend may return fewer values than this if + /// there are not enough values in the range. + #[prost(int32, tag = "3")] + pub limit: i32, + /// If true, the values are returned in reverse order (from end to start). This + /// does not change inclusive/exclusive semantics. + #[prost(bool, tag = "4")] + pub reverse: bool, } /// The response to a read range request. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReadRangeOutput { - /// The values read in the range. The values are in key order. - #[prost(message, repeated, tag = "1")] - pub values: ::prost::alloc::vec::Vec, + /// The values read in the range. The values are in key order. + #[prost(message, repeated, tag = "1")] + pub values: ::prost::alloc::vec::Vec, } /// A request to write some data. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AtomicWrite { - /// The checks to perform before writing. - #[prost(message, repeated, tag = "1")] - pub checks: ::prost::alloc::vec::Vec, - /// The mutations to perform. - #[prost(message, repeated, tag = "2")] - pub mutations: ::prost::alloc::vec::Vec, - /// The enqueues to perform. - #[prost(message, repeated, tag = "3")] - pub enqueues: ::prost::alloc::vec::Vec, + /// The checks to perform before writing. + #[prost(message, repeated, tag = "1")] + pub checks: ::prost::alloc::vec::Vec, + /// The mutations to perform. + #[prost(message, repeated, tag = "2")] + pub mutations: ::prost::alloc::vec::Vec, + /// The enqueues to perform. + #[prost(message, repeated, tag = "3")] + pub enqueues: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AtomicWriteOutput { - /// The status of the write. - #[prost(enumeration = "AtomicWriteStatus", tag = "1")] - pub status: i32, - /// The versionstamp of the commit that wrote the data. - #[prost(bytes = "vec", tag = "2")] - pub versionstamp: ::prost::alloc::vec::Vec, - /// The indexes to checks that failed their check condition. - #[prost(uint32, repeated, tag = "4")] - pub failed_checks: ::prost::alloc::vec::Vec, + /// The status of the write. + #[prost(enumeration = "AtomicWriteStatus", tag = "1")] + pub status: i32, + /// The versionstamp of the commit that wrote the data. + #[prost(bytes = "vec", tag = "2")] + pub versionstamp: ::prost::alloc::vec::Vec, + /// The indexes to checks that failed their check condition. + #[prost(uint32, repeated, tag = "4")] + pub failed_checks: ::prost::alloc::vec::Vec, } /// A mutation to perform. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Check { - /// The key to check. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - /// The expected versionstamp of the value. If the value does not have this - /// versionstamp, the check fails. A 0-length versionstamp means "check that - /// the value does not exist". - /// - /// 10-byte raw versionstamp - #[prost(bytes = "vec", tag = "2")] - pub versionstamp: ::prost::alloc::vec::Vec, + /// The key to check. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// The expected versionstamp of the value. If the value does not have this + /// versionstamp, the check fails. A 0-length versionstamp means "check that + /// the value does not exist". + /// + /// 10-byte raw versionstamp + #[prost(bytes = "vec", tag = "2")] + pub versionstamp: ::prost::alloc::vec::Vec, } /// A mutation to perform. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Mutation { - /// The key to mutate. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - /// The mutation value. This is ignored for clear mutations. - #[prost(message, optional, tag = "2")] - pub value: ::core::option::Option, - /// The type of mutation to perform. - #[prost(enumeration = "MutationType", tag = "3")] - pub mutation_type: i32, - /// An expiry time for the value, in milliseconds since the Unix epoch (UTC). - /// If this is set to 0, the value will never expire. - #[prost(int64, tag = "4")] - pub expire_at_ms: i64, - /// A V8-encoded value that represents the minimum allowed value of the result - /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and - /// `value.encoding` is `VE_V8`. - #[prost(bytes = "vec", tag = "5")] - pub sum_min: ::prost::alloc::vec::Vec, - /// A V8-encoded value that represents the maximum allowed value of the result - /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and - /// `value.encoding` is `VE_V8`. - #[prost(bytes = "vec", tag = "6")] - pub sum_max: ::prost::alloc::vec::Vec, - /// If true, a result outside sum_min..=sum_max will be clamped. Otherwise, an - /// error is returned and the atomic operation is not applied. Only valid if - /// `mutation_type` is `M_SUM` and `value.encoding` is `VE_V8`. - #[prost(bool, tag = "7")] - pub sum_clamp: bool, + /// The key to mutate. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// The mutation value. This is ignored for clear mutations. + #[prost(message, optional, tag = "2")] + pub value: ::core::option::Option, + /// The type of mutation to perform. + #[prost(enumeration = "MutationType", tag = "3")] + pub mutation_type: i32, + /// An expiry time for the value, in milliseconds since the Unix epoch (UTC). + /// If this is set to 0, the value will never expire. + #[prost(int64, tag = "4")] + pub expire_at_ms: i64, + /// A V8-encoded value that represents the minimum allowed value of the result + /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and + /// `value.encoding` is `VE_V8`. + #[prost(bytes = "vec", tag = "5")] + pub sum_min: ::prost::alloc::vec::Vec, + /// A V8-encoded value that represents the maximum allowed value of the result + /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and + /// `value.encoding` is `VE_V8`. + #[prost(bytes = "vec", tag = "6")] + pub sum_max: ::prost::alloc::vec::Vec, + /// If true, a result outside sum_min..=sum_max will be clamped. Otherwise, an + /// error is returned and the atomic operation is not applied. Only valid if + /// `mutation_type` is `M_SUM` and `value.encoding` is `VE_V8`. + #[prost(bool, tag = "7")] + pub sum_clamp: bool, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KvValue { - #[prost(bytes = "vec", tag = "1")] - pub data: ::prost::alloc::vec::Vec, - #[prost(enumeration = "ValueEncoding", tag = "2")] - pub encoding: i32, + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(enumeration = "ValueEncoding", tag = "2")] + pub encoding: i32, } /// A key-value entry. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KvEntry { - /// The key. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - /// The encoded value bytes. - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, - /// The encoding of the value. - #[prost(enumeration = "ValueEncoding", tag = "3")] - pub encoding: i32, - /// The versionstamp of the commit that last wrote this value. - #[prost(bytes = "vec", tag = "4")] - pub versionstamp: ::prost::alloc::vec::Vec, + /// The key. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// The encoded value bytes. + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, + /// The encoding of the value. + #[prost(enumeration = "ValueEncoding", tag = "3")] + pub encoding: i32, + /// The versionstamp of the commit that last wrote this value. + #[prost(bytes = "vec", tag = "4")] + pub versionstamp: ::prost::alloc::vec::Vec, } /// A request to enqueue a message. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Enqueue { - /// The payload of the message, encoded as a V8 ValueSerializer value. - #[prost(bytes = "vec", tag = "1")] - pub payload: ::prost::alloc::vec::Vec, - /// The time at which the message should be delivered, in milliseconds since - /// the Unix epoch (UTC). If the deadline is in the past, the message will be - /// scheduled for delivered immediately. - #[prost(int64, tag = "2")] - pub deadline_ms: i64, - /// The keys to write the value to if the maximum number of re-deliveries - /// according to the backoff schedule has been reached. - #[prost(bytes = "vec", repeated, tag = "3")] - pub keys_if_undelivered: - ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - /// The backoff schedule to use if delivery fails. This is a list of delays in - /// milliseconds. The first delay is the delay before the first retry, the - /// second delay is the delay before the second retry, and so on. If the list - /// is empty, the message will not be retried. - #[prost(uint32, repeated, tag = "4")] - pub backoff_schedule: ::prost::alloc::vec::Vec, + /// The payload of the message, encoded as a V8 ValueSerializer value. + #[prost(bytes = "vec", tag = "1")] + pub payload: ::prost::alloc::vec::Vec, + /// The time at which the message should be delivered, in milliseconds since + /// the Unix epoch (UTC). If the deadline is in the past, the message will be + /// scheduled for delivered immediately. + #[prost(int64, tag = "2")] + pub deadline_ms: i64, + /// The keys to write the value to if the maximum number of re-deliveries + /// according to the backoff schedule has been reached. + #[prost(bytes = "vec", repeated, tag = "3")] + pub keys_if_undelivered: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + /// The backoff schedule to use if delivery fails. This is a list of delays in + /// milliseconds. The first delay is the delay before the first retry, the + /// second delay is the delay before the second retry, and so on. If the list + /// is empty, the message will not be retried. + #[prost(uint32, repeated, tag = "4")] + pub backoff_schedule: ::prost::alloc::vec::Vec, } /// A request to watch some keys for updates. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Watch { - /// The keys to watch. - #[prost(message, repeated, tag = "1")] - pub keys: ::prost::alloc::vec::Vec, + /// The keys to watch. + #[prost(message, repeated, tag = "1")] + pub keys: ::prost::alloc::vec::Vec, } /// The response to a watch request. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchOutput { - /// The status of the watch. - #[prost(enumeration = "SnapshotReadStatus", tag = "1")] - pub status: i32, - /// For each watched key, whether the value changed since the last watch - /// request, and if so, the new value. - #[prost(message, repeated, tag = "2")] - pub keys: ::prost::alloc::vec::Vec, + /// The status of the watch. + #[prost(enumeration = "SnapshotReadStatus", tag = "1")] + pub status: i32, + /// For each watched key, whether the value changed since the last watch + /// request, and if so, the new value. + #[prost(message, repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec, } /// A key to watch. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchKey { - /// The key to watch. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, + /// The key to watch. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, } /// The response to a watch request for a single key. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchKeyOutput { - /// Whether the value changed since the last watch delivery. - #[prost(bool, tag = "1")] - pub changed: bool, - /// The new value, if changed is true. - #[prost(message, optional, tag = "2")] - pub entry_if_changed: ::core::option::Option, + /// Whether the value changed since the last watch delivery. + #[prost(bool, tag = "1")] + pub changed: bool, + /// The new value, if changed is true. + #[prost(message, optional, tag = "2")] + pub entry_if_changed: ::core::option::Option, } /// The status of a read request. -#[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum SnapshotReadStatus { - /// The read status is unspecified or unknown. - SrUnspecified = 0, - /// The read succeeded. - SrSuccess = 1, - /// The read failed because the region is unable to serve reads right now. - SrReadDisabled = 2, + /// The read status is unspecified or unknown. + SrUnspecified = 0, + /// The read succeeded. + SrSuccess = 1, + /// The read failed because the region is unable to serve reads right now. + SrReadDisabled = 2, } impl SnapshotReadStatus { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - SnapshotReadStatus::SrUnspecified => "SR_UNSPECIFIED", - SnapshotReadStatus::SrSuccess => "SR_SUCCESS", - SnapshotReadStatus::SrReadDisabled => "SR_READ_DISABLED", + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SnapshotReadStatus::SrUnspecified => "SR_UNSPECIFIED", + SnapshotReadStatus::SrSuccess => "SR_SUCCESS", + SnapshotReadStatus::SrReadDisabled => "SR_READ_DISABLED", + } } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SR_UNSPECIFIED" => Some(Self::SrUnspecified), - "SR_SUCCESS" => Some(Self::SrSuccess), - "SR_READ_DISABLED" => Some(Self::SrReadDisabled), - _ => None, + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SR_UNSPECIFIED" => Some(Self::SrUnspecified), + "SR_SUCCESS" => Some(Self::SrSuccess), + "SR_READ_DISABLED" => Some(Self::SrReadDisabled), + _ => None, + } } - } } /// The type of a mutation. -#[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum MutationType { - /// The mutation type is unspecified or unknown. - MUnspecified = 0, - /// Set the value. - MSet = 1, - /// Delete the value. - MDelete = 2, - /// Sum the stored value with the new value. Both values must be LE64 encoded. - MSum = 3, - /// Min the stored value with the new value. Both values must be LE64 encoded. - MMax = 4, - /// Max the stored value with the new value. Both values must be LE64 encoded. - MMin = 5, - /// Set the value, with the versionstamp appended to the end of the key as a string. - MSetSuffixVersionstampedKey = 9, + /// The mutation type is unspecified or unknown. + MUnspecified = 0, + /// Set the value. + MSet = 1, + /// Delete the value. + MDelete = 2, + /// Sum the stored value with the new value. Both values must be LE64 encoded. + MSum = 3, + /// Min the stored value with the new value. Both values must be LE64 encoded. + MMax = 4, + /// Max the stored value with the new value. Both values must be LE64 encoded. + MMin = 5, + /// Set the value, with the versionstamp appended to the end of the key as a string. + MSetSuffixVersionstampedKey = 9, } impl MutationType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - MutationType::MUnspecified => "M_UNSPECIFIED", - MutationType::MSet => "M_SET", - MutationType::MDelete => "M_DELETE", - MutationType::MSum => "M_SUM", - MutationType::MMax => "M_MAX", - MutationType::MMin => "M_MIN", - MutationType::MSetSuffixVersionstampedKey => { - "M_SET_SUFFIX_VERSIONSTAMPED_KEY" - } + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + MutationType::MUnspecified => "M_UNSPECIFIED", + MutationType::MSet => "M_SET", + MutationType::MDelete => "M_DELETE", + MutationType::MSum => "M_SUM", + MutationType::MMax => "M_MAX", + MutationType::MMin => "M_MIN", + MutationType::MSetSuffixVersionstampedKey => { + "M_SET_SUFFIX_VERSIONSTAMPED_KEY" + } + } } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "M_UNSPECIFIED" => Some(Self::MUnspecified), - "M_SET" => Some(Self::MSet), - "M_DELETE" => Some(Self::MDelete), - "M_SUM" => Some(Self::MSum), - "M_MAX" => Some(Self::MMax), - "M_MIN" => Some(Self::MMin), - "M_SET_SUFFIX_VERSIONSTAMPED_KEY" => { - Some(Self::MSetSuffixVersionstampedKey) - } - _ => None, + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "M_UNSPECIFIED" => Some(Self::MUnspecified), + "M_SET" => Some(Self::MSet), + "M_DELETE" => Some(Self::MDelete), + "M_SUM" => Some(Self::MSum), + "M_MAX" => Some(Self::MMax), + "M_MIN" => Some(Self::MMin), + "M_SET_SUFFIX_VERSIONSTAMPED_KEY" => Some(Self::MSetSuffixVersionstampedKey), + _ => None, + } } - } } /// The encoding of a value. -#[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum ValueEncoding { - /// The encoding is unspecified or unknown. - VeUnspecified = 0, - /// The value is encoded using V8 ValueSerializer encoding. - VeV8 = 1, - /// The value is encoded using little-endian 64-bit integer encoding. - VeLe64 = 2, - /// The value is a literal byte array. - VeBytes = 3, + /// The encoding is unspecified or unknown. + VeUnspecified = 0, + /// The value is encoded using V8 ValueSerializer encoding. + VeV8 = 1, + /// The value is encoded using little-endian 64-bit integer encoding. + VeLe64 = 2, + /// The value is a literal byte array. + VeBytes = 3, } impl ValueEncoding { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - ValueEncoding::VeUnspecified => "VE_UNSPECIFIED", - ValueEncoding::VeV8 => "VE_V8", - ValueEncoding::VeLe64 => "VE_LE64", - ValueEncoding::VeBytes => "VE_BYTES", + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ValueEncoding::VeUnspecified => "VE_UNSPECIFIED", + ValueEncoding::VeV8 => "VE_V8", + ValueEncoding::VeLe64 => "VE_LE64", + ValueEncoding::VeBytes => "VE_BYTES", + } } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VE_UNSPECIFIED" => Some(Self::VeUnspecified), - "VE_V8" => Some(Self::VeV8), - "VE_LE64" => Some(Self::VeLe64), - "VE_BYTES" => Some(Self::VeBytes), - _ => None, + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VE_UNSPECIFIED" => Some(Self::VeUnspecified), + "VE_V8" => Some(Self::VeV8), + "VE_LE64" => Some(Self::VeLe64), + "VE_BYTES" => Some(Self::VeBytes), + _ => None, + } } - } } /// The status of an atomic write. -#[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, -)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum AtomicWriteStatus { - /// The write failed, but the exact status is unspecified or unknown. The - /// request should not be retried. - AwUnspecified = 0, - /// The write succeeded. - AwSuccess = 1, - /// The write failed because a check failed. - AwCheckFailure = 2, - /// The write failed because the region is unable to serve writes right now. - AwWriteDisabled = 5, + /// The write failed, but the exact status is unspecified or unknown. The + /// request should not be retried. + AwUnspecified = 0, + /// The write succeeded. + AwSuccess = 1, + /// The write failed because a check failed. + AwCheckFailure = 2, + /// The write failed because the region is unable to serve writes right now. + AwWriteDisabled = 5, } impl AtomicWriteStatus { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - AtomicWriteStatus::AwUnspecified => "AW_UNSPECIFIED", - AtomicWriteStatus::AwSuccess => "AW_SUCCESS", - AtomicWriteStatus::AwCheckFailure => "AW_CHECK_FAILURE", - AtomicWriteStatus::AwWriteDisabled => "AW_WRITE_DISABLED", + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + AtomicWriteStatus::AwUnspecified => "AW_UNSPECIFIED", + AtomicWriteStatus::AwSuccess => "AW_SUCCESS", + AtomicWriteStatus::AwCheckFailure => "AW_CHECK_FAILURE", + AtomicWriteStatus::AwWriteDisabled => "AW_WRITE_DISABLED", + } } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "AW_UNSPECIFIED" => Some(Self::AwUnspecified), - "AW_SUCCESS" => Some(Self::AwSuccess), - "AW_CHECK_FAILURE" => Some(Self::AwCheckFailure), - "AW_WRITE_DISABLED" => Some(Self::AwWriteDisabled), - _ => None, + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "AW_UNSPECIFIED" => Some(Self::AwUnspecified), + "AW_SUCCESS" => Some(Self::AwSuccess), + "AW_CHECK_FAILURE" => Some(Self::AwCheckFailure), + "AW_WRITE_DISABLED" => Some(Self::AwWriteDisabled), + _ => None, + } } - } } From f4289897c25139ef8d188340cf13f64dd48cfb36 Mon Sep 17 00:00:00 2001 From: Arnau Orriols Date: Wed, 28 Aug 2024 14:36:37 +0200 Subject: [PATCH 3/3] fmt --- proto/protobuf/com.deno.kv.backup.rs | 112 ++--- proto/protobuf/com.deno.kv.datapath.rs | 551 +++++++++++++------------ 2 files changed, 338 insertions(+), 325 deletions(-) diff --git a/proto/protobuf/com.deno.kv.backup.rs b/proto/protobuf/com.deno.kv.backup.rs index 10eebd0..ea054f8 100644 --- a/proto/protobuf/com.deno.kv.backup.rs +++ b/proto/protobuf/com.deno.kv.backup.rs @@ -5,78 +5,80 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupSnapshotRange { - #[prost(message, repeated, tag = "1")] - pub data_list: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub metadata_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "1")] + pub data_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub metadata_list: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupKvPair { - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupMutationRange { - #[prost(message, repeated, tag = "1")] - pub entries: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "2")] - pub timestamp_ms: u64, + #[prost(message, repeated, tag = "1")] + pub entries: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "2")] + pub timestamp_ms: u64, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct BackupReplicationLogEntry { - #[prost(bytes = "vec", tag = "1")] - pub versionstamp: ::prost::alloc::vec::Vec, - #[prost(enumeration = "BackupKvMutationKind", tag = "2")] - pub kind: i32, - #[prost(bytes = "vec", tag = "3")] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "4")] - pub value: ::prost::alloc::vec::Vec, - #[prost(int32, tag = "5")] - pub value_encoding: i32, - #[prost(uint64, tag = "6")] - pub expire_at_ms: u64, + #[prost(bytes = "vec", tag = "1")] + pub versionstamp: ::prost::alloc::vec::Vec, + #[prost(enumeration = "BackupKvMutationKind", tag = "2")] + pub kind: i32, + #[prost(bytes = "vec", tag = "3")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "4")] + pub value: ::prost::alloc::vec::Vec, + #[prost(int32, tag = "5")] + pub value_encoding: i32, + #[prost(uint64, tag = "6")] + pub expire_at_ms: u64, } -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, +)] #[repr(i32)] pub enum BackupKvMutationKind { - MkUnspecified = 0, - MkSet = 1, - MkClear = 2, - MkSum = 3, - MkMax = 4, - MkMin = 5, + MkUnspecified = 0, + MkSet = 1, + MkClear = 2, + MkSum = 3, + MkMax = 4, + MkMin = 5, } impl BackupKvMutationKind { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - BackupKvMutationKind::MkUnspecified => "MK_UNSPECIFIED", - BackupKvMutationKind::MkSet => "MK_SET", - BackupKvMutationKind::MkClear => "MK_CLEAR", - BackupKvMutationKind::MkSum => "MK_SUM", - BackupKvMutationKind::MkMax => "MK_MAX", - BackupKvMutationKind::MkMin => "MK_MIN", - } + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + BackupKvMutationKind::MkUnspecified => "MK_UNSPECIFIED", + BackupKvMutationKind::MkSet => "MK_SET", + BackupKvMutationKind::MkClear => "MK_CLEAR", + BackupKvMutationKind::MkSum => "MK_SUM", + BackupKvMutationKind::MkMax => "MK_MAX", + BackupKvMutationKind::MkMin => "MK_MIN", } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "MK_UNSPECIFIED" => Some(Self::MkUnspecified), - "MK_SET" => Some(Self::MkSet), - "MK_CLEAR" => Some(Self::MkClear), - "MK_SUM" => Some(Self::MkSum), - "MK_MAX" => Some(Self::MkMax), - "MK_MIN" => Some(Self::MkMin), - _ => None, - } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "MK_UNSPECIFIED" => Some(Self::MkUnspecified), + "MK_SET" => Some(Self::MkSet), + "MK_CLEAR" => Some(Self::MkClear), + "MK_SUM" => Some(Self::MkSum), + "MK_MAX" => Some(Self::MkMax), + "MK_MIN" => Some(Self::MkMin), + _ => None, } + } } diff --git a/proto/protobuf/com.deno.kv.datapath.rs b/proto/protobuf/com.deno.kv.datapath.rs index cb0e5b4..5dc1a8b 100644 --- a/proto/protobuf/com.deno.kv.datapath.rs +++ b/proto/protobuf/com.deno.kv.datapath.rs @@ -6,9 +6,9 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SnapshotRead { - /// The key ranges to read. - #[prost(message, repeated, tag = "1")] - pub ranges: ::prost::alloc::vec::Vec, + /// The key ranges to read. + #[prost(message, repeated, tag = "1")] + pub ranges: ::prost::alloc::vec::Vec, } /// The response to a read request. /// @@ -17,367 +17,378 @@ pub struct SnapshotRead { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SnapshotReadOutput { - /// The read ranges. The ranges are in the same order as the read ranges in the - /// request. - #[prost(message, repeated, tag = "1")] - pub ranges: ::prost::alloc::vec::Vec, - /// The request failed because this region does not support reading data. This - /// is equivalent to status being SR_READ_DISABLED. - #[prost(bool, tag = "2")] - pub read_disabled: bool, - /// Whether the read was strongly consistent. - #[prost(bool, tag = "4")] - pub read_is_strongly_consistent: bool, - /// The status of the read. - #[prost(enumeration = "SnapshotReadStatus", tag = "8")] - pub status: i32, + /// The read ranges. The ranges are in the same order as the read ranges in the + /// request. + #[prost(message, repeated, tag = "1")] + pub ranges: ::prost::alloc::vec::Vec, + /// The request failed because this region does not support reading data. This + /// is equivalent to status being SR_READ_DISABLED. + #[prost(bool, tag = "2")] + pub read_disabled: bool, + /// Whether the read was strongly consistent. + #[prost(bool, tag = "4")] + pub read_is_strongly_consistent: bool, + /// The status of the read. + #[prost(enumeration = "SnapshotReadStatus", tag = "8")] + pub status: i32, } /// A key range to read. The range is inclusive of the start and exclusive of the /// end. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReadRange { - /// The first key to read. - #[prost(bytes = "vec", tag = "1")] - pub start: ::prost::alloc::vec::Vec, - /// The key after the last key to read. - #[prost(bytes = "vec", tag = "2")] - pub end: ::prost::alloc::vec::Vec, - /// How many values to read. The backend may return fewer values than this if - /// there are not enough values in the range. - #[prost(int32, tag = "3")] - pub limit: i32, - /// If true, the values are returned in reverse order (from end to start). This - /// does not change inclusive/exclusive semantics. - #[prost(bool, tag = "4")] - pub reverse: bool, + /// The first key to read. + #[prost(bytes = "vec", tag = "1")] + pub start: ::prost::alloc::vec::Vec, + /// The key after the last key to read. + #[prost(bytes = "vec", tag = "2")] + pub end: ::prost::alloc::vec::Vec, + /// How many values to read. The backend may return fewer values than this if + /// there are not enough values in the range. + #[prost(int32, tag = "3")] + pub limit: i32, + /// If true, the values are returned in reverse order (from end to start). This + /// does not change inclusive/exclusive semantics. + #[prost(bool, tag = "4")] + pub reverse: bool, } /// The response to a read range request. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReadRangeOutput { - /// The values read in the range. The values are in key order. - #[prost(message, repeated, tag = "1")] - pub values: ::prost::alloc::vec::Vec, + /// The values read in the range. The values are in key order. + #[prost(message, repeated, tag = "1")] + pub values: ::prost::alloc::vec::Vec, } /// A request to write some data. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AtomicWrite { - /// The checks to perform before writing. - #[prost(message, repeated, tag = "1")] - pub checks: ::prost::alloc::vec::Vec, - /// The mutations to perform. - #[prost(message, repeated, tag = "2")] - pub mutations: ::prost::alloc::vec::Vec, - /// The enqueues to perform. - #[prost(message, repeated, tag = "3")] - pub enqueues: ::prost::alloc::vec::Vec, + /// The checks to perform before writing. + #[prost(message, repeated, tag = "1")] + pub checks: ::prost::alloc::vec::Vec, + /// The mutations to perform. + #[prost(message, repeated, tag = "2")] + pub mutations: ::prost::alloc::vec::Vec, + /// The enqueues to perform. + #[prost(message, repeated, tag = "3")] + pub enqueues: ::prost::alloc::vec::Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AtomicWriteOutput { - /// The status of the write. - #[prost(enumeration = "AtomicWriteStatus", tag = "1")] - pub status: i32, - /// The versionstamp of the commit that wrote the data. - #[prost(bytes = "vec", tag = "2")] - pub versionstamp: ::prost::alloc::vec::Vec, - /// The indexes to checks that failed their check condition. - #[prost(uint32, repeated, tag = "4")] - pub failed_checks: ::prost::alloc::vec::Vec, + /// The status of the write. + #[prost(enumeration = "AtomicWriteStatus", tag = "1")] + pub status: i32, + /// The versionstamp of the commit that wrote the data. + #[prost(bytes = "vec", tag = "2")] + pub versionstamp: ::prost::alloc::vec::Vec, + /// The indexes to checks that failed their check condition. + #[prost(uint32, repeated, tag = "4")] + pub failed_checks: ::prost::alloc::vec::Vec, } /// A mutation to perform. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Check { - /// The key to check. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - /// The expected versionstamp of the value. If the value does not have this - /// versionstamp, the check fails. A 0-length versionstamp means "check that - /// the value does not exist". - /// - /// 10-byte raw versionstamp - #[prost(bytes = "vec", tag = "2")] - pub versionstamp: ::prost::alloc::vec::Vec, + /// The key to check. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// The expected versionstamp of the value. If the value does not have this + /// versionstamp, the check fails. A 0-length versionstamp means "check that + /// the value does not exist". + /// + /// 10-byte raw versionstamp + #[prost(bytes = "vec", tag = "2")] + pub versionstamp: ::prost::alloc::vec::Vec, } /// A mutation to perform. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Mutation { - /// The key to mutate. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - /// The mutation value. This is ignored for clear mutations. - #[prost(message, optional, tag = "2")] - pub value: ::core::option::Option, - /// The type of mutation to perform. - #[prost(enumeration = "MutationType", tag = "3")] - pub mutation_type: i32, - /// An expiry time for the value, in milliseconds since the Unix epoch (UTC). - /// If this is set to 0, the value will never expire. - #[prost(int64, tag = "4")] - pub expire_at_ms: i64, - /// A V8-encoded value that represents the minimum allowed value of the result - /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and - /// `value.encoding` is `VE_V8`. - #[prost(bytes = "vec", tag = "5")] - pub sum_min: ::prost::alloc::vec::Vec, - /// A V8-encoded value that represents the maximum allowed value of the result - /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and - /// `value.encoding` is `VE_V8`. - #[prost(bytes = "vec", tag = "6")] - pub sum_max: ::prost::alloc::vec::Vec, - /// If true, a result outside sum_min..=sum_max will be clamped. Otherwise, an - /// error is returned and the atomic operation is not applied. Only valid if - /// `mutation_type` is `M_SUM` and `value.encoding` is `VE_V8`. - #[prost(bool, tag = "7")] - pub sum_clamp: bool, + /// The key to mutate. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// The mutation value. This is ignored for clear mutations. + #[prost(message, optional, tag = "2")] + pub value: ::core::option::Option, + /// The type of mutation to perform. + #[prost(enumeration = "MutationType", tag = "3")] + pub mutation_type: i32, + /// An expiry time for the value, in milliseconds since the Unix epoch (UTC). + /// If this is set to 0, the value will never expire. + #[prost(int64, tag = "4")] + pub expire_at_ms: i64, + /// A V8-encoded value that represents the minimum allowed value of the result + /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and + /// `value.encoding` is `VE_V8`. + #[prost(bytes = "vec", tag = "5")] + pub sum_min: ::prost::alloc::vec::Vec, + /// A V8-encoded value that represents the maximum allowed value of the result + /// of a `sum` operation. Only valid if `mutation_type` is `M_SUM` and + /// `value.encoding` is `VE_V8`. + #[prost(bytes = "vec", tag = "6")] + pub sum_max: ::prost::alloc::vec::Vec, + /// If true, a result outside sum_min..=sum_max will be clamped. Otherwise, an + /// error is returned and the atomic operation is not applied. Only valid if + /// `mutation_type` is `M_SUM` and `value.encoding` is `VE_V8`. + #[prost(bool, tag = "7")] + pub sum_clamp: bool, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KvValue { - #[prost(bytes = "vec", tag = "1")] - pub data: ::prost::alloc::vec::Vec, - #[prost(enumeration = "ValueEncoding", tag = "2")] - pub encoding: i32, + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(enumeration = "ValueEncoding", tag = "2")] + pub encoding: i32, } /// A key-value entry. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KvEntry { - /// The key. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, - /// The encoded value bytes. - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, - /// The encoding of the value. - #[prost(enumeration = "ValueEncoding", tag = "3")] - pub encoding: i32, - /// The versionstamp of the commit that last wrote this value. - #[prost(bytes = "vec", tag = "4")] - pub versionstamp: ::prost::alloc::vec::Vec, + /// The key. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// The encoded value bytes. + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, + /// The encoding of the value. + #[prost(enumeration = "ValueEncoding", tag = "3")] + pub encoding: i32, + /// The versionstamp of the commit that last wrote this value. + #[prost(bytes = "vec", tag = "4")] + pub versionstamp: ::prost::alloc::vec::Vec, } /// A request to enqueue a message. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Enqueue { - /// The payload of the message, encoded as a V8 ValueSerializer value. - #[prost(bytes = "vec", tag = "1")] - pub payload: ::prost::alloc::vec::Vec, - /// The time at which the message should be delivered, in milliseconds since - /// the Unix epoch (UTC). If the deadline is in the past, the message will be - /// scheduled for delivered immediately. - #[prost(int64, tag = "2")] - pub deadline_ms: i64, - /// The keys to write the value to if the maximum number of re-deliveries - /// according to the backoff schedule has been reached. - #[prost(bytes = "vec", repeated, tag = "3")] - pub keys_if_undelivered: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - /// The backoff schedule to use if delivery fails. This is a list of delays in - /// milliseconds. The first delay is the delay before the first retry, the - /// second delay is the delay before the second retry, and so on. If the list - /// is empty, the message will not be retried. - #[prost(uint32, repeated, tag = "4")] - pub backoff_schedule: ::prost::alloc::vec::Vec, + /// The payload of the message, encoded as a V8 ValueSerializer value. + #[prost(bytes = "vec", tag = "1")] + pub payload: ::prost::alloc::vec::Vec, + /// The time at which the message should be delivered, in milliseconds since + /// the Unix epoch (UTC). If the deadline is in the past, the message will be + /// scheduled for delivered immediately. + #[prost(int64, tag = "2")] + pub deadline_ms: i64, + /// The keys to write the value to if the maximum number of re-deliveries + /// according to the backoff schedule has been reached. + #[prost(bytes = "vec", repeated, tag = "3")] + pub keys_if_undelivered: + ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + /// The backoff schedule to use if delivery fails. This is a list of delays in + /// milliseconds. The first delay is the delay before the first retry, the + /// second delay is the delay before the second retry, and so on. If the list + /// is empty, the message will not be retried. + #[prost(uint32, repeated, tag = "4")] + pub backoff_schedule: ::prost::alloc::vec::Vec, } /// A request to watch some keys for updates. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Watch { - /// The keys to watch. - #[prost(message, repeated, tag = "1")] - pub keys: ::prost::alloc::vec::Vec, + /// The keys to watch. + #[prost(message, repeated, tag = "1")] + pub keys: ::prost::alloc::vec::Vec, } /// The response to a watch request. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchOutput { - /// The status of the watch. - #[prost(enumeration = "SnapshotReadStatus", tag = "1")] - pub status: i32, - /// For each watched key, whether the value changed since the last watch - /// request, and if so, the new value. - #[prost(message, repeated, tag = "2")] - pub keys: ::prost::alloc::vec::Vec, + /// The status of the watch. + #[prost(enumeration = "SnapshotReadStatus", tag = "1")] + pub status: i32, + /// For each watched key, whether the value changed since the last watch + /// request, and if so, the new value. + #[prost(message, repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec, } /// A key to watch. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchKey { - /// The key to watch. - #[prost(bytes = "vec", tag = "1")] - pub key: ::prost::alloc::vec::Vec, + /// The key to watch. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, } /// The response to a watch request for a single key. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchKeyOutput { - /// Whether the value changed since the last watch delivery. - #[prost(bool, tag = "1")] - pub changed: bool, - /// The new value, if changed is true. - #[prost(message, optional, tag = "2")] - pub entry_if_changed: ::core::option::Option, + /// Whether the value changed since the last watch delivery. + #[prost(bool, tag = "1")] + pub changed: bool, + /// The new value, if changed is true. + #[prost(message, optional, tag = "2")] + pub entry_if_changed: ::core::option::Option, } /// The status of a read request. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, +)] #[repr(i32)] pub enum SnapshotReadStatus { - /// The read status is unspecified or unknown. - SrUnspecified = 0, - /// The read succeeded. - SrSuccess = 1, - /// The read failed because the region is unable to serve reads right now. - SrReadDisabled = 2, + /// The read status is unspecified or unknown. + SrUnspecified = 0, + /// The read succeeded. + SrSuccess = 1, + /// The read failed because the region is unable to serve reads right now. + SrReadDisabled = 2, } impl SnapshotReadStatus { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - SnapshotReadStatus::SrUnspecified => "SR_UNSPECIFIED", - SnapshotReadStatus::SrSuccess => "SR_SUCCESS", - SnapshotReadStatus::SrReadDisabled => "SR_READ_DISABLED", - } + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SnapshotReadStatus::SrUnspecified => "SR_UNSPECIFIED", + SnapshotReadStatus::SrSuccess => "SR_SUCCESS", + SnapshotReadStatus::SrReadDisabled => "SR_READ_DISABLED", } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SR_UNSPECIFIED" => Some(Self::SrUnspecified), - "SR_SUCCESS" => Some(Self::SrSuccess), - "SR_READ_DISABLED" => Some(Self::SrReadDisabled), - _ => None, - } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SR_UNSPECIFIED" => Some(Self::SrUnspecified), + "SR_SUCCESS" => Some(Self::SrSuccess), + "SR_READ_DISABLED" => Some(Self::SrReadDisabled), + _ => None, } + } } /// The type of a mutation. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, +)] #[repr(i32)] pub enum MutationType { - /// The mutation type is unspecified or unknown. - MUnspecified = 0, - /// Set the value. - MSet = 1, - /// Delete the value. - MDelete = 2, - /// Sum the stored value with the new value. Both values must be LE64 encoded. - MSum = 3, - /// Min the stored value with the new value. Both values must be LE64 encoded. - MMax = 4, - /// Max the stored value with the new value. Both values must be LE64 encoded. - MMin = 5, - /// Set the value, with the versionstamp appended to the end of the key as a string. - MSetSuffixVersionstampedKey = 9, + /// The mutation type is unspecified or unknown. + MUnspecified = 0, + /// Set the value. + MSet = 1, + /// Delete the value. + MDelete = 2, + /// Sum the stored value with the new value. Both values must be LE64 encoded. + MSum = 3, + /// Min the stored value with the new value. Both values must be LE64 encoded. + MMax = 4, + /// Max the stored value with the new value. Both values must be LE64 encoded. + MMin = 5, + /// Set the value, with the versionstamp appended to the end of the key as a string. + MSetSuffixVersionstampedKey = 9, } impl MutationType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - MutationType::MUnspecified => "M_UNSPECIFIED", - MutationType::MSet => "M_SET", - MutationType::MDelete => "M_DELETE", - MutationType::MSum => "M_SUM", - MutationType::MMax => "M_MAX", - MutationType::MMin => "M_MIN", - MutationType::MSetSuffixVersionstampedKey => { - "M_SET_SUFFIX_VERSIONSTAMPED_KEY" - } - } + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + MutationType::MUnspecified => "M_UNSPECIFIED", + MutationType::MSet => "M_SET", + MutationType::MDelete => "M_DELETE", + MutationType::MSum => "M_SUM", + MutationType::MMax => "M_MAX", + MutationType::MMin => "M_MIN", + MutationType::MSetSuffixVersionstampedKey => { + "M_SET_SUFFIX_VERSIONSTAMPED_KEY" + } } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "M_UNSPECIFIED" => Some(Self::MUnspecified), - "M_SET" => Some(Self::MSet), - "M_DELETE" => Some(Self::MDelete), - "M_SUM" => Some(Self::MSum), - "M_MAX" => Some(Self::MMax), - "M_MIN" => Some(Self::MMin), - "M_SET_SUFFIX_VERSIONSTAMPED_KEY" => Some(Self::MSetSuffixVersionstampedKey), - _ => None, - } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "M_UNSPECIFIED" => Some(Self::MUnspecified), + "M_SET" => Some(Self::MSet), + "M_DELETE" => Some(Self::MDelete), + "M_SUM" => Some(Self::MSum), + "M_MAX" => Some(Self::MMax), + "M_MIN" => Some(Self::MMin), + "M_SET_SUFFIX_VERSIONSTAMPED_KEY" => { + Some(Self::MSetSuffixVersionstampedKey) + } + _ => None, } + } } /// The encoding of a value. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, +)] #[repr(i32)] pub enum ValueEncoding { - /// The encoding is unspecified or unknown. - VeUnspecified = 0, - /// The value is encoded using V8 ValueSerializer encoding. - VeV8 = 1, - /// The value is encoded using little-endian 64-bit integer encoding. - VeLe64 = 2, - /// The value is a literal byte array. - VeBytes = 3, + /// The encoding is unspecified or unknown. + VeUnspecified = 0, + /// The value is encoded using V8 ValueSerializer encoding. + VeV8 = 1, + /// The value is encoded using little-endian 64-bit integer encoding. + VeLe64 = 2, + /// The value is a literal byte array. + VeBytes = 3, } impl ValueEncoding { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - ValueEncoding::VeUnspecified => "VE_UNSPECIFIED", - ValueEncoding::VeV8 => "VE_V8", - ValueEncoding::VeLe64 => "VE_LE64", - ValueEncoding::VeBytes => "VE_BYTES", - } + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ValueEncoding::VeUnspecified => "VE_UNSPECIFIED", + ValueEncoding::VeV8 => "VE_V8", + ValueEncoding::VeLe64 => "VE_LE64", + ValueEncoding::VeBytes => "VE_BYTES", } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VE_UNSPECIFIED" => Some(Self::VeUnspecified), - "VE_V8" => Some(Self::VeV8), - "VE_LE64" => Some(Self::VeLe64), - "VE_BYTES" => Some(Self::VeBytes), - _ => None, - } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VE_UNSPECIFIED" => Some(Self::VeUnspecified), + "VE_V8" => Some(Self::VeV8), + "VE_LE64" => Some(Self::VeLe64), + "VE_BYTES" => Some(Self::VeBytes), + _ => None, } + } } /// The status of an atomic write. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[derive( + Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, +)] #[repr(i32)] pub enum AtomicWriteStatus { - /// The write failed, but the exact status is unspecified or unknown. The - /// request should not be retried. - AwUnspecified = 0, - /// The write succeeded. - AwSuccess = 1, - /// The write failed because a check failed. - AwCheckFailure = 2, - /// The write failed because the region is unable to serve writes right now. - AwWriteDisabled = 5, + /// The write failed, but the exact status is unspecified or unknown. The + /// request should not be retried. + AwUnspecified = 0, + /// The write succeeded. + AwSuccess = 1, + /// The write failed because a check failed. + AwCheckFailure = 2, + /// The write failed because the region is unable to serve writes right now. + AwWriteDisabled = 5, } impl AtomicWriteStatus { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - AtomicWriteStatus::AwUnspecified => "AW_UNSPECIFIED", - AtomicWriteStatus::AwSuccess => "AW_SUCCESS", - AtomicWriteStatus::AwCheckFailure => "AW_CHECK_FAILURE", - AtomicWriteStatus::AwWriteDisabled => "AW_WRITE_DISABLED", - } + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + AtomicWriteStatus::AwUnspecified => "AW_UNSPECIFIED", + AtomicWriteStatus::AwSuccess => "AW_SUCCESS", + AtomicWriteStatus::AwCheckFailure => "AW_CHECK_FAILURE", + AtomicWriteStatus::AwWriteDisabled => "AW_WRITE_DISABLED", } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "AW_UNSPECIFIED" => Some(Self::AwUnspecified), - "AW_SUCCESS" => Some(Self::AwSuccess), - "AW_CHECK_FAILURE" => Some(Self::AwCheckFailure), - "AW_WRITE_DISABLED" => Some(Self::AwWriteDisabled), - _ => None, - } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "AW_UNSPECIFIED" => Some(Self::AwUnspecified), + "AW_SUCCESS" => Some(Self::AwSuccess), + "AW_CHECK_FAILURE" => Some(Self::AwCheckFailure), + "AW_WRITE_DISABLED" => Some(Self::AwWriteDisabled), + _ => None, } + } }