use of com.aerospike.client.AerospikeException in project apex-malhar by apache.
the class AbstractAerospikeTransactionalPutOperator method processBatch.
@Override
public void processBatch(Collection<T> tuples) {
Key key;
Bin[] binsArray;
try {
for (T tuple : tuples) {
key = getUpdatedBins(tuple, bins);
binsArray = new Bin[bins.size()];
binsArray = bins.toArray(binsArray);
store.getClient().put(null, key, binsArray);
bins.clear();
}
} catch (AerospikeException e) {
throw new RuntimeException(e);
}
}
use of com.aerospike.client.AerospikeException in project apex-malhar by apache.
the class AerospikeTransactionalStore method storeCommittedWindowId.
@Override
public void storeCommittedWindowId(String appId, int operatorId, long windowId) {
try {
String keyString = appId + String.valueOf(operatorId);
Key key = new Key(namespace, metaSet, keyString.hashCode());
Bin bin1 = new Bin(metaTableAppIdColumn, appId);
Bin bin2 = new Bin(metaTableOperatorIdColumn, operatorId);
Bin bin3 = new Bin(metaTableWindowColumn, windowId);
client.put(null, key, bin1, bin2, bin3);
} catch (AerospikeException e) {
throw new RuntimeException(e);
}
}
use of com.aerospike.client.AerospikeException in project apex-malhar by apache.
the class AerospikeTransactionalStore method createIndexes.
private void createIndexes() {
IndexTask task;
try {
task = client.createIndex(null, namespace, metaSet, "operatorIdIndex", metaTableOperatorIdColumn, IndexType.NUMERIC);
task.waitTillComplete();
task = client.createIndex(null, namespace, metaSet, "appIdIndex", metaTableAppIdColumn, IndexType.STRING);
task.waitTillComplete();
} catch (AerospikeException ex) {
throw new RuntimeException(ex);
}
}
use of com.aerospike.client.AerospikeException in project apex-malhar by apache.
the class AbstractAerospikeNonTransactionalPutOperator method processTuple.
@Override
public void processTuple(T tuple) {
Key key;
Bin[] binsArray;
try {
key = getUpdatedBins(tuple, bins);
binsArray = new Bin[bins.size()];
binsArray = bins.toArray(binsArray);
store.getClient().put(null, key, binsArray);
bins.clear();
} catch (AerospikeException e) {
throw new RuntimeException(e);
}
}
use of com.aerospike.client.AerospikeException in project YCSB by brianfrankcooper.
the class AerospikeClient method write.
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;
}
}
Aggregations