use of com.aerospike.client.query.Statement in project apex-malhar by apache.
the class AerospikeTestUtils method cleanMetaTable.
// removes all records from set AerospikeTransactionalStore.DEFAULT_META_SET (used to store
// committed window ids) in namespace NAMESPACE
//
static void cleanMetaTable() {
AerospikeClient client = null;
try {
client = new AerospikeClient(NODE, PORT);
Statement stmnt = new Statement();
stmnt.setNamespace(NAMESPACE);
stmnt.setSetName(AerospikeTransactionalStore.DEFAULT_META_SET);
RecordSet rs = client.query(null, stmnt);
while (rs.next()) {
client.delete(null, rs.getKey());
}
} catch (AerospikeException e) {
LOG.error("cleanMetaTable failed: {}", e);
throw e;
} finally {
if (null != client) {
client.close();
}
}
}
use of com.aerospike.client.query.Statement in project apex-malhar by apache.
the class AerospikeTestUtils method getNumOfEventsInStore.
// returns the number of records in set SET_NAME in namespace NAMESPACE
static long getNumOfEventsInStore() {
AerospikeClient client = null;
try {
long count = 0;
client = new AerospikeClient(NODE, PORT);
Statement stmnt = new Statement();
stmnt.setNamespace(NAMESPACE);
stmnt.setSetName(SET_NAME);
RecordSet rs = client.query(null, stmnt);
while (rs.next()) {
count++;
}
return count;
} catch (AerospikeException e) {
LOG.error("getNumOfEventsInStore failed: {}", e);
throw e;
} finally {
if (null != client) {
client.close();
}
}
}
use of com.aerospike.client.query.Statement in project apex-malhar by apache.
the class AerospikeTestUtils method cleanTable.
// removes all records from set SET_NAME in namespace NAMESPACE
static void cleanTable() {
AerospikeClient client = null;
try {
client = new AerospikeClient(NODE, PORT);
Statement stmnt = new Statement();
stmnt.setNamespace(NAMESPACE);
stmnt.setSetName(SET_NAME);
RecordSet rs = client.query(null, stmnt);
while (rs.next()) {
client.delete(null, rs.getKey());
}
} catch (AerospikeException e) {
LOG.error("cleanTable failed: {}", e);
throw e;
} finally {
if (null != client) {
client.close();
}
}
}
Aggregations