mutation.h

Five additional APIs that are defined in this header file have been implemented.

/**
* Creates a structure for increment operation and return its handle.
*/
HBASE_API int32_t
hb_increment_create(
     const byte_t *rowkey,
     const size_t rowkey_len,
     hb_increment_t *increment_ptr);
/**
* Add a column and the amount by which its value to be incremented
* to the increment operation.
*/
HBASE_API int32_t
hb_increment_add_column(
     hb_increment_t incr,
     const hb_cell_t *cell,
     const int64_t amount);
/**
* Creates an structure for append operation and return its handle.
*/
HBASE_API int32_t
hb_append_create(
     const byte_t *rowkey,
     const size_t rowkey_len,
     hb_append_t *append_ptr);
/**
* Add a column for the append operation.
*/
HBASE_API int32_t
hb_append_add_column(
     hb_append_t append,
     const hb_cell_t *cell);
/**
* Sets the column criteria for an hb_delete_t object. Allows the deletion
* only of cells that have a timestamp that matches the specified timestamp.
*/
HBASE_API int32_t
hb_delete_add_column_exact(
          hb_delete_t del,
          const byte_t *family, 
          const size_t family_len,
          const byte_t *qualifier,
          const size_t qualifier_len,
          const int64_t timestamp);

Also, when you use the hb_delete_*() APIs, you must set timestamps to INT64_MAX to delete all versions of a column. In libhbase, you instead set timestamps to -1, as explained in the libhbase version of this header file.

Note: Increment only data that is 8 bytes in length. Before making a put to increment a value, your application must convert the new 8-byte value to bigendian format with the htobe64 API. When getting an incremented value, your application must convert the returned value from bigendian format to the original 8-byte value. The application can do this with the be64toh API.

For Windows clients:

  • Use _byteswap_uint64() to convert to a bigendian value before a put.
  • Use _byteswap_uint64() to convert from bigendian value to an 8-byte value for a get.

The need for conversion does not apply to increment operations. It applies only to puts that increment values and to gets that get incremented values.