diff --git a/lib/database.js b/lib/database.js index 36274fc..efa02ac 100644 --- a/lib/database.js +++ b/lib/database.js @@ -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. @@ -81,19 +84,19 @@ 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. @@ -101,12 +104,12 @@ class db { * 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. @@ -114,13 +117,13 @@ class db { * 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. @@ -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); } /** @@ -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. @@ -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. @@ -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. @@ -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.