org.apache.hadoop.hbase.client
Class Mutation

java.lang.Object
  extended by org.apache.hadoop.hbase.client.Operation
      extended by org.apache.hadoop.hbase.client.OperationWithAttributes
          extended by org.apache.hadoop.hbase.client.Mutation
All Implemented Interfaces:
Comparable<Row>, CellScannable, Attributes, Row, HeapSize
Direct Known Subclasses:
Append, Delete, Increment, Put

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract class Mutation
extends OperationWithAttributes
implements Row, CellScannable, HeapSize


Field Summary
protected  Durability durability
           
protected  NavigableMap<byte[],List<Cell>> familyMap
           
static long MUTATION_OVERHEAD
           
protected  byte[] row
           
protected  long ts
           
 
Fields inherited from class org.apache.hadoop.hbase.client.OperationWithAttributes
ID_ATRIBUTE
 
Constructor Summary
Mutation()
           
 
Method Summary
 CellScanner cellScanner()
           
 int compareTo(Row d)
           
protected  long extraHeapSize()
          Subclasses should override this method to add the heap size of their own fields.
 byte[] getACL()
           
 boolean getACLStrategy()
          Deprecated. No effect
 CellVisibility getCellVisibility()
           
 List<UUID> getClusterIds()
           
 Durability getDurability()
          Get the current durability
 NavigableMap<byte[],List<Cell>> getFamilyCellMap()
          Method for retrieving the put's familyMap
 NavigableMap<byte[],List<KeyValue>> getFamilyMap()
          Deprecated. use getFamilyCellMap() instead.
 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 getTTL()
          Return the TTL requested for the result of the mutation, in milliseconds.
 boolean getWriteToWAL()
          Deprecated. Use getDurability() instead.
 long heapSize()
           
 boolean isEmpty()
          Method to check if the familyMap is empty
 int numFamilies()
           
 void setACL(Map<String,Permission> perms)
           
 void setACL(String user, Permission perms)
           
 void setACLStrategy(boolean cellFirstStrategy)
          Deprecated. No effect
 void setCellVisibility(CellVisibility expression)
          Sets the visibility expression associated with cells in this Mutation.
 void setClusterIds(List<UUID> clusterIds)
          Marks that the clusters with the given clusterIds have consumed the mutation
 void setDurability(Durability d)
          Set the durability for this mutation
 void setFamilyCellMap(NavigableMap<byte[],List<Cell>> map)
          Method for setting the put's familyMap
 void setFamilyMap(NavigableMap<byte[],List<KeyValue>> map)
          Deprecated. use setFamilyCellMap(NavigableMap) instead.
 Mutation setTTL(long ttl)
          Set the TTL desired for the result of the mutation, in milliseconds.
 void setWriteToWAL(boolean write)
          Deprecated. Use setDurability(Durability) instead.
 int size()
          Number of KeyValues carried by this Mutation.
 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.
 
Methods inherited from class org.apache.hadoop.hbase.client.OperationWithAttributes
getAttribute, getAttributeSize, getAttributesMap, getId, setAttribute, setId
 
Methods inherited from class org.apache.hadoop.hbase.client.Operation
toJSON, toJSON, toMap, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MUTATION_OVERHEAD

public static final long MUTATION_OVERHEAD

row

protected byte[] row

ts

protected long ts

durability

protected Durability durability

familyMap

protected NavigableMap<byte[],List<Cell>> familyMap
Constructor Detail

Mutation

public Mutation()
Method Detail

cellScanner

public CellScanner cellScanner()
Specified by:
cellScanner in interface CellScannable

getFingerprint

public Map<String,Object> getFingerprint()
Compile the column family (i.e. schema) information into a Map. Useful for parsing and aggregation by debugging, logging, and administration tools.

Specified by:
getFingerprint in class Operation
Returns:
Map

toMap

public 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. Useful for debugging, logging, and administration tools.

Specified by:
toMap in class Operation
Parameters:
maxCols - a limit on the number of columns output prior to truncation
Returns:
Map

getWriteToWAL

@Deprecated
public boolean getWriteToWAL()
Deprecated. Use getDurability() instead.

