|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hbase.async.HBaseRpc org.hbase.async.PutRequest
public final class PutRequest
Puts some data into HBase.
byte
arrays in argumentbyte[]
in argument will copy it.
For more info, please refer to the documentation of HBaseRpc
.
String
s in argumenttimestamp
s in argumentPutRequest
irrespective of the actual order in which they're received or stored by
a RegionServer. In other words, if you send a first PutRequest
with timestamp T, and then later send another one for the same table,
key, family and qualifier, but with timestamp T - 1, then the second
write will look like it was applied before the first one when you read
this cell back from HBase. When manually setting timestamps, it is thus
strongly recommended to use real UNIX timestamps in milliseconds, e.g.
from System.currentTimeMillis()
.
If you want to let HBase set the timestamp on a write at the time it's
applied within the RegionServer, then use KeyValue.TIMESTAMP_NOW
as a timestamp. The timestamp is set right before being written to the WAL
(Write Ahead Log). Note however that this has a subtle consequence: if a
write succeeds from the server's point of view, but fails from the client's
point of view (maybe because the client got disconnected from the server
before the server could acknowledge the write), then if the client retries
the write it will create another version of the cell with a different
timestamp.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.hbase.async.HBaseRpc |
---|
HBaseRpc.HasFamily, HBaseRpc.HasKey, HBaseRpc.HasQualifier, HBaseRpc.HasQualifiers, HBaseRpc.HasTable, HBaseRpc.HasTimestamp, HBaseRpc.HasValue, HBaseRpc.HasValues |
Constructor Summary | |
---|---|
PutRequest(byte[] table,
byte[] key,
byte[] family,
byte[][] qualifiers,
byte[][] values)
Constructor for multiple columns using current time. |
|
PutRequest(byte[] table,
byte[] key,
byte[] family,
byte[][] qualifiers,
byte[][] values,
long timestamp)
Constructor for multiple columns with a specific timestamp. |
|
PutRequest(byte[] table,
byte[] key,
byte[] family,
byte[][] qualifiers,
byte[][] values,
long timestamp,
RowLock lock)
Constructor for multiple columns with current time and explicit row lock. |
|
PutRequest(byte[] table,
byte[] key,
byte[] family,
byte[] qualifier,
byte[] value)
Constructor using current time. |
|
PutRequest(byte[] table,
byte[] key,
byte[] family,
byte[] qualifier,
byte[] value,
long timestamp)
Constructor for a specific timestamp. |
|
PutRequest(byte[] table,
byte[] key,
byte[] family,
byte[] qualifier,
byte[] value,
long timestamp,
RowLock lock)
Constructor using current time and an explicit row lock. |
|
PutRequest(byte[] table,
byte[] key,
byte[] family,
byte[] qualifier,
byte[] value,
RowLock lock)
Constructor using an explicit row lock. |
|
PutRequest(byte[] table,
KeyValue kv)
Constructor from a KeyValue . |
|
PutRequest(byte[] table,
KeyValue kv,
RowLock lock)
Constructor from a KeyValue with an explicit row lock. |
|
PutRequest(String table,
String key,
String family,
String qualifier,
String value)
Convenience constructor from strings (higher overhead). |
|
PutRequest(String table,
String key,
String family,
String qualifier,
String value,
RowLock lock)
Convenience constructor with explicit row lock (higher overhead). |
Method Summary | |
---|---|
byte[] |
family()
Returns the family this RPC is for. |
byte[] |
key()
Returns the row key this RPC is for. |
byte[] |
qualifier()
Returns the first qualifier of the set of edits in this RPC. |
byte[][] |
qualifiers()
Returns the column qualifiers this RPC is for. |
void |
setBufferable(boolean bufferable)
Sets whether or not this RPC is can be buffered on the client side. |
void |
setDurable(boolean durable)
Changes the durability setting of this edit. |
byte[] |
table()
Returns the name of the table this RPC is for. |
long |
timestamp()
Returns the strictly positive timestamp contained in this RPC. |
String |
toString()
|
byte[] |
value()
Returns the first value of the set of edits in this RPC. |
byte[][] |
values()
Returns the values contained in this RPC. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.hbase.async.HBaseRpc.HasFamily |
---|
family |
Constructor Detail |
---|
public PutRequest(byte[] table, byte[] key, byte[] family, byte[] qualifier, byte[] value)
Note: If you want to set your own timestamp, use
PutRequest(byte[], byte[], byte[], byte[], byte[], long)
instead. This constructor will let the RegionServer assign the timestamp
to this write at the time using System.currentTimeMillis()
right
before the write is persisted to the WAL.
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifier
- The column qualifier to edit in that family.value
- The value to store.public PutRequest(byte[] table, byte[] key, byte[] family, byte[][] qualifiers, byte[][] values)
Note: If you want to set your own timestamp, use
PutRequest(byte[], byte[], byte[], byte[][], byte[][], long)
instead. This constructor will let the RegionServer assign the timestamp
to this write at the time using System.currentTimeMillis()
right
before the write is persisted to the WAL.
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifiers
- The column qualifiers to edit in that family.values
- The corresponding values to store.
IllegalArgumentException
- if qualifiers.length == 0
or if qualifiers.length != values.length
public PutRequest(byte[] table, byte[] key, byte[] family, byte[] qualifier, byte[] value, long timestamp)
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifier
- The column qualifier to edit in that family.value
- The value to store.timestamp
- The timestamp to set on this edit.public PutRequest(byte[] table, byte[] key, byte[] family, byte[][] qualifiers, byte[][] values, long timestamp)
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifiers
- The column qualifiers to edit in that family.values
- The corresponding values to store.timestamp
- The timestamp to set on this edit.
IllegalArgumentException
- if qualifiers.length == 0
or if qualifiers.length != values.length
public PutRequest(byte[] table, byte[] key, byte[] family, byte[] qualifier, byte[] value, RowLock lock)
Note: If you want to set your own timestamp, use
PutRequest(byte[], byte[], byte[], byte[], byte[], long, RowLock)
instead. This constructor will let the RegionServer assign the timestamp
to this write at the time using System.currentTimeMillis()
right
before the write is persisted to the WAL.
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifier
- The column qualifier to edit in that family.value
- The value to store.lock
- An explicit row lock to use with this request.public PutRequest(byte[] table, byte[] key, byte[] family, byte[] qualifier, byte[] value, long timestamp, RowLock lock)
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifier
- The column qualifier to edit in that family.value
- The value to store.timestamp
- The timestamp to set on this edit.lock
- An explicit row lock to use with this request.public PutRequest(byte[] table, byte[] key, byte[] family, byte[][] qualifiers, byte[][] values, long timestamp, RowLock lock)
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifiers
- The column qualifiers to edit in that family.values
- The corresponding values to store.timestamp
- The timestamp to set on this edit.lock
- An explicit row lock to use with this request.
IllegalArgumentException
- if qualifiers.length == 0
or if qualifiers.length != values.length
public PutRequest(String table, String key, String family, String qualifier, String value)
Note: If you want to set your own timestamp, use
PutRequest(byte[], byte[], byte[], byte[], byte[], long)
instead. This constructor will let the RegionServer assign the timestamp
to this write at the time using System.currentTimeMillis()
right
before the write is persisted to the WAL.
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifier
- The column qualifier to edit in that family.value
- The value to store.public PutRequest(String table, String key, String family, String qualifier, String value, RowLock lock)
Note: If you want to set your own timestamp, use
PutRequest(byte[], byte[], byte[], byte[], byte[], long, RowLock)
instead. This constructor will let the RegionServer assign the timestamp
to this write at the time using System.currentTimeMillis()
right
before the write is persisted to the WAL.
table
- The table to edit.key
- The key of the row to edit in that table.family
- The column family to edit in that table.qualifier
- The column qualifier to edit in that family.value
- The value to store.lock
- An explicit row lock to use with this request.public PutRequest(byte[] table, KeyValue kv)
KeyValue
.
table
- The table to edit.kv
- The KeyValue
to store.public PutRequest(byte[] table, KeyValue kv, RowLock lock)
KeyValue
with an explicit row lock.
table
- The table to edit.kv
- The KeyValue
to store.lock
- An explicit row lock to use with this request.Method Detail |
---|
public byte[] table()
HBaseRpc.HasTable
DO NOT MODIFY THE CONTENTS OF THE ARRAY RETURNED.
table
in interface HBaseRpc.HasTable
public byte[] key()
HBaseRpc.HasKey
DO NOT MODIFY THE CONTENTS OF THE ARRAY RETURNED.
key
in interface HBaseRpc.HasKey
public byte[] qualifier()
DO NOT MODIFY THE CONTENTS OF THE ARRAY RETURNED.
qualifier
in interface HBaseRpc.HasQualifier
public byte[][] qualifiers()
DO NOT MODIFY THE CONTENTS OF THE ARRAY RETURNED.
qualifiers
in interface HBaseRpc.HasQualifiers
public byte[] value()
DO NOT MODIFY THE CONTENTS OF THE ARRAY RETURNED.
value
in interface HBaseRpc.HasValue
public byte[][] values()
DO NOT MODIFY THE CONTENTS OF THE ARRAY RETURNED.
values
in interface HBaseRpc.HasValues
public String toString()
toString
in class HBaseRpc
public final void setBufferable(boolean bufferable)
true
.
Setting this to false
bypasses the client-side buffering, which
is used to send RPCs in batches for greater throughput, and causes this
RPC to be sent directly to the server.
bufferable
- Whether or not this RPC can be buffered (i.e. delayed)
before being sent out to HBase.HBaseClient.setFlushInterval(short)
public final void setDurable(boolean durable)
true
.
Make sure you've read and understood the
data durability section before
setting this to false
.
durable
- Whether or not this edit should be stored with data
durability guarantee.public final byte[] family()
HBaseRpc.HasFamily
DO NOT MODIFY THE CONTENTS OF THE ARRAY RETURNED.
family
in interface HBaseRpc.HasFamily
public final long timestamp()
HBaseRpc.HasTimestamp
timestamp
in interface HBaseRpc.HasTimestamp
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |