How to use the aerospike.policy function in aerospike

To help you get started, we’ve selected a few aerospike examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aerospike-edu / student-workbook / deprecated / answers / Aggregations / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
            else {
              console.log("ERROR: User password update failed:\n", err);
            }
          });

        });
github aerospike-edu / student-workbook / deprecated / exercises / RecordUDF / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          // Set the generation count to the current one from the user record. 
          // Then, setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          // Setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
            else {
github aerospike-edu / student-workbook / deprecated / answers / Queries / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          // Set the generation count to the current one from the user record. 
          // Then, setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          // Setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
github aerospike-edu / student-workbook / deprecated / exercises / Aggregations / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          // Set the generation count to the current one from the user record. 
          // Then, setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          // Setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
github aerospike-edu / student-workbook / deprecated / exercises / RecordUDF / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          // Set the generation count to the current one from the user record. 
          // Then, setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          // Setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
            else {
              console.log("ERROR: User password update failed:\n", err);
            }
github aerospike-edu / student-workbook / deprecated / answers / Aggregations / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          // Set the generation count to the current one from the user record. 
          // Then, setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          // Setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
            else {
github aerospike-edu / student-workbook / deprecated / answers / Complete / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          // Set the generation count to the current one from the user record. 
          // Then, setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          // Setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
            else {
              console.log("ERROR: User password update failed:\n", err);
github aerospike-edu / student-workbook / deprecated / exercises / RecordUDF / Node / scripts / user_service.js View on Github external
inquirer.prompt( question2, function( answer2 ) {

          // Set the generation count to the current one from the user record. 
          // Then, setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          var metadata = {
            gen: meta.gen
          }

          var writePolicy = aerospike.policy;
          writePolicy.key = aerospike.policy.key.SEND;
          writePolicy.retry = aerospike.policy.retry.NONE;
          writePolicy.exists = aerospike.policy.exists.IGNORE;
          writePolicy.commitLevel = aerospike.policy.commitLevel.ALL;
          // Setting writePolicy.gen to aerospike.policy.gen.EQ will ensure we don't have a 'dirty-read' when updating user's password
          writePolicy.gen = aerospike.policy.gen.EQ; 

          var bin = {
            password: answer2.password
          };

          client.put(key, bin, metadata, writePolicy, function(err, rec) {
            // Check for errors
            if ( err.code === 0 ) {
              console.log("INFO: User password updated successfully!");
            }
github aerospike / aerospike-client-nodejs / examples / put.js View on Github external
function buildPolicy (argv) {
  const policy = { }
  if (argv.create) {
    policy.exists = Aerospike.policy.exists.CREATE
  }
  if (argv.replace) {
    policy.exists = Aerospike.policy.exists.REPLACE
  }
  if (argv.update) {
    policy.exists = Aerospike.policy.exists.UPDATE
  }
  return policy
}
github aerospike / aerospike-client-nodejs / examples / simple_put.js View on Github external
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

/*******************************************************************************
 *
 * Write a record.
 * 
 ******************************************************************************/

var fs = require('fs');
var aerospike = require('aerospike');
var yargs = require('yargs');

var Policy = aerospike.policy;
var Status = aerospike.status;

/*******************************************************************************
 *
 * Options parsing
 * 
 ******************************************************************************/

var argp = yargs
    .usage("$0 [options] ")
    .options({
        help: {
            boolean: true,
            describe: "Display this message."
        },
        profile: {