Skip to content

Commit 16e1882

Browse files
authored
Update documentation for new existing row information semantics
1 parent 3910c9c commit 16e1882

File tree

1 file changed

+69
-50
lines changed

1 file changed

+69
-50
lines changed

src/borneo/operations.py

+69-50
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,16 @@ def set_table_name(self, table_name):
714714

715715
def set_return_row(self, return_row):
716716
"""
717-
Sets whether information about the existing row should be returned on
718-
failure because of a version mismatch. If a match version has not been
719-
set via :py:meth:`set_match_version` this parameter is ignored and there
720-
will be no return information. This parameter is optional and defaults
717+
Sets whether information about the existing row should be returned.
718+
If set to true existing row information is returned if one of the
719+
following occurs:
720+
721+
PutOption.IF_VERSION is used and the operation fails because
722+
the row exists and its version does not match.\n
723+
PutOption.IF_VERSION is not used and the operation succeeds
724+
provided that the server supports providing the existing row.
725+
726+
This parameter is optional and defaults
721727
to False. It's use may incur additional cost.
722728
723729
:param return_row: set to True if information should be returned.
@@ -1945,9 +1951,17 @@ class PutRequest(WriteRequest):
19451951
specific :py:class:`Version`. Use PutOption.IF_VERSION for this case and
19461952
:py:meth:`set_match_version` to specify the version to match.
19471953
1948-
Information about the existing row can be returned on failure of a put
1949-
operation using PutOption.IF_VERSION or PutOption.IF_ABSENT by using
1950-
:py:meth:`set_return_row`. Requesting this information incurs additional
1954+
Information about the existing row can be optionally returned if
1955+
:py:meth:`set_return_row` is set to true and one of the following occurs:
1956+
1957+
PutOption.IF_ABSENT is used and the operation fails because
1958+
the row already exists.\n
1959+
PutOption.IF_VERSION is used and the operation fails because
1960+
the row exists and its version does not match.\n
1961+
PutOption.IF_PRESENT is used and the operation succeeds
1962+
provided that the server supports providing the existing row.
1963+
1964+
Requesting this information incurs additional
19511965
cost and may affect operation latency.
19521966
19531967
On a successful operation the :py:class:`Version` returned by
@@ -2269,9 +2283,19 @@ def set_table_name(self, table_name):
22692283

22702284
def set_return_row(self, return_row):
22712285
"""
2272-
Sets whether information about the exist row should be returned on
2273-
failure because of a version mismatch or failure of an "if absent"
2274-
operation.
2286+
Sets whether information about the exist row should be returned.
2287+
If set to true, information about the existing row will be returned
2288+
if one of the following occurs:
2289+
2290+
PutOption.IF_ABSENT is used and the operation fails because
2291+
the row already exists.\n
2292+
PutOption.IF_VERSION is used and the operation fails because
2293+
the row exists and its version does not match.\n
2294+
PutOption.IF_PRESENT is used and the operation succeeds
2295+
provided that the server supports providing the existing row.
2296+
2297+
Requesting this information incurs additional
2298+
cost and may affect operation latency.
22752299
22762300
:param return_row: set to True if information should be returned.
22772301
:type return_row: bool
@@ -2284,11 +2308,7 @@ def set_return_row(self, return_row):
22842308

22852309
def get_return_row(self):
22862310
"""
2287-
Returns whether information about the exist row should be returned on
2288-
failure because of a version mismatch or failure of an "if absent"
2289-
operation. If no option is set via :py:meth:`set_option` or the option
2290-
is PutOption.IF_PRESENT the value of this parameter is ignored and there
2291-
will not be any return information.
2311+
Returns whether information about the exist row should be returned.
22922312
22932313
:returns: True if information should be returned.
22942314
:rtype: bool
@@ -4738,7 +4758,8 @@ class DeleteResult(WriteResult):
47384758
47394759
If the delete succeeded :py:meth:`get_success` returns True. Information
47404760
about the existing row on failure may be available using
4741-
:py:meth:`get_existing_value` and :py:meth:`get_existing_version`, depending
4761+
:py:meth:`get_existing_value`, :py:meth:`get_existing_version` and
4762+
:py:meth:`get_existing_modification_time`, depending
47424763
on the use of :py:meth:`DeleteRequest.set_return_row`.
47434764
"""
47444765

@@ -4764,11 +4785,9 @@ def get_success(self):
47644785

