use of com.basho.riak.client.api.commands.kv.DeleteValue in project YCSB by brianfrankcooper.
the class RiakKVClient method delete.
/**
* Delete a record from the database.
*
* @param table The name of the table (Riak bucket)
* @param key The record key of the record to delete.
* @return Zero on success, a non-zero error code on error
*/
@Override
public Status delete(String table, String key) {
Location location = new Location(new Namespace(bucketType, table), key);
DeleteValue dv = new DeleteValue.Builder(location).build();
RiakFuture<Void, Location> future = riakClient.executeAsync(dv);
try {
future.get(transactionTimeLimit, TimeUnit.SECONDS);
} catch (TimeoutException e) {
if (debug) {
System.err.println("Unable to delete key " + key + ". Reason: TIME OUT");
}
return TIME_OUT;
} catch (Exception e) {
if (debug) {
System.err.println("Unable to delete key " + key + ". Reason: " + e.toString());
}
return Status.ERROR;
}
return Status.OK;
}
Aggregations