Search in sources :

Example 1 with Key

use of org.hypertable.thriftgen.Key in project YCSB by brianfrankcooper.

the class HypertableClient method delete.

/**
   * Delete a record from the database.
   *
   * @param table
   *          The name of the table
   * @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) {
    if (debug) {
        System.out.println("Doing delete for key: " + key);
    }
    Cell entry = new Cell();
    entry.key = new Key();
    entry.key.row = key;
    entry.key.flag = KeyFlag.DELETE_ROW;
    try {
        connection.set_cell(ns, table, entry);
    } catch (ClientException e) {
        if (debug) {
            System.err.println("Error doing delete: " + e.message);
        }
        return Status.ERROR;
    } catch (TException e) {
        if (debug) {
            System.err.println("Error doing delete");
        }
        return Status.ERROR;
    }
    return Status.OK;
}
Also used : TException(org.apache.thrift.TException) ClientException(org.hypertable.thriftgen.ClientException) Cell(org.hypertable.thriftgen.Cell) Key(org.hypertable.thriftgen.Key)

Aggregations

TException (org.apache.thrift.TException)1 Cell (org.hypertable.thriftgen.Cell)1 ClientException (org.hypertable.thriftgen.ClientException)1 Key (org.hypertable.thriftgen.Key)1