47654786
def get_existing_value(self):
47664787
"""
4767-
Returns the existing row value if available. It will be available if the
4768-
target row exists and the operation failed because of a
4769-
:py:class:`Version` mismatch and the corresponding
4770-
:py:class:`DeleteRequest` the method
4771-
:py:meth:`DeleteRequest.set_return_row` was called with a True value.
4788+
Returns the existing row value if available. See
4789+
:py:meth:`DeleteRequest.set_return_row` for conditions under which
4790+
the information is available.
47724791
47734792
:returns: the value.
47744793
:rtype: dict
@@ -4777,11 +4796,9 @@ def get_existing_value(self):
47774796

47784797
def get_existing_version(self):
47794798
"""
4780-
Returns the existing row :py:class:`Version` if available. It will be
4781-
available if the target row exists and the operation failed because of a
4782-
:py:class:`Version` mismatch and the corresponding
4783-
:py:class:`DeleteRequest` the method
4784-
:py:meth:`DeleteRequest.set_return_row` was called with a True value.
4799+
Returns the existing row :py:class:`Version` if available. See
4800+
:py:meth:`DeleteRequest.set_return_row` for conditions under which
4801+
the information is available.
47854802
47864803
:returns: the version.
47874804
:rtype: Version
@@ -4790,11 +4807,9 @@ def get_existing_version(self):
47904807

47914808
def get_existing_modification_time(self):
47924809
"""
4793-
Returns the existing row modification time if available. It will be
4794-
available if the target row exists and the operation failed because of a
4795-
:py:class:`Version` mismatch and the corresponding
4796-
:py:class:`DeleteRequest` the method
4797-
:py:meth:`DeleteRequest.set_return_row` was called with a True value.
4810+
Returns the existing row modification time if available. See
4811+
:py:meth:`DeleteRequest.set_return_row` for conditions under which
4812+
the information is available.
47984813
47994814
:returns: the modification time in milliseconds since January 1, 1970
48004815
:rtype: int
@@ -5210,10 +5225,18 @@ class PutResult(WriteResult):
52105225
52115226
On a successful operation the value returned by :py:meth:`get_version`
52125227
is non-none. On failure that value is None. Information about the existing
5213-
row on failure may be available using :py:meth:`get_existing_value` and
5214-
:py:meth:`get_existing_version`, depending on the use of
5215-
:py:meth:`PutRequest.set_return_row` and whether the put had an option set
5216-
using :py:meth:`PutRequest.set_option`.
5228+
row may be available if :py:meth:`PutRequest.set_return_row` is set to
5229+
true and one of the following occurs:
5230+
5231+
PutOption.IF_ABSENT is used and the operation fails because
5232+
the row already exists.\n
5233+
PutOption.IF_VERSION is used and the operation fails because
5234+
the row exists and its version does not match.\n
5235+
PutOption.IF_PRESENT is used and the operation succeeds
5236+
provided that the server supports providing the existing row.\n
5237+
PutOption is not used and put operation replaces the
5238+
existing row provided that the server supports providing the existing
5239+
row.
52175240
"""
52185241

52195242
def __init__(self):
@@ -5256,10 +5279,9 @@ def get_generated_value(self):
52565279

52575280
def get_existing_version(self):
52585281
"""
5259-
Returns the existing row :py:class:`Version` if available. This value
5260-
will only be available if the conditional put operation failed and the
5261-
request specified that return information be returned using
5262-
:py:meth:`PutRequest.set_return_row`.
5282+
Returns the existing row :py:class:`Version` if available. See
5283+
:py:meth:`PutRequest.set_return_row` for conditions under which
5284+
the information is available.
52635285
52645286
:returns: the :py:class:`Version`.
52655287
:rtype: Version
@@ -5268,10 +5290,9 @@ def get_existing_version(self):
52685290

52695291
def get_existing_value(self):
52705292
"""
5271-
Returns the existing row value if available. This value will only be
5272-
available if the conditional put operation failed and the request
5273-
specified that return information be returned using
5274-
:py:meth:`PutRequest.set_return_row`.
5293+
Returns the existing row value if available. See
5294+
:py:meth:`PutRequest.set_return_row` for conditions under which
5295+
the information is available.
52755296
52765297
:returns: the value.
52775298
:rtype: dict
@@ -5280,11 +5301,9 @@ def get_existing_value(self):
52805301

52815302
def get_existing_modification_time(self):
52825303
"""
5283-
Returns the existing row modification time if available. It will be
5284-
available if the conditional put operation failed and the request
5285-
specified that return information be returned using
5286-
:py:meth:`PutRequest.set_return_row`. A value of -1 indicates this
5287-
feature is not available at the connected server.
5304+
Returns the existing row modification timeif available. See
5305+
:py:meth:`PutRequest.set_return_row` for conditions under which
5306+
the information is available.
52885307
52895308
:returns: the modification time in milliseconds since January 1, 1970
52905309
:rtype: int
@@ -6549,9 +6568,9 @@ def get_existing_version(self):
65496568

65506569
def get_existing_value(self):
65516570
"""
6552-
Returns the previous row value associated with the key if available.
6571+
Returns the existing row value associated with the key if available.
65536572
6554-
:returns: the previous row value
6573+
:returns: the existing row value
65556574
:rtype: dict
65566575
"""
65576576
return self._get_existing_value()

0 commit comments

Comments
 (0)