@InterfaceAudience.Public public abstract class Mutation extends OperationWithAttributes implements Row, CellScannable, HeapSize
Modifier and Type | Class and Description |
---|---|
private static class |
Mutation.CellWrapper |
Modifier and Type | Field and Description |
---|---|
private static String |
CONSUMED_CLUSTER_IDS
The attribute for storing the list of clusters that have consumed the change.
|
protected Durability |
durability |
protected NavigableMap<byte[],List<Cell>> |
familyMap |
static long |
MUTATION_OVERHEAD |
private static String |
OP_ATTRIBUTE_TTL
The attribute for storing TTL for the result of the mutation.
|
private static String |
RETURN_RESULTS |
protected byte[] |
row |
protected long |
ts |
ID_ATRIBUTE
COMPARATOR
Modifier | Constructor and Description |
---|---|
protected |
Mutation()
empty construction.
|
protected |
Mutation(byte[] row,
long ts,
NavigableMap<byte[],List<Cell>> familyMap)
Construct the mutation with user defined data.
|
protected |
Mutation(Mutation clone) |
Modifier and Type | Method and Description |
---|---|
(package private) Mutation |
add(Cell cell) |
CellScanner |
cellScanner() |
private static Map<String,Object> |
cellToStringMap(Cell c) |
(package private) static byte[] |
checkRow(byte[] row) |
(package private) static byte[] |
checkRow(byte[] row,
int offset,
int length) |
(package private) static void |
checkRow(ByteBuffer row) |
int |
compareTo(Row d)
Deprecated.
As of release 2.0.0, this will be removed in HBase 3.0.0.
Use
Row.COMPARATOR instead |
(package private) KeyValue |
createPutKeyValue(byte[] family,
byte[] qualifier,
long ts,
byte[] value) |
(package private) KeyValue |
createPutKeyValue(byte[] family,
byte[] qualifier,
long ts,
byte[] value,
Tag[] tags)
Create a KeyValue with this objects row key and the Put identifier.
|
(package private) KeyValue |
createPutKeyValue(byte[] family,
ByteBuffer qualifier,
long ts,
ByteBuffer value,
Tag[] tags) |
protected long |
extraHeapSize()
Subclasses should override this method to add the heap size of their own fields.
|
List<Cell> |
get(byte[] family,
byte[] qualifier)
Returns a list of all KeyValue objects with matching column family and qualifier.
|
byte[] |
getACL() |
(package private) List<Cell> |
getCellList(byte[] family)
Creates an empty list if one doesn't exist for the given column family
or else it returns the associated list of Cell objects.
|
CellVisibility |
getCellVisibility() |
List<UUID> |
getClusterIds() |
Durability |
getDurability()
Get the current durability
|
NavigableMap<byte[],List<Cell>> |
getFamilyCellMap()
Method for retrieving the put's familyMap
|
Map<String,Object> |
getFingerprint()
Compile the column family (i.e.
|
byte[] |
getRow()
Method for retrieving the delete's row
|
long |
getTimestamp()
Method for retrieving the timestamp.
|
long |
getTimeStamp()
Deprecated.
As of release 2.0.0, this will be removed in HBase 3.0.0.
Use
getTimestamp() instead |
long |
getTTL()
Return the TTL requested for the result of the mutation, in milliseconds.
|
boolean |
has(byte[] family,
byte[] qualifier)
A convenience method to determine if this object's familyMap contains
a value assigned to the given family & qualifier.
|
boolean |
has(byte[] family,
byte[] qualifier,
byte[] value)
A convenience method to determine if this object's familyMap contains
a value assigned to the given family, qualifier and timestamp.
|
boolean |
has(byte[] family,
byte[] qualifier,
long ts)
A convenience method to determine if this object's familyMap contains
a value assigned to the given family, qualifier and timestamp.
|
boolean |
has(byte[] family,
byte[] qualifier,
long ts,
byte[] value)
A convenience method to determine if this object's familyMap contains
the given value assigned to the given family, qualifier and timestamp.
|
protected boolean |
has(byte[] family,
byte[] qualifier,
long ts,
byte[] value,
boolean ignoreTS,
boolean ignoreValue) |
long |
heapSize() |
boolean |
isEmpty()
Method to check if the familyMap is empty
|
protected boolean |
isReturnResults() |
int |
numFamilies() |
Mutation |
setACL(Map<String,Permission> perms) |
Mutation |
setACL(String user,
Permission perms) |
Mutation |
setCellVisibility(CellVisibility expression)
Sets the visibility expression associated with cells in this Mutation.
|
Mutation |
setClusterIds(List<UUID> clusterIds)
Marks that the clusters with the given clusterIds have consumed the mutation
|
Mutation |
setDurability(Durability d)
Set the durability for this mutation
|
Mutation |
setFamilyCellMap(NavigableMap<byte[],List<Cell>> map)
Deprecated.
As of release 2.0.0, this will be removed in HBase 3.0.0.
Use
Mutation(byte[], long, NavigableMap) instead |
protected Mutation |
setReturnResults(boolean returnResults) |
Mutation |
setTimestamp(long timestamp)
Set the timestamp of the delete.
|
Mutation |
setTTL(long ttl)
Set the TTL desired for the result of the mutation, in milliseconds.
|
int |
size()
Number of KeyValues carried by this Mutation.
|
private static CellVisibility |
toCellVisibility(byte[] protoBytes)
Convert a protocol buffer CellVisibility bytes to a client CellVisibility
|
(package private) static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility |
toCellVisibility(CellVisibility cellVisibility)
Create a protocol buffer CellVisibility based on a client CellVisibility.
|
private static CellVisibility |
toCellVisibility(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility proto)
Convert a protocol buffer CellVisibility to a client CellVisibility
|
Map<String,Object> |
toMap(int maxCols)
Compile the details beyond the scope of getFingerprint (row, columns,
timestamps, etc.) into a Map along with the fingerprinted information.
|
getAttribute, getAttributeSize, getAttributesMap, getId, getPriority, setAttribute, setId, setPriority
public static final long MUTATION_OVERHEAD
private static final String CONSUMED_CLUSTER_IDS
private static final String OP_ATTRIBUTE_TTL
private static final String RETURN_RESULTS
protected byte[] row
protected long ts
protected Durability durability
protected NavigableMap<byte[],List<Cell>> familyMap
protected Mutation()
protected Mutation(byte[] row, long ts, NavigableMap<byte[],List<Cell>> familyMap)
row
- row. CAN'T be nullts
- timestampfamilyMap
- the map to collect all cells internally. CAN'T be nullpublic CellScanner cellScanner()
cellScanner
in interface CellScannable
Cell
sList<Cell> getCellList(byte[] family)
family
- column familyKeyValue createPutKeyValue(byte[] family, byte[] qualifier, long ts, byte[] value)
KeyValue createPutKeyValue(byte[] family, byte[] qualifier, long ts, byte[] value, Tag[] tags)
family
- qualifier
- ts
- value
- tags
- - Specify the Tags as an ArrayKeyValue createPutKeyValue(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value, Tag[] tags)
public Map<String,Object> getFingerprint()
getFingerprint
in class Operation
public Map<String,Object> toMap(int maxCols)
private static Map<String,Object> cellToStringMap(Cell c)
public Mutation setDurability(Durability d)
d
- public Durability getDurability()
public NavigableMap<byte[],List<Cell>> getFamilyCellMap()
@Deprecated public Mutation setFamilyCellMap(NavigableMap<byte[],List<Cell>> map)
Mutation(byte[], long, NavigableMap)
insteadpublic boolean isEmpty()
public byte[] getRow()
@Deprecated public int compareTo(Row d)
Row.COMPARATOR
insteadcompareTo
in interface Comparable<Row>
compareTo
in interface Row
@Deprecated public long getTimeStamp()
getTimestamp()
insteadpublic long getTimestamp()
public Mutation setClusterIds(List<UUID> clusterIds)
clusterIds
- of the clusters that have consumed the mutationpublic List<UUID> getClusterIds()
public Mutation setCellVisibility(CellVisibility expression)
expression
- public CellVisibility getCellVisibility() throws DeserializationException
DeserializationException
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility toCellVisibility(CellVisibility cellVisibility)
cellVisibility
- private static CellVisibility toCellVisibility(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility proto)
proto
- private static CellVisibility toCellVisibility(byte[] protoBytes) throws DeserializationException
protoBytes
- DeserializationException
public int size()
public int numFamilies()
public long heapSize()
public byte[] getACL()
public Mutation setACL(String user, Permission perms)
user
- User short nameperms
- Permissions for the userpublic Mutation setACL(Map<String,Permission> perms)
perms
- A map of permissions for a user or userspublic long getTTL()
public Mutation setTTL(long ttl)
ttl
- the TTL desired for the result of the mutation, in milliseconds@InterfaceAudience.Private protected boolean isReturnResults()
@InterfaceAudience.Private protected Mutation setReturnResults(boolean returnResults)
protected long extraHeapSize()
public Mutation setTimestamp(long timestamp)
public boolean has(byte[] family, byte[] qualifier)
family
- column familyqualifier
- column qualifierpublic boolean has(byte[] family, byte[] qualifier, long ts)
family
- column familyqualifier
- column qualifierts
- timestamppublic boolean has(byte[] family, byte[] qualifier, byte[] value)
family
- column familyqualifier
- column qualifiervalue
- value to checkpublic boolean has(byte[] family, byte[] qualifier, long ts, byte[] value)
family
- column familyqualifier
- column qualifierts
- timestampvalue
- value to checkpublic List<Cell> get(byte[] family, byte[] qualifier)
family
- column familyqualifier
- column qualifierprotected boolean has(byte[] family, byte[] qualifier, long ts, byte[] value, boolean ignoreTS, boolean ignoreValue)
static byte[] checkRow(byte[] row)
row
- Row to checkrow
IllegalArgumentException
- Thrown if row
is empty or null or
> HConstants.MAX_ROW_LENGTH
static byte[] checkRow(byte[] row, int offset, int length)
row
- Row to checkoffset
- length
- row
IllegalArgumentException
- Thrown if row
is empty or null or
> HConstants.MAX_ROW_LENGTH
static void checkRow(ByteBuffer row)
Mutation add(Cell cell) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.