Skip to content

Commit a9c7f51

Browse files
authored
Update individual request doc with new return row information semantics
1 parent 68af392 commit a9c7f51

File tree

6 files changed

+72
-47
lines changed

6 files changed

+72
-47
lines changed

driver/src/main/java/oracle/nosql/driver/NoSQLHandle.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ public interface NoSQLHandle extends AutoCloseable {
133133
* by {@link DeleteRequest#setMatchVersion}.
134134
* <p>
135135
* It is also possible to return information about the existing
136-
* row. The row, including it's {@link Version} can be optionally returned.
136+
* row. The row, including it's {@link Version} and modification time
137+
* can be optionally returned.
137138
* The existing row information will only be returned if
138139
* {@link DeleteRequest#setReturnRow} is true and one of the following
139140
* occurs:
@@ -211,7 +212,8 @@ public interface NoSQLHandle extends AutoCloseable {
211212
* </ul>
212213
* <p>
213214
* It is also possible to return information about the existing
214-
* row. The row, including it's {@link Version} can be optionally returned.
215+
* row. The existing row, including it's {@link Version} and modification
216+
* time can be optionally returned.
215217
* The existing row information will only be returned if
216218
* {@link PutRequest#setReturnRow} is true and one of the following occurs:
217219
* <ul>

driver/src/main/java/oracle/nosql/driver/ops/DeleteRequest.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ public int getTimeout() {
131131
}
132132

133133
/**
134-
* Returns whether information about the existing row should be returned on
135-
* failure because of a version mismatch.
134+
* Returns whether information about the existing row should be returned.
135+
* See {@link DeleteRequest#setReturnRow} for details about what information
136+
* is returned.
136137
*
137138
* @return true if information should be returned.
138139
*/
@@ -194,10 +195,21 @@ public DeleteRequest setCompartment(String compartment) {
194195
}
195196

196197
/**
197-
* Sets whether information about the existing row should be returned on
198-
* failure because of a version mismatch. If a match version has not been
199-
* set via {@link #setMatchVersion} this parameter is ignored and there
200-
* will be no return information. This parameter is optional and defaults
198+
* Sets whether information about the existing row should be returned.
199+
* The existing row information, including the value, version, and
200+
* modification time, will only be returned if
201+
* {@link DeleteRequest#setReturnRow} is true and one of the following
202+
* occurs:
203+
* <ul>
204+
* <li> The {@link DeleteRequest#setMatchVersion} is used and the operation
205+
* fails because the row exists and its version does not match.
206+
* </li>
207+
* <li> The {@link DeleteRequest#setMatchVersion} is not used and the
208+
* operation succeeds provided that the server supports providing the
209+
* existing row.
210+
* </li>
211+
* </ul>
212+
* This parameter is optional and defaults
201213
* to false. It's use may incur additional cost.
202214
*
203215
* @param value set to true if information should be returned

driver/src/main/java/oracle/nosql/driver/ops/DeleteResult.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
* Represents the result of a {@link NoSQLHandle#delete} operation.
1616
* <p>
1717
* If the delete succeeded {@link #getSuccess} returns true.
18-
* Information about the existing row on failure may be
19-
* available using {@link #getExistingValue} and
20-
*.{@link #getExistingVersion}, depending on the use of
21-
* {@link DeleteRequest#setReturnRow}.
18+
* Information about the existing row may be
19+
* available using {@link #getExistingValue},
20+
*.{@link #getExistingVersion} and {@link #getExistingModificationTime},
21+
* depending on the use of {@link DeleteRequest#setReturnRow} and the result
22+
* of the operation.
2223
* @see NoSQLHandle#delete
2324
*/
2425
public class DeleteResult extends WriteResult {
@@ -34,10 +35,9 @@ public boolean getSuccess() {
3435
}
3536

3637
/**
37-
* Returns the existing row {@link Version} if available. It will be
38-
* available if the target row exists and the operation failed because of a
39-
* {@link Version} mismatch and the corresponding {@link DeleteRequest} the
40-
* method {@link DeleteRequest#setReturnRow} was called with a true value.
38+
* Returns the existing row {@link Version} if available. This value will
39+
* only be available if the conditions specified in
40+
* {@link DeleteRequest#setReturnRow} are met.
4141
*
4242
* @return the Version
4343
*/
@@ -46,10 +46,9 @@ public Version getExistingVersion() {
4646
}
4747

4848
/**
49-
* Returns the existing row value if available. It will be available if the
50-
* target row exists and the operation failed because of a {@link Version}
51-
* mismatch and the corresponding {@link DeleteRequest} the method {@link
52-
* DeleteRequest#setReturnRow} was called with a true value.
49+
* Returns the existing row value if available. This value will
50+
* only be available if the conditions specified in
51+
* {@link DeleteRequest#setReturnRow} are met.
5352
*
5453
* @return the value
5554
*/
@@ -58,10 +57,9 @@ public MapValue getExistingValue() {
5857
}
5958

6059
/**
61-
* Returns the existing modification time if available. This is available
62-
* only if the target row exists and the operation failed because of a
63-
* {@link Version} mismatch and the corresponding {@link DeleteRequest}
64-
* method {@link DeleteRequest#setReturnRow} was called with a true value.
60+
* Returns the existing modification time if available. This value will
61+
* only be available if the conditions specified in
62+
* {@link DeleteRequest#setReturnRow} are met.
6563
*
6664
* @return the modification time in milliseconds since Jan 1, 1970
6765
*

driver/src/main/java/oracle/nosql/driver/ops/PutRequest.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,9 @@ public int getTimeout() {
268268
}
269269

270270
/**
271-
* Returns whether information about the exist row should be returned on
272-
* failure because of a version mismatch or failure of an "if absent"
273-
* operation. If no option is set via {@link #setOption} or the option is
274-
* {@link Option#IfPresent} the value of this parameter is ignored and there
275-
* will not be any return information.
271+
* Returns whether information about the existing row should be returned.
272+
* See {@link PutRequest#setReturnRow} for details on the return
273+
* information.
276274
*
277275
* @return true if information should be returned.
278276
*/
@@ -295,9 +293,27 @@ public PutRequest setTableName(String tableName) {
295293
}
296294

297295
/**
298-
* Sets whether information about the exist row should be returned on
299-
* failure because of a version mismatch or failure of an "if absent"
300-
* operation.
296+
* Sets whether information about the existing row should be returned.
297+
* The existing row information, including the value, Version, and
298+
* modification time, will only be returned if
299+
* {@link PutRequest#setReturnRow} is true and one of the following occurs:
300+
* <ul>
301+
* <li>The {@link Option#IfAbsent} is used and the operation fails because
302+
* the row already exists.</li>
303+
* <li>The {@link Option#IfVersion} is used and the operation fails because
304+
* the row exists and its version does not match.
305+
* </li>
306+
* <li>The {@link Option#IfPresent} is used and the operation succeeds
307+
* provided that the server supports providing the existing row.
308+
* </li>
309+
* <li>The {@link Option} is not used and put operation replaces the
310+
* existing row provided that the server supports providing the existing
311+
* row.
312+
* </li>
313+
* </ul>
314+
*
315+
* This setting is optional and defaults to false. If true the operation
316+
* will incur additional cost.
301317
*
302318
* @param value set to true if information should be returned
303319
*

driver/src/main/java/oracle/nosql/driver/ops/PutResult.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
* <p>
1818
* On a successful operation the value returned by {@link #getVersion} is
1919
* non-null. On failure that value is null. Information about the
20-
* existing row on failure may be available using
21-
* {@link #getExistingValue} and.{@link #getExistingVersion}, depending on the
22-
* use of {@link PutRequest#setReturnRow} and whether the put had an option set
23-
* using {@link PutRequest#setOption}.
20+
* existing row may be available using
21+
* {@link #getExistingValue}, {@link #getExistingVersion}, and
22+
* {@link #getExistingModificationTime}, depending on the
23+
* use of {@link PutRequest#setReturnRow} and the results of the operation.
2424
* @see NoSQLHandle#put
2525
*/
2626
public class PutResult extends WriteResult {
@@ -49,9 +49,8 @@ public PutResult setVersion(Version version) {
4949

5050
/**
5151
* Returns the existing row {@link Version} if available. This value will
52-
* only be available if the conditional put operation failed and the request
53-
* specified that return information be returned using
54-
* {@link PutRequest#setReturnRow}.
52+
* only be available if the conditions specified in
53+
* {@link PutRequest#setReturnRow} are met.
5554
*
5655
* @return the Version
5756
*/
@@ -61,9 +60,8 @@ public Version getExistingVersion() {
6160

6261
/**
6362
* Returns the existing row value if available. This value will
64-
* only be available if the conditional put operation failed and the request
65-
* specified that return information be returned using
66-
* {@link PutRequest#setReturnRow}.
63+
* only be available if the conditions specified in
64+
* {@link PutRequest#setReturnRow} are met.
6765
*
6866
* @return the value
6967
*/
@@ -73,9 +71,8 @@ public MapValue getExistingValue() {
7371

7472
/**
7573
* Returns the existing modification time if available. This value will
76-
* only be available if the conditional put operation failed and the request
77-
* specified that return information be returned using
78-
* {@link PutRequest#setReturnRow}.
74+
* only be available if the conditions specified in
75+
* {@link PutRequest#setReturnRow} are met.
7976
*
8077
* @return the existing modification time in milliseconds since Jan 1, 1970
8178
*

driver/src/main/java/oracle/nosql/driver/ops/WriteMultipleResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ public Version getExistingVersion() {
209209
}
210210

211211
/**
212-
* Returns the previous row value associated with the key if available.
212+
* Returns the existing row value associated with the key if available.
213213
* @return the existing value if set
214214
*/
215215
public MapValue getExistingValue() {
216216
return super.getExistingValueInternal();
217217
}
218218

219219
/**
220-
* Returns the previous modification time associated with the key if
220+
* Returns the existing modification time associated with the key if
221221
* available.
222222
* @return the modification time if set, in milliseconds sine Jan 1,
223223
* 1970

0 commit comments

Comments
 (0)