congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Key.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.aerospike.client.Key
constructor

Best Java code snippets using com.aerospike.client.Key.<init> (Showing top 20 results out of 315)

origin: brianfrankcooper/YCSB

 @Override
 public Status delete(String table, String key) {
  try {
   if (!client.delete(deletePolicy, new Key(namespace, table, key))) {
    System.err.println("Record key " + key + " not found (delete)");
    return Status.ERROR;
   }

   return Status.OK;
  } catch (AerospikeException e) {
   System.err.println("Error while deleting key " + key + ": " + e);
   return Status.ERROR;
  }
 }
}
origin: brianfrankcooper/YCSB

@Override
public Status read(String table, String key, Set<String> fields,
  Map<String, ByteIterator> result) {
 try {
  Record record;
  if (fields != null) {
   record = client.get(readPolicy, new Key(namespace, table, key),
     fields.toArray(new String[fields.size()]));
  } else {
   record = client.get(readPolicy, new Key(namespace, table, key));
  }
  if (record == null) {
   System.err.println("Record key " + key + " not found (read)");
   return Status.ERROR;
  }
  for (Map.Entry<String, Object> entry: record.bins.entrySet()) {
   result.put(entry.getKey(),
     new ByteArrayByteIterator((byte[])entry.getValue()));
  }
  return Status.OK;
 } catch (AerospikeException e) {
  System.err.println("Error while reading key " + key + ": " + e);
  return Status.ERROR;
 }
}
origin: brianfrankcooper/YCSB

private Status write(String table, String key, WritePolicy writePolicy,
  Map<String, ByteIterator> values) {
 Bin[] bins = new Bin[values.size()];
 int index = 0;
 for (Map.Entry<String, ByteIterator> entry: values.entrySet()) {
  bins[index] = new Bin(entry.getKey(), entry.getValue().toArray());
  ++index;
 }
 Key keyObj = new Key(namespace, table, key);
 try {
  client.put(writePolicy, keyObj, bins);
  return Status.OK;
 } catch (AerospikeException e) {
  System.err.println("Error while writing key " + key + ": " + e);
  return Status.ERROR;
 }
}
origin: com.spikeify/core

protected Key collectKey(Object obj) {
  // get metadata for object
  ObjectMetadata meta = MapperService.getMapper(obj.getClass()).getRequiredMetadata(obj, defaultNamespace);
  if (meta.userKeyString != null) {
    return new Key(meta.namespace, meta.setName, meta.userKeyString);
  } else {
    return new Key(meta.namespace, meta.setName, meta.userKeyLong);
  }
}
origin: org.apache.apex/malhar-contrib

@Override
public void removeCommittedWindowId(String appId, int operatorId) {
 try {
  String keyString = appId + String.valueOf(operatorId);
  Key key = new Key(namespace,metaSet,keyString.hashCode());
  client.delete(null, key);
 }
 catch (AerospikeException e) {
  throw new RuntimeException(e);
 }
}
origin: aerospike/aerospike-client-java

  public Key makeKey(String namespace, String set) {
    if (hasDigest) {
      byte[] digest = getDigest();
      return new Key(namespace, digest, null, null);
    } else {
      return new Key(namespace, set, getValue1());
    }
  }
}
origin: com.spikeify/core

protected Key collectKey(T obj) {
  // get metadata for object
  ObjectMetadata meta = MapperService.getMapper(obj.getClass()).getRequiredMetadata(obj, defaultNamespace);
  if (meta.userKeyString != null) {
    return new Key(meta.namespace, meta.setName, meta.userKeyString);
  } else {
    return new Key(meta.namespace, meta.setName, meta.userKeyLong);
  }
}
origin: com.spikeify/core

protected static Key collectKey(Object obj, String namespace) {
  // get metadata for object
  ObjectMetadata meta = MapperService.getMapper(obj.getClass()).getRequiredMetadata(obj, namespace);
  if (meta.userKeyString != null) {
    return new Key(meta.namespace, meta.setName, meta.userKeyString);
  } else {
    return new Key(meta.namespace, meta.setName, meta.userKeyLong);
  }
}
origin: aerospike/aerospike-client-java

private void deleteRecords(
  AerospikeClient client,
  Parameters params,
  String keyPrefix,
  int size	
) throws Exception {
  for (int i = 0; i < size; i++) {
    Key key = new Key(params.namespace, params.set, keyPrefix + i);
    client.delete(params.writePolicy, key);            
  }
}

origin: com.spikeify/core

