Skip to content

Commit c0591d7

Browse files
committed
Downgrade prost-build to support for lower msrv
1 parent a2184f5 commit c0591d7

File tree

2 files changed

+39
-75
lines changed

2 files changed

+39
-75
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ prost = "0.11.6"
1616
reqwest = { version = "0.11.13", features = ["rustls-tls"] }
1717

1818
[build-dependencies]
19-
prost-build = { version = "0.11.3" }
19+
prost-build = { version = "0.8.0" }
2020
reqwest = { version = "0.11.13", features = ["blocking"] }
2121

2222
[dev-dependencies]

src/types.rs

Lines changed: 38 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/// Request payload to be used for `GetObject` API call to server.
2-
#[allow(clippy::derive_partial_eq_without_eq)]
32
#[derive(Clone, PartialEq, ::prost::Message)]
43
pub struct GetObjectRequest {
54
/// `store_id` is a keyspace identifier.
6-
/// Ref: <https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store>)
5+
/// Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
76
/// All APIs operate within a single `store_id`.
87
/// It is up to clients to use single or multiple stores for their use-case.
98
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -21,24 +20,22 @@ pub struct GetObjectRequest {
2120
///
2221
/// Read Isolation:
2322
/// Get/Read operations against a `key` are ensured to have read-committed isolation.
24-
/// Ref: <https://en.wikipedia.org/wiki/Isolation_(database_systems>)#Read_committed
23+
/// Ref: https://en.wikipedia.org/wiki/Isolation_(database_systems)#Read_committed
2524
#[prost(string, tag = "2")]
2625
pub key: ::prost::alloc::string::String,
2726
}
2827
/// Server response for `GetObject` API.
29-
#[allow(clippy::derive_partial_eq_without_eq)]
3028
#[derive(Clone, PartialEq, ::prost::Message)]
3129
pub struct GetObjectResponse {
3230
/// Fetched `value` and `version` along with the corresponding `key` in the request.
3331
#[prost(message, optional, tag = "2")]
3432
pub value: ::core::option::Option<KeyValue>,
3533
}
3634
/// Request payload to be used for `PutObject` API call to server.
37-
#[allow(clippy::derive_partial_eq_without_eq)]
3835
#[derive(Clone, PartialEq, ::prost::Message)]
3936
pub struct PutObjectRequest {
4037
/// `store_id` is a keyspace identifier.
41-
/// Ref: <https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store>)
38+
/// Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
4239
/// All APIs operate within a single `store_id`.
4340
/// It is up to clients to use single or multiple stores for their use-case.
4441
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -75,25 +72,25 @@ pub struct PutObjectRequest {
7572
/// All Items in a single `PutObjectRequest` must have distinct keys.
7673
///
7774
/// Key-level versioning (Conditional Write):
78-
/// Clients are expected to store a `version` against every `key`.
79-
/// The write will succeed if the current DB version against the `key` is the same as in the request.
80-
/// When initiating a `PutObjectRequest`, the request should contain their client-side `version`
81-
/// for that key-value.
75+
/// Clients are expected to store a `version` against every `key`.
76+
/// The write will succeed if the current DB version against the `key` is the same as in the request.
77+
/// When initiating a `PutObjectRequest`, the request should contain their client-side `version`
78+
/// for that key-value.
8279
///
83-
/// For the first write of any `key`, the `version` should be '0'. If the write succeeds, the client
84-
/// must increment their corresponding key versions (client-side) by 1.
85-
/// The server increments key versions (server-side) for every successful write, hence this
86-
/// client-side increment is required to ensure matching versions. These updated key versions should
87-
/// be used in subsequent `PutObjectRequest`s for the keys.
80+
/// For the first write of any `key`, the `version` should be '0'. If the write succeeds, the client
81+
/// must increment their corresponding key versions (client-side) by 1.
82+
/// The server increments key versions (server-side) for every successful write, hence this
83+
/// client-side increment is required to ensure matching versions. These updated key versions should
84+
/// be used in subsequent `PutObjectRequest`s for the keys.
8885
///
89-
/// Requests with a conflicting/mismatched version will fail with `CONFLICT_EXCEPTION` as ErrorCode
90-
/// for conditional writes.
86+
/// Requests with a conflicting/mismatched version will fail with `CONFLICT_EXCEPTION` as ErrorCode
87+
/// for conditional writes.
9188
///
9289
/// Skipping key-level versioning (Non-conditional Write):
93-
/// If you wish to skip key-level version checks, set the `version` against the `key` to '-1'.
94-
/// This will perform a non-conditional write query, after which the `version` against the `key`
95-
/// is reset to '1'. Hence, the next `PutObjectRequest` for the `key` can be either
96-
/// a non-conditional write or a conditional write with `version` set to `1`.
90+
/// If you wish to skip key-level version checks, set the `version` against the `key` to '-1'.
91+
/// This will perform a non-conditional write query, after which the `version` against the `key`
92+
/// is reset to '1'. Hence, the next `PutObjectRequest` for the `key` can be either
93+
/// a non-conditional write or a conditional write with `version` set to `1`.
9794
///
9895
/// Considerations for transactions:
9996
/// Transaction writes of multiple items have a performance overhead, hence it is recommended to use
@@ -112,18 +109,18 @@ pub struct PutObjectRequest {
112109
/// Each item in the `delete_items` field consists of a `key` and its corresponding `version`.
113110
///
114111
/// Key-Level Versioning (Conditional Delete):
115-
/// The `version` is used to perform a version check before deleting the item.
116-
/// The delete will only succeed if the current database version against the `key` is the same as
117-
/// the `version` specified in the request.
112+
/// The `version` is used to perform a version check before deleting the item.
113+
/// The delete will only succeed if the current database version against the `key` is the same as
114+
/// the `version` specified in the request.
118115
///
119116
/// Skipping key-level versioning (Non-conditional Delete):
120-
/// If you wish to skip key-level version checks, set the `version` against the `key` to '-1'.
121-
/// This will perform a non-conditional delete query.
117+
/// If you wish to skip key-level version checks, set the `version` against the `key` to '-1'.
118+
/// This will perform a non-conditional delete query.
122119
///
123120
/// Fails with `CONFLICT_EXCEPTION` as the ErrorCode if:
124-
/// * The requested item does not exist.
125-
/// * The requested item does exist but there is a version-number mismatch (in conditional delete)
126-
/// with the one in the database.
121+
/// * The requested item does not exist.
122+
/// * The requested item does exist but there is a version-number mismatch (in conditional delete)
123+
/// with the one in the database.
127124
///
128125
/// Multiple items in the `delete_items` field, along with the `transaction_items`, are written in a
129126
/// database transaction in an all-or-nothing fashion.
@@ -133,15 +130,13 @@ pub struct PutObjectRequest {
133130
pub delete_items: ::prost::alloc::vec::Vec<KeyValue>,
134131
}
135132
/// Server response for `PutObject` API.
136-
#[allow(clippy::derive_partial_eq_without_eq)]
137133
#[derive(Clone, PartialEq, ::prost::Message)]
138134
pub struct PutObjectResponse {}
139135
/// Request payload to be used for `DeleteObject` API call to server.
140-
#[allow(clippy::derive_partial_eq_without_eq)]
141136
#[derive(Clone, PartialEq, ::prost::Message)]
142137
pub struct DeleteObjectRequest {
143138
/// `store_id` is a keyspace identifier.
144-
/// Ref: <https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store>)
139+
/// Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
145140
/// All APIs operate within a single `store_id`.
146141
/// It is up to clients to use single or multiple stores for their use-case.
147142
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -153,12 +148,12 @@ pub struct DeleteObjectRequest {
153148
/// An item consists of a `key` and its corresponding `version`.
154149
///
155150
/// Key-level Versioning (Conditional Delete):
156-
/// The item is only deleted if the current database version against the `key` is the same as
157-
/// the `version` specified in the request.
151+
/// The item is only deleted if the current database version against the `key` is the same as
152+
/// the `version` specified in the request.
158153
///
159154
/// Skipping key-level versioning (Non-conditional Delete):
160-
/// If you wish to skip key-level version checks, set the `version` against the `key` to '-1'.
161-
/// This will perform a non-conditional delete query.
155+
/// If you wish to skip key-level version checks, set the `version` against the `key` to '-1'.
156+
/// This will perform a non-conditional delete query.
162157
///
163158
/// This operation is idempotent, that is, multiple delete calls for the same item will not fail.
164159
///
@@ -168,15 +163,13 @@ pub struct DeleteObjectRequest {
168163
pub key_value: ::core::option::Option<KeyValue>,
169164
}
170165
/// Server response for `DeleteObject` API.
171-
#[allow(clippy::derive_partial_eq_without_eq)]
172166
#[derive(Clone, PartialEq, ::prost::Message)]
173167
pub struct DeleteObjectResponse {}
174168
/// Request payload to be used for `ListKeyVersions` API call to server.
175-
#[allow(clippy::derive_partial_eq_without_eq)]
176169
#[derive(Clone, PartialEq, ::prost::Message)]
177170
pub struct ListKeyVersionsRequest {
178171
/// `store_id` is a keyspace identifier.
179-
/// Ref: <https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store>)
172+
/// Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
180173
/// All APIs operate within a single `store_id`.
181174
/// It is up to clients to use single or multiple stores for their use-case.
182175
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -209,7 +202,6 @@ pub struct ListKeyVersionsRequest {
209202
pub page_token: ::core::option::Option<::prost::alloc::string::String>,
210203
}
211204
/// Server response for `ListKeyVersions` API.
212-
#[allow(clippy::derive_partial_eq_without_eq)]
213205
#[derive(Clone, PartialEq, ::prost::Message)]
214206
pub struct ListKeyVersionsResponse {
215207
/// Fetched keys and versions.
@@ -238,9 +230,9 @@ pub struct ListKeyVersionsResponse {
238230
///
239231
/// In case of refreshing the complete key-version view on the client-side, correct usage for
240232
/// the returned `global_version` is as following:
241-
/// 1. Read `global_version` from the first page of paginated response and save it as local variable.
242-
/// 2. Update all the `key_versions` on client-side from all the pages of paginated response.
243-
/// 3. Update `global_version` on client_side from the local variable saved in step-1.
233+
/// 1. Read `global_version` from the first page of paginated response and save it as local variable.
234+
/// 2. Update all the `key_versions` on client-side from all the pages of paginated response.
235+
/// 3. Update `global_version` on client_side from the local variable saved in step-1.
244236
/// This ensures that on client-side, all current `key_versions` were stored at `global_version` or later.
245237
/// This guarantee is helpful for ensuring the versioning correctness if using the `global_version`
246238
/// in `PutObject` API and can help avoid the race conditions related to it.
@@ -249,7 +241,6 @@ pub struct ListKeyVersionsResponse {
249241
}
250242
/// When HttpStatusCode is not ok (200), the response `content` contains a serialized `ErrorResponse`
251243
/// with the relevant `ErrorCode` and `message`
252-
#[allow(clippy::derive_partial_eq_without_eq)]
253244
#[derive(Clone, PartialEq, ::prost::Message)]
254245
pub struct ErrorResponse {
255246
/// The error code uniquely identifying an error condition.
@@ -264,7 +255,6 @@ pub struct ErrorResponse {
264255
pub message: ::prost::alloc::string::String,
265256
}
266257
/// Represents a key-value pair to be stored or retrieved.
267-
#[allow(clippy::derive_partial_eq_without_eq)]
268258
#[derive(Clone, PartialEq, ::prost::Message)]
269259
pub struct KeyValue {
270260
/// Key against which the value is stored.
@@ -294,39 +284,13 @@ pub enum ErrorCode {
294284
/// in `PutObjectRequest`. For more info refer `PutObjectRequest`.
295285
ConflictException = 1,
296286
/// Used in the following cases:
297-
/// - The request was missing a required argument.
298-
/// - The specified argument was invalid, incomplete or in the wrong format.
299-
/// - The request body of api cannot be deserialized into corresponding protobuf object.
287+
/// - The request was missing a required argument.
288+
/// - The specified argument was invalid, incomplete or in the wrong format.
289+
/// - The request body of api cannot be deserialized into corresponding protobuf object.
300290
InvalidRequestException = 2,
301291
/// Used when an internal server error occurred, client is probably at no fault and can safely retry
302292
/// this error with exponential backoff.
303293
InternalServerException = 3,
304294
/// Used when the specified `key` in a `GetObjectRequest` does not exist.
305295
NoSuchKeyException = 4,
306296
}
307-
impl ErrorCode {
308-
/// String value of the enum field names used in the ProtoBuf definition.
309-
///
310-
/// The values are not transformed in any way and thus are considered stable
311-
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
312-
pub fn as_str_name(&self) -> &'static str {
313-
match self {
314-
ErrorCode::Unknown => "UNKNOWN",
315-
ErrorCode::ConflictException => "CONFLICT_EXCEPTION",
316-
ErrorCode::InvalidRequestException => "INVALID_REQUEST_EXCEPTION",
317-
ErrorCode::InternalServerException => "INTERNAL_SERVER_EXCEPTION",
318-
ErrorCode::NoSuchKeyException => "NO_SUCH_KEY_EXCEPTION",
319-
}
320-
}
321-
/// Creates an enum from field names used in the ProtoBuf definition.
322-
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
323-
match value {
324-
"UNKNOWN" => Some(Self::Unknown),
325-
"CONFLICT_EXCEPTION" => Some(Self::ConflictException),
326-
"INVALID_REQUEST_EXCEPTION" => Some(Self::InvalidRequestException),
327-
"INTERNAL_SERVER_EXCEPTION" => Some(Self::InternalServerException),
328-
"NO_SUCH_KEY_EXCEPTION" => Some(Self::NoSuchKeyException),
329-
_ => None,
330-
}
331-
}
332-
}

0 commit comments

Comments
 (0)