congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Record
Code IndexAdd Tabnine to your IDE (free)

How to use
Record
in
com.aerospike.client

Best Java code snippets using com.aerospike.client.Record (Showing top 20 results out of 315)

origin: com.aerospike/aerospike-client

/**
 * Get bin value as list.
 */
public List<?> getList(String name) {
  return (List<?>)getValue(name);
}
origin: aerospike/aerospike-client-java

public void onRecord(Key key, Record record) throws AerospikeException {
  int result = record.getInt(binName);
  
  console.info("Record found: ns=%s set=%s bin=%s digest=%s value=%s",
    key.namespace, key.setName, binName, Buffer.bytesToHexString(key.digest), result);
  
  count.incrementAndGet();
}
origin: aerospike/aerospike-client-java

  /**
   * Convert key and record to string.
   */
  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder(1024);
    
    if (key != null) {
      sb.append(key.toString());
    }

    sb.append(':');
    
    if (record != null) {
      sb.append(record.toString());		
    }
    return sb.toString();
  }
}
origin: aerospike/aerospike-client-java

@SuppressWarnings("unchecked")
@Override
public KeyRecord next() {
  KeyRecord keyRecord = null;
  if (this.recordSetIterator != null) {
    keyRecord = this.recordSetIterator.next();
  } else if (this.resultSetIterator != null) {
    Map<String, Object> map = (Map<String, Object>) this.resultSetIterator.next();
    Map<String, Object> meta = (Map<String, Object>) map.get(META_DATA);
    map.remove(META_DATA);
    Map<String, Object> binMap = new HashMap<String, Object>(map);
    if (log.isDebugEnabled()) {
      for (Map.Entry<String, Object> entry : map.entrySet()) {
        log.debug(entry.getKey() + " = " + entry.getValue());
      }
    }
    Long generation = (Long) meta.get(GENERATION);
    Long ttl = (Long) meta.get(EXPIRY);
    Record record = new Record(binMap, generation.intValue(), ttl.intValue());
    Key key = new Key(namespace, (byte[]) meta.get(DIGEST), (String) meta.get(SET_NAME), null);
    keyRecord = new KeyRecord(key, record);
  } else if (singleRecord != null) {
    keyRecord = singleRecord;
    singleRecord = null;
  }
  return keyRecord;
}
origin: aerospike/aerospike-client-java

/**
 * Demonstrate multiple operations on a single record in one call.
 */
@Override
public void runExample(AerospikeClient client, Parameters params) throws Exception {
  // Write initial record.
  Key key = new Key(params.namespace, params.set, "opkey");
  Bin bin1 = new Bin("optintbin", 7);
  Bin bin2 = new Bin("optstringbin", "string value");		
  console.info("Put: namespace=%s set=%s key=%s bin1=%s value1=%s bin2=%s value2=%s",
    key.namespace, key.setName, key.userKey, bin1.name, bin1.value, bin2.name, bin2.value);
  client.put(params.writePolicy, key, bin1, bin2);
  // Add integer, write new string and read record.
  Bin bin3 = new Bin(bin1.name, 4);
  Bin bin4 = new Bin(bin2.name, "new string");
  console.info("Add: " + bin3.value);
  console.info("Write: " + bin4.value);
  console.info("Read:");
  Record record = client.operate(params.writePolicy, key, Operation.add(bin3), Operation.put(bin4), Operation.get());
  if (record == null) {
    throw new Exception(String.format(
      "Failed to get: namespace=%s set=%s key=%s",
      key.namespace, key.setName, key.userKey));
  }
  validateBin(key, record, bin3.name, 11, record.getInt(bin3.name));
  validateBin(key, record, bin4.name, bin4.value.toString(), record.getValue(bin4.name));	
}

origin: com.aerospike/aerospike-client

/**
 * Get bin value as float.
 */
public float getFloat(String name) {
  return (float)getDouble(name);
}
origin: aerospike/aerospike-client-java

Key key = rs.getKey();
Record record = rs.getRecord();
String result = record.getGeoJSON(binName);
origin: com.spikeify/core

@Override
public Record get(Policy policy, Key key) throws AerospikeException {
  policy = (policy == null) ? readPolicyDefault : policy;
  String nsName = key.namespace == null ? defaultNamespace : key.namespace;
  String setName = key.setName == null ? defaultNamespace : key.setName;
  Map<String, Map<Key, Rec>> namespace = getNamespace(nsName);
  Map<Key, Rec> set = getSet(setName, namespace);
  Rec existingRec = set.get(key);
  if (existingRec == null) {
    return null;
  }
  return new Record(existingRec.getBins(), existingRec.generation, existingRec.expires);
}
origin: aerospike/aerospike-client-java

/**
 * Get bin value as float.
 */
public float getFloat(String name) {
  return (float)getDouble(name);
}
origin: aerospike/aerospike-client-java

Key key = rs.getKey();
Record record = rs.getRecord();
String result = record.getGeoJSON(binName);
origin: com.aerospike/aerospike-client

