Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct behavior with invalid scan range #47

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions include/kvs.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,19 @@ put(Token token, std::string_view storage_name, // NOLINT
* @param[in] l_end If this argument is scan_endpoint::EXCLUSIVE, the interval
* does not include the endpoint. If this argument is scan_endpoint::INCLUSIVE,
* the interval contains the endpoint. If this is scan_endpoint::INF, there is
* no limit on the interval in left direction. And ignore @a l_key.
* no limit on the interval in left direction and `l_key` is ignored.
* @param[in] r_key An argument that specifies the right endpoint.
* @note If r_key <l_key is specified in dictionary order, nothing will be hit.
* @param[in] r_end If this argument is scan_endpoint :: EXCLUSIVE, the
* interval does not include the endpoint. If this argument is
* scan_endpoint::INCLUSIVE, the interval contains the endpoint. If this is
* scan_endpoint::INF, there is no limit on the interval in right direction.
* And ignore @a r_key.
* @param[in] r_end If this argument is scan_endpoint::EXCLUSIVE, the interval
* does not include the endpoint. If this argument is scan_endpoint::INCLUSIVE,
* the interval contains the endpoint. If this is scan_endpoint::INF, there is
* no limit on the interval in right direction and `r_key` is ignored.
* @note The interval defined by `l_key`, `l_end`, `r_key`, and `r_end` must represent a valid range
* and otherwise an error (Status::ERR_BAD_USAGE) will be returned. A range is invalid if any of the following
* conditions are satisfied.
* - neither `l_end` nor `r_end` is scan_endpoint::INF and `r_key` < `l_key`
* - neither `l_end` nor `r_end` is scan_endpoint::INF and `l_key` == `r_key` and either `l_end` or `r_end`
* is scan_endpoint::EXCLUSIVE
* - `r_key` is empty string and `r_end` is scan_endpoint::EXCLUSIVE
* @param[out] tuple_list A set with a key, a pointer to value, and size of
* value as a result of this function.
* The address obtained here can be accessed safely until the Token entered at the time of address acquisition leaves.
Expand All @@ -253,17 +258,14 @@ put(Token token, std::string_view storage_name, // NOLINT
* node_version_vec to guarantee atomicity, you can split the atomic scan.
* Suppose you want to scan with A: C, assuming the order A <B <C. You can
* perform an atomic scan by scanning the range A: B, B: C and using
* node_version_vec to make sure the values ​​are not overwritten. This advantage
* node_version_vec to make sure the values are not overwritten. This advantage
* is effective when the right end point is unknown but you want to scan to a
* specific value.
* @param[in] right_to_left If this argument is true, the scan is performed from right end.
* When this is set to true, current implementation has following limitation: 1. max_size must be 1 so that at most
* one entry is hit and returned as scan result 2. r_end must be scan_endpoint::INF so that the scan is performed from
* unbounded right end. Status::ERR_BAD_USAGE is returned if these conditions are not met.
* @return Status::ERR_BAD_USAGE The arguments is invalid. In the case1: you use
* same l_key and r_key and one of the endpoint is exclusive. case2: one of the
* endpoint use null key but the string size is not zero like
* std::string_view{nullptr, non-zero-value}.
* @return Status::ERR_BAD_USAGE The input argument or the range given by the arguments is invalid (see note above.)
* @return status::OK success.
* @return Status::OK_ROOT_IS_NULL success and root is null.
* @return status::WARN_STORAGE_NOT_EXIST The target storage of this operation
Expand Down