@@ -71,18 +71,26 @@ pub struct PutObjectRequest {
71
71
/// a database-transaction in an all-or-nothing fashion.
72
72
/// All Items in a single `PutObjectRequest` must have distinct keys.
73
73
///
74
- /// Clients are expected to store a `version` against every `key`.
75
- /// The write will succeed if the current DB version against the `key` is the same as in the request.
76
- /// When initiating a `PutObjectRequest`, the request should contain their client-side version for
77
- /// that key-value.
78
- ///
79
- /// For the first write of any key, the `version` should be '0'. If the write succeeds, the client
80
- /// must increment their corresponding key versions (client-side) by 1.
81
- /// The server increments key versions (server-side) for every successful write, hence this
82
- /// client-side increment is required to ensure matching versions. These updated key versions should
83
- /// be used in subsequent `PutObjectRequest`s for the keys.
74
+ /// Key-level versioning (Conditional Write):
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.
84
79
///
85
- /// Requests with a conflicting version will fail with `CONFLICT_EXCEPTION` as ErrorCode.
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.
85
+ ///
86
+ /// Requests with a conflicting/mismatched version will fail with `CONFLICT_EXCEPTION` as ErrorCode
87
+ /// for conditional writes.
88
+ ///
89
+ /// Skipping key-level versioning (Non-conditional Write):
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`.
86
94
///
87
95
/// Considerations for transactions:
88
96
/// Transaction writes of multiple items have a performance overhead, hence it is recommended to use
@@ -99,13 +107,20 @@ pub struct PutObjectRequest {
99
107
/// Items to be deleted as a result of this `PutObjectRequest`.
100
108
///
101
109
/// Each item in the `delete_items` field consists of a `key` and its corresponding `version`.
102
- /// The `version` is used to perform a version check before deleting the item.
103
- /// The delete will only succeed if the current database version against the `key` is the same as the `version`
104
- /// specified in the request.
110
+ ///
111
+ /// Key-Level Versioning (Conditional Delete):
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.
115
+ ///
116
+ /// Skipping key-level versioning (Non-conditional Delete):
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.
105
119
///
106
120
/// Fails with `CONFLICT_EXCEPTION` as the ErrorCode if:
107
121
/// * The requested item does not exist.
108
- /// * The requested item does exist but there is a version-number mismatch with the one in the database.
122
+ /// * The requested item does exist but there is a version-number mismatch (in conditional delete)
123
+ /// with the one in the database.
109
124
///
110
125
/// Multiple items in the `delete_items` field, along with the `transaction_items`, are written in a
111
126
/// database transaction in an all-or-nothing fashion.
@@ -133,8 +148,15 @@ pub struct DeleteObjectRequest {
133
148
/// Item to be deleted as a result of this `DeleteObjectRequest`.
134
149
///
135
150
/// An item consists of a `key` and its corresponding `version`.
136
- /// The item is only deleted if the current database version against the `key` is the same as the `version`
137
- /// specified in the request.
151
+ ///
152
+ /// Key-level Versioning (Conditional Delete):
153
+ /// The item is only deleted if the current database version against the `key` is the same as
154
+ /// the `version` specified in the request.
155
+ ///
156
+ /// Skipping key-level versioning (Non-conditional Delete):
157
+ /// If you wish to skip key-level version checks, set the `version` against the `key` to '-1'.
158
+ /// This will perform a non-conditional delete query.
159
+ ///
138
160
/// This operation is idempotent, that is, multiple delete calls for the same item will not fail.
139
161
///
140
162
/// If the requested item does not exist, this operation will not fail.
0 commit comments