protected void collectKeys() {
  // check if any Long or String keys were provided
  if (stringKeys != null) {
    for (String stringKey : stringKeys) {
      keys.add(new Key(getNamespace(), getSetName(), stringKey));
    }
  } else if (longKeys != null) {
    for (long longKey : longKeys) {
      keys.add(new Key(getNamespace(), getSetName(), longKey));
    }
  }
}
origin: aerospike/aerospike-client-java

public void runCommand() {
  long currentKey = keyStart + keyCount;
  Key key = new Key(args.namespace, args.setName, currentKey);
  Bin[] bins = args.getBins(random, true, currentKey);
  
  if (useLatency) {
    begin = System.nanoTime();
  }
  client.put(eventLoop, listener, args.writePolicy, key, bins);        
}

origin: aerospike/aerospike-client-java

private void runCommand(long keyCurrent, RandomShift random) {
  Key key = new Key(args.namespace, args.setName, keyCurrent);
  // Use predictable value for 0th bin same as key value
  Bin[] bins = args.getBins(random, true, keyCurrent);
  put(key, bins);        
}

origin: com.spikeify/core

protected void collectKeys() {
  // check if any Long or String keys were provided
  if (stringKey != null) {
    key = new Key(getNamespace(), getSetName(), stringKey);
  } else if (longKey != null) {
    key = new Key(getNamespace(), getSetName(), longKey);
  }
}
origin: com.spikeify/core

protected void collectKeys() {
  // check if any Long or String keys were provided
  if (stringKey != null) {
    key = new Key(getNamespace(), getSetName(), stringKey);
  } else if (longKey != null) {
    key = new Key(getNamespace(), getSetName(), longKey);
  }
}
origin: com.spikeify/core

protected void collectKeys() {
  // check if any Long or String keys were provided
  if (stringKey != null) {
    key = new Key(getNamespace(), getSetName(), stringKey);
  } else if (longKey != null) {
    key = new Key(getNamespace(), getSetName(), longKey);
  }
  if (key == null) {
    throw new SpikeifyError("Missing parameter: key not specified.");
  }
}
origin: apache/apex-malhar

 @Override
 protected Key getUpdatedBins(TestEvent tuple, List<Bin> bins) throws AerospikeException
 {
  Key key = new Key(NAMESPACE,SET_NAME,String.valueOf(tuple.id));
  bins.add(new Bin("ID",tuple.id));
  return key;
 }
}
origin: aerospike/aerospike-client-java

/**
 * Asynchronously write and read a bin using alternate methods.
 */
@Override
public void runExample(AerospikeClient client, EventLoop eventLoop) {
  Key key = new Key(params.namespace, params.set, "putgetkey");
  Bin bin = new Bin(params.getBinName("putgetbin"), "value");
  runPutGetInline(client, eventLoop, key, bin);
  runPutGetWithRetry(client, eventLoop, key, bin);
}

origin: com.spikeify/core

@Override
public boolean exists(Class type, String id) {
  ClassMapper mapper = MapperService.getMapper(type);
  return asynClient.exists(null, new Key(getNamespace(mapper), getSetName(mapper), id));
}
origin: com.spikeify/core

@Override
public boolean exists(Class type, Long id) {
  ClassMapper mapper = MapperService.getMapper(type);
  Key key = new Key(getNamespace(mapper), getSetName(mapper), id);
  return asynClient.exists(null, key);
}
origin: aerospike/aerospike-client-java

private void writeIfGenerationNotChanged(AerospikeClient client, Parameters params) throws Exception {	
  Key key = new Key(params.namespace, params.set, "udfkey2");
  Bin bin = new Bin(params.getBinName("udfbin2"), "string value");		
  
  // Seed record.
  client.put(params.writePolicy, key, bin);
  
  // Get record generation.
  long gen = (Long)client.execute(params.writePolicy, key, "record_example", "getGeneration");
  // Write record if generation has not changed.
  client.execute(params.writePolicy, key, "record_example", "writeIfGenerationNotChanged", Value.get(bin.name), bin.value, Value.get(gen));		
  console.info("Record written.");
}
com.aerospike.clientKey<init>

Javadoc

Initialize key from namespace, optional set name and user key. The set name and user defined key are converted to a digest before sending to the server. The user key is not used or returned by the server by default. If the user key needs to persist on the server, use one of the following methods:
  • Set "WritePolicy.sendKey" to true. In this case, the key will be sent to the server for storage on writes and retrieved on multi-record scans and queries.
  • Explicitly store and retrieve the key in a bin.

Popular methods of Key

  • toString
  • equals
    Equality uses namespace and digest.

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • Kernel (java.awt.image)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • JLabel (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now