1
1
/// Request payload to be used for `GetObject` API call to server.
2
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
3
2
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
4
3
pub struct GetObjectRequest {
5
4
/// `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)
7
6
/// All APIs operate within a single `store_id`.
8
7
/// It is up to clients to use single or multiple stores for their use-case.
9
8
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -21,24 +20,22 @@ pub struct GetObjectRequest {
21
20
///
22
21
/// Read Isolation:
23
22
/// 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
25
24
#[ prost( string, tag = "2" ) ]
26
25
pub key : :: prost:: alloc:: string:: String ,
27
26
}
28
27
/// Server response for `GetObject` API.
29
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
30
28
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
31
29
pub struct GetObjectResponse {
32
30
/// Fetched `value` and `version` along with the corresponding `key` in the request.
33
31
#[ prost( message, optional, tag = "2" ) ]
34
32
pub value : :: core:: option:: Option < KeyValue > ,
35
33
}
36
34
/// Request payload to be used for `PutObject` API call to server.
37
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
38
35
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
39
36
pub struct PutObjectRequest {
40
37
/// `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)
42
39
/// All APIs operate within a single `store_id`.
43
40
/// It is up to clients to use single or multiple stores for their use-case.
44
41
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -75,25 +72,25 @@ pub struct PutObjectRequest {
75
72
/// All Items in a single `PutObjectRequest` must have distinct keys.
76
73
///
77
74
/// 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.
82
79
///
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.
88
85
///
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.
91
88
///
92
89
/// 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`.
97
94
///
98
95
/// Considerations for transactions:
99
96
/// Transaction writes of multiple items have a performance overhead, hence it is recommended to use
@@ -112,18 +109,18 @@ pub struct PutObjectRequest {
112
109
/// Each item in the `delete_items` field consists of a `key` and its corresponding `version`.
113
110
///
114
111
/// 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.
118
115
///
119
116
/// 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.
122
119
///
123
120
/// 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.
127
124
///
128
125
/// Multiple items in the `delete_items` field, along with the `transaction_items`, are written in a
129
126
/// database transaction in an all-or-nothing fashion.
@@ -133,15 +130,13 @@ pub struct PutObjectRequest {
133
130
pub delete_items : :: prost:: alloc:: vec:: Vec < KeyValue > ,
134
131
}
135
132
/// Server response for `PutObject` API.
136
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
137
133
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
138
134
pub struct PutObjectResponse { }
139
135
/// Request payload to be used for `DeleteObject` API call to server.
140
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
141
136
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
142
137
pub struct DeleteObjectRequest {
143
138
/// `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)
145
140
/// All APIs operate within a single `store_id`.
146
141
/// It is up to clients to use single or multiple stores for their use-case.
147
142
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -153,12 +148,12 @@ pub struct DeleteObjectRequest {
153
148
/// An item consists of a `key` and its corresponding `version`.
154
149
///
155
150
/// 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.
158
153
///
159
154
/// 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.
162
157
///
163
158
/// This operation is idempotent, that is, multiple delete calls for the same item will not fail.
164
159
///
@@ -168,15 +163,13 @@ pub struct DeleteObjectRequest {
168
163
pub key_value : :: core:: option:: Option < KeyValue > ,
169
164
}
170
165
/// Server response for `DeleteObject` API.
171
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
172
166
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
173
167
pub struct DeleteObjectResponse { }
174
168
/// Request payload to be used for `ListKeyVersions` API call to server.
175
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
176
169
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
177
170
pub struct ListKeyVersionsRequest {
178
171
/// `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)
180
173
/// All APIs operate within a single `store_id`.
181
174
/// It is up to clients to use single or multiple stores for their use-case.
182
175
/// This can be used for client-isolation/ rate-limiting / throttling on the server-side.
@@ -209,7 +202,6 @@ pub struct ListKeyVersionsRequest {
209
202
pub page_token : :: core:: option:: Option < :: prost:: alloc:: string:: String > ,
210
203
}
211
204
/// Server response for `ListKeyVersions` API.
212
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
213
205
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
214
206
pub struct ListKeyVersionsResponse {
215
207
/// Fetched keys and versions.
@@ -238,9 +230,9 @@ pub struct ListKeyVersionsResponse {
238
230
///
239
231
/// In case of refreshing the complete key-version view on the client-side, correct usage for
240
232
/// 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.
244
236
/// This ensures that on client-side, all current `key_versions` were stored at `global_version` or later.
245
237
/// This guarantee is helpful for ensuring the versioning correctness if using the `global_version`
246
238
/// in `PutObject` API and can help avoid the race conditions related to it.
@@ -249,7 +241,6 @@ pub struct ListKeyVersionsResponse {
249
241
}
250
242
/// When HttpStatusCode is not ok (200), the response `content` contains a serialized `ErrorResponse`
251
243
/// with the relevant `ErrorCode` and `message`
252
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
253
244
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
254
245
pub struct ErrorResponse {
255
246
/// The error code uniquely identifying an error condition.
@@ -264,7 +255,6 @@ pub struct ErrorResponse {
264
255
pub message : :: prost:: alloc:: string:: String ,
265
256
}
266
257
/// Represents a key-value pair to be stored or retrieved.
267
- #[ allow( clippy:: derive_partial_eq_without_eq) ]
268
258
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
269
259
pub struct KeyValue {
270
260
/// Key against which the value is stored.
@@ -294,39 +284,13 @@ pub enum ErrorCode {
294
284
/// in `PutObjectRequest`. For more info refer `PutObjectRequest`.
295
285
ConflictException = 1 ,
296
286
/// 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.
300
290
InvalidRequestException = 2 ,
301
291
/// Used when an internal server error occurred, client is probably at no fault and can safely retry
302
292
/// this error with exponential backoff.
303
293
InternalServerException = 3 ,
304
294
/// Used when the specified `key` in a `GetObjectRequest` does not exist.
305
295
NoSuchKeyException = 4 ,
306
296
}
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