Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #43 from lukaszstolarczuk/use-get_keys-functions-p…
Browse files Browse the repository at this point in the history
…roperly

Call get_keys*() functions properly
  • Loading branch information
Szymon Romik authored Oct 4, 2019
2 parents 6701e0c + bdb068b commit 55ede0b
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@

const pmemkv = require('bindings')('pmemkv');

/** @class Main Node.js pmemkv class, it provides functions to operate on data in database. */
/** @class Main Node.js pmemkv class, it provides functions to operate on data in database.
* If an error/exception is thrown from a method it will contain *status* variable.
* Possible statuses are enumerated in constants.status.
*/
class db {
/**
* Creates an instance of db.
Expand Down Expand Up @@ -81,46 +84,46 @@ class db {

/**
* Executes function for every record stored in db. Callback is called
* only with key of each record.
* only with the key of each record.
*
* @throws {Error} on any failure.
* @param {Function} callback - function to be called for every element stored in db.
* It has only one param - key (for each returned element).
*/
get_keys(callback) {
this._db.get_all(callback);
this._db.get_keys(callback);
}

/**
* Executes function for every record stored in db, whose keys are
* greater than *key*. Callback is called only with key of each record.
* Executes function for every record stored in db, whose keys are greater
* than the given *key*. Callback is called only with the key of each record.
*
* @throws {Error} on any failure.
* @param {string} key - sets the lower bound for querying.
* @param {Function} callback - function to be called for each returned element.
* It has only one param - key (for each returned element).
*/
get_keys_above(key, callback) {
this._db.get_above(key, callback);
this._db.get_keys_above(key, callback);
}

/**
* Executes function for every record stored in db, whose keys are
* less than the *key*. Callback is called only with key of each record.
* Executes function for every record stored in db, whose keys are less than
* the given *key*. Callback is called only with the key of each record.
*
* @throws {Error} on any failure.
* @param {string} key - sets the upper bound for querying.
* @param {Function} callback - function to be called for each returned element.
* It has only one param - key (for each returned element).
*/
get_keys_below(key, callback) {
this._db.get_below(key, callback);
this._db.get_keys_below(key, callback);
}

/**
* Executes function for every record stored in db, whose keys are
* greater than *key1* and less than *key2*. Callback is called
* only with key of each record.
* greater than the *key1* and less than the *key2*. Callback is
* called only with the key of each record.
*
* @throws {Error} on any failure.
* @param {string} key1 - sets the lower bound for querying.
Expand All @@ -129,7 +132,7 @@ class db {
* It has only one param - key (for each returned element).
*/
get_keys_between(key1, key2, callback) {
this._db.get_between(key1, key2, callback);
this._db.get_keys_between(key1, key2, callback);
}

/**
Expand Down Expand Up @@ -171,7 +174,7 @@ class db {

/**
* Returns number of currently stored elements in db, whose keys are
* greater than *key1* and less than *key2*.
* greater than the *key1* and less than the *key2*.
*
* @throws {Error} on any failure.
* @param {string} key1 - sets the lower bound of counting.
Expand All @@ -195,7 +198,7 @@ class db {

/**
* Executes function for every record stored in db, whose keys are
* greater than *key*.
* greater than the given *key*.
*
* @throws {Error} on any failure.
* @param {string} key - sets the lower bound for querying.
Expand All @@ -207,7 +210,7 @@ class db {

/**
* Executes function for every record stored in db, whose keys are
* less than the *key*.
* less than the given *key*.
*
* @throws {Error} on any failure.
* @param {string} key - sets the upper bound for querying.
Expand All @@ -219,7 +222,7 @@ class db {

/**
* Executes function for every record stored in db, whose keys are
* greater than *key1* and less than *key2*.
* greater than the *key1* and less than the *key2*.
*
* @throws {Error} on any failure.
* @param {string} key1 - sets the lower bound for querying.
Expand Down

0 comments on commit 55ede0b

Please sign in to comment.