Returns:
true if edits should be applied to WAL, false if not

setWriteToWAL

@Deprecated
public void setWriteToWAL(boolean write)
Deprecated. Use setDurability(Durability) instead.

Set whether this Delete should be written to the WAL or not. Not writing the WAL means you may lose edits on server crash. This method will reset any changes made via setDurability(Durability)

Parameters:
write - true if edits should be written to WAL, false if not

setDurability

public void setDurability(Durability d)
Set the durability for this mutation

Parameters:
d -

getDurability

public Durability getDurability()
Get the current durability


getFamilyCellMap

public NavigableMap<byte[],List<Cell>> getFamilyCellMap()
Method for retrieving the put's familyMap

Returns:
familyMap

setFamilyCellMap

public void setFamilyCellMap(NavigableMap<byte[],List<Cell>> map)
Method for setting the put's familyMap


getFamilyMap

@Deprecated
public NavigableMap<byte[],List<KeyValue>> getFamilyMap()
Deprecated. use getFamilyCellMap() instead.

Method for retrieving the put's familyMap that is deprecated and inefficient.

Returns:
the map

setFamilyMap

@Deprecated
public void setFamilyMap(NavigableMap<byte[],List<KeyValue>> map)
Deprecated. use setFamilyCellMap(NavigableMap) instead.

Method for setting the put's familyMap that is deprecated and inefficient.


isEmpty

public boolean isEmpty()
Method to check if the familyMap is empty

Returns:
true if empty, false otherwise

getRow

public byte[] getRow()
Method for retrieving the delete's row

Specified by:
getRow in interface Row
Returns:
row

compareTo

public int compareTo(Row d)
Specified by:
compareTo in interface Comparable<Row>

getTimeStamp

public long getTimeStamp()
Method for retrieving the timestamp

Returns:
timestamp

setClusterIds

public void setClusterIds(List<UUID> clusterIds)
Marks that the clusters with the given clusterIds have consumed the mutation

Parameters:
clusterIds - of the clusters that have consumed the mutation

getClusterIds

public List<UUID> getClusterIds()
Returns:
the set of clusterIds that have consumed the mutation

setCellVisibility

@InterfaceStability.Unstable
public void setCellVisibility(CellVisibility expression)
Sets the visibility expression associated with cells in this Mutation. It is illegal to set CellVisibility on Delete mutation.

Parameters:
expression -

getCellVisibility

@InterfaceStability.Unstable
public CellVisibility getCellVisibility()
                                 throws DeserializationException
Returns:
CellVisibility associated with cells in this Mutation.
Throws:
DeserializationException

size

public int size()
Number of KeyValues carried by this Mutation.

Returns:
the total number of KeyValues

numFamilies

public int numFamilies()
Returns:
the number of different families

heapSize

public long heapSize()
Specified by:
heapSize in interface HeapSize
Returns:
Calculate what Mutation adds to class heap size.

getACL

@InterfaceStability.Unstable
public byte[] getACL()
Returns:
The serialized ACL for this operation, or null if none

setACL

@InterfaceStability.Unstable
public void setACL(String user,
                                               Permission perms)
Parameters:
user - User short name
perms - Permissions for the user

setACL

@InterfaceStability.Unstable
public void setACL(Map<String,Permission> perms)
Parameters:
perms - A map of permissions for a user or users

getACLStrategy

@Deprecated
public boolean getACLStrategy()
Deprecated. No effect


setACLStrategy

@Deprecated
public void setACLStrategy(boolean cellFirstStrategy)
Deprecated. No effect


getTTL

@InterfaceStability.Unstable
public long getTTL()
Return the TTL requested for the result of the mutation, in milliseconds.

Returns:
the TTL requested for the result of the mutation, in milliseconds, or Long.MAX_VALUE if unset

setTTL

@InterfaceStability.Unstable
public Mutation setTTL(long ttl)
Set the TTL desired for the result of the mutation, in milliseconds.

Parameters:
ttl - the TTL desired for the result of the mutation, in milliseconds
Returns:
this

extraHeapSize

protected long extraHeapSize()
Subclasses should override this method to add the heap size of their own fields.

Returns:
the heap size to add (will be aligned).


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.