MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / PutRequest

Class PutRequest

src/PutRequest.java:64–610  ·  view source on GitHub ↗

Puts some data into HBase. A note on passing byte arrays in argument None of the method that receive a byte[] in argument will copy it. For more info, please refer to the documentation of HBaseRpc. A note on passing Strings in argument All strings a

Source from the content-addressed store, hash-verified

62 * timestamp.
63 */
64public final class PutRequest extends BatchableRpc
65 implements HBaseRpc.HasTable, HBaseRpc.HasKey, HBaseRpc.HasFamily,
66 HBaseRpc.HasQualifiers, HBaseRpc.HasValues, HBaseRpc.IsEdit,
67 /* legacy: */ HBaseRpc.HasQualifier, HBaseRpc.HasValue {
68
69 /** RPC Method name for HBase 0.94 and earlier. */
70 private static final byte[] PUT = { 'p', 'u', 't' };
71
72 /** Code type used for serialized `Put' objects. */
73 static final byte CODE = 35;
74
75 /**
76 * A put with all fields set to a 1-byte array containing a zero.
77 * This is useful for loops that need to start with a valid-looking edit.
78 */
79 static final PutRequest EMPTY_PUT;
80 static {
81 final byte[] zero = new byte[] { 0 };
82 final byte[][] onezero = new byte[][] { zero };
83 EMPTY_PUT = new PutRequest(zero, zero, zero, onezero, onezero);
84 EMPTY_PUT.setRegion(new RegionInfo(zero, zero, zero));
85 }
86
87 /**
88 * Invariants:
89 * - qualifiers.length == values.length
90 * - qualifiers.length > 0
91 */
92 private final byte[][] qualifiers;
93 private final byte[][] values;
94
95 /**
96 * Constructor using current time.
97 * <strong>These byte arrays will NOT be copied.</strong>
98 * <p>
99 * Note: If you want to set your own timestamp, use
100 * {@link #PutRequest(byte[], byte[], byte[], byte[], byte[], long)}
101 * instead. This constructor will let the RegionServer assign the timestamp
102 * to this write at the time using {@link System#currentTimeMillis} right
103 * before the write is persisted to the WAL.
104 * @param table The table to edit.
105 * @param key The key of the row to edit in that table.
106 * @param family The column family to edit in that table.
107 * @param qualifier The column qualifier to edit in that family.
108 * @param value The value to store.
109 */
110 public PutRequest(final byte[] table,
111 final byte[] key,
112 final byte[] family,
113 final byte[] qualifier,
114 final byte[] value) {
115 this(table, key, family, qualifier, value,
116 KeyValue.TIMESTAMP_NOW, RowLock.NO_LOCK);
117 }
118
119 /**
120 * Constructor for multiple columns using current time.
121 * <strong>These byte arrays will NOT be copied.</strong>

Callers

nothing calls this directly

Calls 1

setRegionMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…