use of com.aerospike.client.task.IndexTask in project aerospike-client-java by aerospike.
the class TestQueryRPS method prepare.
@BeforeClass
public static void prepare() {
RegisterTask rtask0 = client.register(null, TestQuerySum.class.getClassLoader(), "udf/sum_example.lua", "sum_example.lua", Language.LUA);
RegisterTask rtask1 = client.register(null, TestQueryExecute.class.getClassLoader(), "udf/record_example.lua", "record_example.lua", Language.LUA);
rtask0.waitTillComplete();
rtask1.waitTillComplete();
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask itask = client.createIndex(policy, args.namespace, args.set, indexName, binName1, IndexType.NUMERIC);
itask.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
n_records = records_per_node * client.getNodes().length;
client.truncate(null, args.namespace, args.set, null);
for (int i = 1; i <= n_records; i++) {
Key key = new Key(args.namespace, args.set, keyPrefix + i);
client.put(null, key, new Bin(binName1, i), new Bin(binName2, i));
}
}
use of com.aerospike.client.task.IndexTask in project aerospike-client-java by aerospike.
the class QueryExecute method createIndex.
private void createIndex(AerospikeClient client, Parameters params, String indexName, String binName) throws Exception {
console.info("Create index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName);
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC);
task.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
}
use of com.aerospike.client.task.IndexTask in project aerospike-client-java by aerospike.
the class QueryFilter method createIndex.
private void createIndex(AerospikeClient client, Parameters params, String indexName, String binName) throws Exception {
console.info("Create index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName);
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.STRING);
task.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
}
use of com.aerospike.client.task.IndexTask in project aerospike-client-java by aerospike.
the class QueryRegionFilter method createIndex.
private void createIndex(AerospikeClient client, Parameters params, String indexName, String binName) throws Exception {
console.info("Create index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName);
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.GEO2DSPHERE);
task.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
}
use of com.aerospike.client.task.IndexTask in project aerospike-client-java by aerospike.
the class QueryCollection method createIndex.
private void createIndex(AerospikeClient client, Parameters params, String indexName, String binName) throws Exception {
console.info("Create mapkeys index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName);
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.STRING, IndexCollectionType.MAPKEYS);
task.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
}
Aggregations