Package com.yahoo.ycsb.db
Class HBaseClient
- java.lang.Object
-
- com.yahoo.ycsb.DB
-
- com.yahoo.ycsb.db.HBaseClient
-
public class HBaseClient extends com.yahoo.ycsb.DBHBase client for YCSB framework
-
-
Field Summary
Fields Modifier and Type Field Description int_batchSizejava.lang.String_columnFamilybyte[]_columnFamilyBytesboolean_debugboolean_writeToWalstatic intHttpErrorstatic intNoMatchingRecordstatic intOkstatic intServerErrorstatic java.lang.ObjecttableLock
-
Constructor Summary
Constructors Constructor Description HBaseClient()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Cleanup any state for this DB.intdelete(java.lang.String table, java.lang.String key)Delete a record from the database.org.apache.hadoop.hbase.client.HTablegetHTable(java.lang.String table)voidinit()Initialize any state for this DB.intinsert(java.lang.String table, java.lang.String key, java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator> values)Insert a record in the database.static voidmain(java.lang.String[] args)intread(java.lang.String table, java.lang.String key, java.util.Set<java.lang.String> fields, java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator> result)Read a record from the database.intscan(java.lang.String table, java.lang.String startkey, int recordcount, java.util.Set<java.lang.String> fields, java.util.Vector<java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator>> result)Perform a range scan for a set of records in the database.intupdate(java.lang.String table, java.lang.String key, java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator> values)Update a record in the database.
-
-
-
Field Detail
-
_debug
public boolean _debug
-
_writeToWal
public boolean _writeToWal
-
_batchSize
public int _batchSize
-
_columnFamily
public java.lang.String _columnFamily
-
_columnFamilyBytes
public byte[] _columnFamilyBytes
-
Ok
public static final int Ok
- See Also:
- Constant Field Values
-
ServerError
public static final int ServerError
- See Also:
- Constant Field Values
-
HttpError
public static final int HttpError
- See Also:
- Constant Field Values
-
NoMatchingRecord
public static final int NoMatchingRecord
- See Also:
- Constant Field Values
-
tableLock
public static final java.lang.Object tableLock
-
-
Method Detail
-
init
public void init() throws com.yahoo.ycsb.DBExceptionInitialize any state for this DB. Called once per DB instance; there is one DB instance per client thread.- Overrides:
initin classcom.yahoo.ycsb.DB- Throws:
com.yahoo.ycsb.DBException
-
cleanup
public void cleanup() throws com.yahoo.ycsb.DBExceptionCleanup any state for this DB. Called once per DB instance; there is one DB instance per client thread.- Overrides:
cleanupin classcom.yahoo.ycsb.DB- Throws:
com.yahoo.ycsb.DBException
-
getHTable
public org.apache.hadoop.hbase.client.HTable getHTable(java.lang.String table)
-
read
public int read(java.lang.String table, java.lang.String key, java.util.Set<java.lang.String> fields, java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator> result)Read a record from the database. Each field/value pair from the result will be stored in a HashMap.- Specified by:
readin classcom.yahoo.ycsb.DB- Parameters:
table- The name of the tablekey- The record key of the record to read.fields- The list of fields to read, or null for all of themresult- A HashMap of field/value pairs for the result- Returns:
- Zero on success, a non-zero error code on error
-
scan
public int scan(java.lang.String table, java.lang.String startkey, int recordcount, java.util.Set<java.lang.String> fields, java.util.Vector<java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator>> result)Perform a range scan for a set of records in the database. Each field/value pair from the result will be stored in a HashMap.- Specified by:
scanin classcom.yahoo.ycsb.DB- Parameters:
table- The name of the tablestartkey- The record key of the first record to read.recordcount- The number of records to readfields- The list of fields to read, or null for all of themresult- A Vector of HashMaps, where each HashMap is a set field/value pairs for one record- Returns:
- Zero on success, a non-zero error code on error
-
update
public int update(java.lang.String table, java.lang.String key, java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator> values)Update a record in the database. Any field/value pairs in the specified values HashMap will be written into the record with the specified record key, overwriting any existing values with the same field name.- Specified by:
updatein classcom.yahoo.ycsb.DB- Parameters:
table- The name of the tablekey- The record key of the record to writevalues- A HashMap of field/value pairs to update in the record- Returns:
- Zero on success, a non-zero error code on error
-
insert
public int insert(java.lang.String table, java.lang.String key, java.util.HashMap<java.lang.String,com.yahoo.ycsb.ByteIterator> values)Insert a record in the database. Any field/value pairs in the specified values HashMap will be written into the record with the specified record key.- Specified by:
insertin classcom.yahoo.ycsb.DB- Parameters:
table- The name of the tablekey- The record key of the record to insert.values- A HashMap of field/value pairs to insert in the record- Returns:
- Zero on success, a non-zero error code on error
-
delete
public int delete(java.lang.String table, java.lang.String key)Delete a record from the database.- Specified by:
deletein classcom.yahoo.ycsb.DB- Parameters:
table- The name of the tablekey- The record key of the record to delete.- Returns:
- Zero on success, a non-zero error code on error
-
main
public static void main(java.lang.String[] args)
-
-