Skip to content

Commit

Permalink
Merge pull request #265 from aerospike/f-cdt-policy
Browse files Browse the repository at this point in the history
Updated CDT op policy: Add list/map NO_FAIL/PARTIAL flags, new map write flags
  • Loading branch information
jhecking committed Jul 12, 2018
2 parents 997ff2c + 46acd81 commit 999ea73
Show file tree
Hide file tree
Showing 11 changed files with 661 additions and 137 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

* **New Features**
* Support list/map nearest key/value get/remove operations (relative rank range). Requires server version v4.3.0 or later. [#264](https://github.com/aerospike/aerospike-client-nodejs/pull/264)
* Support list write flags NO_FAIL and PARTIAL. Add new map write flags, including NO_FAIL and PARTIAL. Requires server version v4.3.0 or later. [#265](https://github.com/aerospike/aerospike-client-nodejs/pull/265)

* **Updates**
* Update C client library to [v4.3.14](http://www.aerospike.com/download/client/c/notes.html#4.3.14) [#263](https://github.com/aerospike/aerospike-client-nodejs/pull/263)

Expand Down
54 changes: 38 additions & 16 deletions lib/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*
* For more information, please refer to the
* <a href="http://www.aerospike.com/docs/guide/cdt-list.html">&uArr;Lists</a>
* and <a href="http://www.aerospike.com/docs/guide/cdt-list.html">&uArr;List Operations</a>
* documentation in the Aerospike Feature Guide.
*
* #### List Index
Expand Down Expand Up @@ -180,6 +181,11 @@ exports.sortFlags = as.lists.sortFlags
* @property {number} ADD_UNIQUE - Only add unique values.
* @property {number} INSERT_BOUNDED - Enforce list boundaries when inserting.
* Do not allow values to be inserted at index outside current list boundaries.
* @property {number} NO_FAIL - Do not raise error, if a list item fails due to
* write flag constraints. Requires Aerospike server v4.3.0 or later.
* @property {number} PARTIAL - Allow other valid list items to be committed,
* if a list item fails due to write flag constraints. Requires Aerospike
* server v4.3.0 or later.
*/
exports.writeFlags = as.lists.writeFlags

Expand Down Expand Up @@ -240,7 +246,9 @@ exports.sort = function (bin, flags) {
}

/**
* Appends an element to the end of a list.
* @summary Appends an element to the end of a list.
* @description This operation returns the element count of the list after the
* operation.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {any} value - The value to be appended.
Expand Down Expand Up @@ -279,7 +287,9 @@ exports.append = function (bin, value, policy) {
}

/**
* Appends a list of elements to the end of a list.
* @summary Appends a list of elements to the end of a list.
* @description This operation returns the element count of the list after the
* operation.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {Array<any>} list - Array of elements to be appended.
Expand Down Expand Up @@ -318,7 +328,9 @@ exports.appendItems = function (bin, list, policy) {
}

/**
* Inserts an element at the specified index.
* @summary Inserts an element at the specified index.
* @description This operation returns the element count of the list after the
* operation.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - List index at which the new element should be inserted.
Expand Down Expand Up @@ -359,10 +371,12 @@ exports.insert = function (bin, index, value, policy) {
}

/**
* Inserts a list of element at the specified index.
* @summary Inserts a list of elements at the specified index.
* @description This operation returns the element count of the list after the
* operation.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - List index at which the new element should be inserted.
* @param {number} index - List index at which the new elements should be inserted.
* @param {Array<any>} list - Array of elements to be inserted.
* @returns {Object} Operation that can be passed to the {@link Client#operate} command.
*
Expand Down Expand Up @@ -399,7 +413,7 @@ exports.insertItems = function (bin, index, list, policy) {
}

/**
* Removes and returns the list element at the specified index.
* @summary Removes and returns the list element at the specified index.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - List index of the element to be removed.
Expand Down Expand Up @@ -438,7 +452,7 @@ exports.pop = function (bin, index) {
}

/**
* Removes and returns the list elements at the specified range.
* @summary Removes and returns the list elements at the specified range.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the first element in the range.
Expand Down Expand Up @@ -479,7 +493,9 @@ exports.popRange = function (bin, index, count) {
}

/**
* Removes the list element at the specified index.
* @summary Removes the list element at the specified index.
* @description This operation returns the number of elements removed from the
* list.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the element to be removed
Expand Down Expand Up @@ -517,7 +533,9 @@ exports.remove = function (bin, index) {
}

/**
* Removes the list elements at the specified range.
* @summary Removes the list elements at the specified range.
* @description This operation returns the number of elements removed from the
* list.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the first element in the range.
Expand Down Expand Up @@ -840,7 +858,8 @@ exports.removeByRankRange = function (bin, rank, count, returnType) {
}

/**
* Removes all the elements from the list.
* @summary Removes all the elements from the list.
* @description This operation returns no result.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @returns {Object} Operation that can be passed to the {@link Client#operate} command.
Expand Down Expand Up @@ -875,7 +894,8 @@ exports.clear = function (bin) {
}

/**
* Sets the list element at the specified index to a new value.
* @summary Sets the list element at the specified index to a new value.
* @description This operation returns no result.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the element to be replaced.
Expand Down Expand Up @@ -915,7 +935,8 @@ exports.set = function (bin, index, value) {
}

/**
* Removes all list elements **not** within the specified range.
* @summary Removes all list elements **not** within the specified range.
* @description This operation returns the number of list elements removed.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the first element in the range.
Expand Down Expand Up @@ -955,7 +976,7 @@ exports.trim = function (bin, index, count) {
}

/**
* Returns the list element at the specified index.
* @summary Returns the list element at the specified index.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the element to be returned.
Expand Down Expand Up @@ -993,7 +1014,7 @@ exports.get = function (bin, index) {
}

/**
* Returns the list element at the specified range.
* @summary Returns the list element at the specified range.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the first element in the range.
Expand Down Expand Up @@ -1313,7 +1334,8 @@ exports.getByRankRange = function (bin, rank, count, returnType) {
}

/**
* Increments the value at the given list index and returns the final result.
* Increments the value at the given list index and returns the new value after
* increment.
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @param {number} index - Index of the list element to increment.
Expand Down Expand Up @@ -1358,7 +1380,7 @@ exports.increment = function (bin, index, value, policy) {
}

/**
* Returns the element count of the list
* @summary Returns the element count of the list
*
* @param {string} bin - The name of the bin. The bin must contain a List value.
* @returns {Object} Operation that can be passed to the {@link Client#operate} command.
Expand Down
Loading

0 comments on commit 999ea73

Please sign in to comment.