/**
 * Get bin value as map.
 */
public Map<?,?> getMap(String name) {
  return (Map<?,?>)getValue(name);
}
origin: com.aerospike/aerospike-client

protected final Record parseRecord() {
  Map<String,Object> bins = null;
  for (int i = 0 ; i < opCount; i++) {
    int opSize = Buffer.bytesToInt(dataBuffer, dataOffset);
    byte particleType = dataBuffer[dataOffset+5];
    byte nameSize = dataBuffer[dataOffset+7];
    String name = Buffer.utf8ToString(dataBuffer, dataOffset+8, nameSize);
    dataOffset += 4 + 4 + nameSize;
    int particleBytesSize = (int) (opSize - (4 + nameSize));
    Object value = Buffer.bytesToParticle(particleType, dataBuffer, dataOffset, particleBytesSize);
    dataOffset += particleBytesSize;
    if (bins == null) {
      bins = new HashMap<String,Object>();
    }
    bins.put(name, value);
  }
  return new Record(bins, generation, expiration);
}
origin: apache/apex-malhar

 public static boolean check(Key key, Record record)
 {
  final int binId = record.getInt(ID);
  final int binVal = record.getInt(VAL);
  final Key rKey = new Key(NAMESPACE, SET_NAME, String.valueOf(binId));
  LOG.debug("Checking id = {}", binId);
  return binVal == binId * binId && rKey.equals(key);
 }
}
origin: com.aerospike/aerospike-client

  /**
   * Convert key and record to string.
   */
  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder(1024);

    if (key != null) {
      sb.append(key.toString());
    }

    sb.append(':');

    if (record != null) {
      sb.append(record.toString());
    }
    return sb.toString();
  }
}
origin: aerospike/aerospike-client-java

/**
 * Get bin value as String.
 */
public String getString(String name) {
  return (String)getValue(name);
}

origin: aerospike/aerospike-client-java

protected final Record parseRecord() {		
  Map<String,Object> bins = null;
  
  for (int i = 0 ; i < opCount; i++) {
    int opSize = Buffer.bytesToInt(dataBuffer, dataOffset);
    byte particleType = dataBuffer[dataOffset+5];
    byte nameSize = dataBuffer[dataOffset+7];
    String name = Buffer.utf8ToString(dataBuffer, dataOffset+8, nameSize);
    dataOffset += 4 + 4 + nameSize;

    int particleBytesSize = (int) (opSize - (4 + nameSize));
    Object value = Buffer.bytesToParticle(particleType, dataBuffer, dataOffset, particleBytesSize);
    dataOffset += particleBytesSize;
    if (bins == null) {
      bins = new HashMap<String,Object>();
    }
    bins.put(name, value);
  }
  return new Record(bins, generation, expiration);	    
}

origin: apache/apex-malhar

@Override
public TestEvent getTuple(Record record)
{
 return new TestEvent(record.getInt("ID"));
}
origin: aerospike/aerospike-client-java

while (rs.next()) {
  Record record = rs.getRecord();                
  console.info("Record: " + record.toString());			
origin: aerospike/aerospike-client-java

/**
 * Get bin value as map.
 */
public Map<?,?> getMap(String name) {
  return (Map<?,?>)getValue(name);
}
origin: aerospike/aerospike-client-java

/**
 * Parses the given byte buffer and populate the result object.
 * Returns the number of bytes that were parsed from the given buffer.
 */
protected final Record parseRecord()
  throws AerospikeException, IOException {
  Map<String,Object> bins = null;
  for (int i = 0 ; i < opCount; i++) {
    readBytes(8);
    int opSize = Buffer.bytesToInt(dataBuffer, 0);
    byte particleType = dataBuffer[5];
    byte nameSize = dataBuffer[7];
    readBytes(nameSize);
    String name = Buffer.utf8ToString(dataBuffer, 0, nameSize);
    int particleBytesSize = opSize - (4 + nameSize);
    readBytes(particleBytesSize);
    Object value = Buffer.bytesToParticle(particleType, dataBuffer, 0, particleBytesSize);
    if (bins == null) {
      bins = new HashMap<String,Object>();
    }
    bins.put(name, value);
  }
  return new Record(bins, generation, expiration);
}
com.aerospike.clientRecord

Javadoc

Container object for records. Records are equivalent to rows.

Most used methods

  • getValue
    Get bin value given bin name. Enter empty string ("") for servers configured as single-bin.
  • <init>
    Initialize record.
  • getInt
    Get bin value as int.
  • toString
    Return String representation of record.
  • getDouble
    Get bin value as double.
  • getGeoJSON
    Get bin value as GeoJSON (backward compatibility).
  • getGeoJSONString
    Get bin value as GeoJSON String.
  • getList
    Get bin value as list.
  • getLong
    Get bin value as long.
  • getString
    Get bin value as String.
  • getTimeToLive
    Convert record expiration (seconds from Jan 01 2010 00:00:00 GMT) to ttl (seconds from now).
  • getTimeToLive

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Reference (javax.naming)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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