Appends data to one or more columns in HBase, creating the columns if they do not exist. The value is simply concatenated with whatever is already in the column. An append operation will acquire a lock on the row so that all column operations are atomic with respect to writers. However reads
| 78 | * @since 1.7 |
| 79 | */ |
| 80 | public final class AppendRequest extends BatchableRpc |
| 81 | implements HBaseRpc.HasTable, HBaseRpc.HasKey, HBaseRpc.HasFamily, |
| 82 | HBaseRpc.HasQualifiers, HBaseRpc.HasValues, HBaseRpc.IsEdit, |
| 83 | /* legacy: */ HBaseRpc.HasQualifier, HBaseRpc.HasValue { |
| 84 | |
| 85 | private static final byte[] APPEND = new byte[] { 'a', 'p', 'p', 'e', 'n', 'd' }; |
| 86 | private static final byte[] RETURN_RESULTS = new byte[] {'_', 'r', 'r', '_'}; |
| 87 | |
| 88 | /** Code type used for serialized `Append' objects. */ |
| 89 | static final byte CODE = 78; |
| 90 | |
| 91 | /** |
| 92 | * Invariants: |
| 93 | * - qualifiers.length == values.length |
| 94 | * - qualifiers.length > 0 |
| 95 | */ |
| 96 | private final byte[][] qualifiers; |
| 97 | private final byte[][] values; |
| 98 | |
| 99 | /** Whether or not to return the result of the append request */ |
| 100 | private boolean return_result = false; |
| 101 | |
| 102 | /** |
| 103 | * Constructor using current time. |
| 104 | * <strong>These byte arrays will NOT be copied.</strong> |
| 105 | * <p> |
| 106 | * Note: If you want to set your own timestamp, use |
| 107 | * {@link #AppendRequest(byte[], byte[], byte[], byte[], byte[], long)} |
| 108 | * instead. This constructor will let the RegionServer assign the timestamp |
| 109 | * to this write at the time using {@link System#currentTimeMillis} right |
| 110 | * before the write is persisted to the WAL. |
| 111 | * @param table The table to edit. |
| 112 | * @param key The key of the row to edit in that table. |
| 113 | * @param family The column family to edit in that table. |
| 114 | * @param qualifier The column qualifier to edit in that family. |
| 115 | * @param value The value to store. |
| 116 | */ |
| 117 | public AppendRequest(final byte[] table, |
| 118 | final byte[] key, |
| 119 | final byte[] family, |
| 120 | final byte[] qualifier, |
| 121 | final byte[] value) { |
| 122 | this(table, key, family, qualifier, value, KeyValue.TIMESTAMP_NOW, |
| 123 | RowLock.NO_LOCK); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Constructor for multiple columns using current time. |
| 128 | * <strong>These byte arrays will NOT be copied.</strong> |
| 129 | * <p> |
| 130 | * Note: If you want to set your own timestamp, use |
| 131 | * {@link #AppendRequest(byte[], byte[], byte[], byte[][], byte[][], long)} |
| 132 | * instead. This constructor will let the RegionServer assign the timestamp |
| 133 | * to this write at the time using {@link System#currentTimeMillis} right |
| 134 | * before the write is persisted to the WAL. |
| 135 | * @param table The table to edit. |
| 136 | * @param key The key of the row to edit in that table. |
| 137 | * @param family The column family to edit in that table. |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…