public class Mutation extends Object implements org.apache.hadoop.io.Writable
Convenience methods which takes columns and value as CharSequence (String implements CharSequence) are provided. CharSequence is converted to UTF-8 by constructing a new Text object.
When always passing in the same data as a CharSequence/String, it's probably more efficient to call the Text put methods. This way the data is only encoded once and only one Text object is created.
All of the put methods append data to the mutation; they do not overwrite anything that was previously put. The mutation holds a list of all columns/values that were put into it.
The putDelete() methods do not remove something that was previously added to the mutation; rather, they indicate that Accumulo should insert a delete marker for that row column. A delete marker effectively hides entries for that row column with a timestamp earlier than the marker's. (The hidden data is eventually removed during Accumulo garbage collection.)
Modifier and Type | Class and Description |
---|---|
static class |
Mutation.SERIALIZED_FORMAT
Formats available for serializing Mutations.
|
Constructor and Description |
---|
Mutation()
Creates a new mutation.
|
Mutation(byte[] row)
Creates a new mutation.
|
Mutation(byte[] row,
int initialBufferSize)
Creates a new mutation.
|
Mutation(byte[] row,
int start,
int length)
Creates a new mutation.
|
Mutation(byte[] row,
int start,
int length,
int initialBufferSize)
Creates a new mutation.
|
Mutation(CharSequence row)
Creates a new mutation.
|
Mutation(CharSequence row,
int initialBufferSize)
Creates a new mutation.
|
Mutation(Mutation m)
Creates a new mutation by copying another.
|
Mutation(org.apache.hadoop.io.Text row)
Creates a new mutation.
|
Mutation(org.apache.hadoop.io.Text row,
int initialBufferSize)
Creates a new mutation.
|
Mutation(org.apache.accumulo.core.data.thrift.TMutation tmutation)
Creates a new mutation from a Thrift mutation.
|
Modifier and Type | Method and Description |
---|---|
void |
addReplicationSource(String peer)
Add a new element to the set of peers which this Mutation originated from
|
protected void |
droppingOldTimestamp(long ts) |
boolean |
equals(Mutation m)
Checks if this mutation equals another.
|
boolean |
equals(Object o) |
long |
estimatedMemoryUsed()
Gets an estimate of the amount of memory used by this mutation.
|
Set<String> |
getReplicationSources()
Return the replication sources for this Mutation
|
byte[] |
getRow()
Gets the row ID for this mutation.
|
protected Mutation.SERIALIZED_FORMAT |
getSerializedFormat()
Gets the serialization format used to (de)serialize this mutation.
|
List<ColumnUpdate> |
getUpdates()
Gets the modifications and deletions in this mutation.
|
int |
hashCode() |
protected ColumnUpdate |
newColumnUpdate(byte[] cf,
byte[] cq,
byte[] cv,
boolean hasts,
long ts,
boolean deleted,
byte[] val) |
long |
numBytes()
Gets the total number of bytes in this mutation.
|
void |
put(byte[] columnFamily,
byte[] columnQualifier,
byte[] value)
Puts a modification in this mutation.
|
void |
put(byte[] columnFamily,
byte[] columnQualifier,
ColumnVisibility columnVisibility,
byte[] value)
Puts a modification in this mutation.
|
void |
put(byte[] columnFamily,
byte[] columnQualifier,
ColumnVisibility columnVisibility,
long timestamp,
byte[] value)
Puts a modification in this mutation.
|
void |
put(byte[] columnFamily,
byte[] columnQualifier,
long timestamp,
byte[] value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
CharSequence value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
ColumnVisibility columnVisibility,
CharSequence value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
ColumnVisibility columnVisibility,
long timestamp,
CharSequence value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
ColumnVisibility columnVisibility,
long timestamp,
Value value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
ColumnVisibility columnVisibility,
Value value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
long timestamp,
CharSequence value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
long timestamp,
Value value)
Puts a modification in this mutation.
|
void |
put(CharSequence columnFamily,
CharSequence columnQualifier,
Value value)
Puts a modification in this mutation.
|
void |
put(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier,
ColumnVisibility columnVisibility,
long timestamp,
Value value)
Puts a modification in this mutation.
|
void |
put(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier,
ColumnVisibility columnVisibility,
Value value)
Puts a modification in this mutation.
|
void |
put(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier,
long timestamp,
Value value)
Puts a modification in this mutation.
|
void |
put(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier,
Value value)
Puts a modification in this mutation.
|
void |
putDelete(byte[] columnFamily,
byte[] columnQualifier)
Puts a deletion in this mutation.
|
void |
putDelete(byte[] columnFamily,
byte[] columnQualifier,
ColumnVisibility columnVisibility)
Puts a deletion in this mutation.
|
void |
putDelete(byte[] columnFamily,
byte[] columnQualifier,
ColumnVisibility columnVisibility,
long timestamp)
Puts a deletion in this mutation.
|
void |
putDelete(byte[] columnFamily,
byte[] columnQualifier,
long timestamp)
Puts a deletion in this mutation.
|
void |
putDelete(CharSequence columnFamily,
CharSequence columnQualifier)
Puts a deletion in this mutation.
|
void |
putDelete(CharSequence columnFamily,
CharSequence columnQualifier,
ColumnVisibility columnVisibility)
Puts a deletion in this mutation.
|
void |
putDelete(CharSequence columnFamily,
CharSequence columnQualifier,
ColumnVisibility columnVisibility,
long timestamp)
Puts a deletion in this mutation.
|
void |
putDelete(CharSequence columnFamily,
CharSequence columnQualifier,
long timestamp)
Puts a deletion in this mutation.
|
void |
putDelete(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier)
Puts a deletion in this mutation.
|
void |
putDelete(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier,
ColumnVisibility columnVisibility)
Puts a deletion in this mutation.
|
void |
putDelete(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier,
ColumnVisibility columnVisibility,
long timestamp)
Puts a deletion in this mutation.
|
void |
putDelete(org.apache.hadoop.io.Text columnFamily,
org.apache.hadoop.io.Text columnQualifier,
long timestamp)
Puts a deletion in this mutation.
|
void |
readFields(DataInput in) |
void |
setReplicationSources(Set<String> sources)
Set the replication peers which this Mutation originated from
|
int |
size()
Gets the number of modifications / deletions in this mutation.
|
org.apache.accumulo.core.data.thrift.TMutation |
toThrift()
Creates a
TMutation object containing this
Mutation's data. |
void |
write(DataOutput out) |
public Mutation(byte[] row)
row
- row IDpublic Mutation(byte[] row, int initialBufferSize)
row
- row IDinitialBufferSize
- the initial size, in bytes, of the internal buffer for serializingpublic Mutation(byte[] row, int start, int length)
row
- byte array containing row IDstart
- starting index of row ID in byte arraylength
- length of row ID in byte arrayIndexOutOfBoundsException
- if start or length is invalidpublic Mutation(byte[] row, int start, int length, int initialBufferSize)
row
- byte array containing row IDstart
- starting index of row ID in byte arraylength
- length of row ID in byte arrayinitialBufferSize
- the initial size, in bytes, of the internal buffer for serializingIndexOutOfBoundsException
- if start or length is invalidpublic Mutation(org.apache.hadoop.io.Text row)
row
- row IDpublic Mutation(org.apache.hadoop.io.Text row, int initialBufferSize)
row
- row IDinitialBufferSize
- the initial size, in bytes, of the internal buffer for serializingpublic Mutation(CharSequence row)
row
- row IDpublic Mutation(CharSequence row, int initialBufferSize)
row
- row IDinitialBufferSize
- the initial size, in bytes, of the internal buffer for serializingpublic Mutation()
public Mutation(org.apache.accumulo.core.data.thrift.TMutation tmutation)
tmutation
- Thrift mutationpublic Mutation(Mutation m)
m
- mutation to copypublic byte[] getRow()
public void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, Value value)
columnFamily
- column familycolumnQualifier
- column qualifiervalue
- cell valuepublic void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, Value value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilityvalue
- cell valuepublic void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, long timestamp, Value value)
columnFamily
- column familycolumnQualifier
- column qualifiertimestamp
- timestampvalue
- cell valuepublic void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitytimestamp
- timestampvalue
- cell valuepublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier)
columnFamily
- column familycolumnQualifier
- column qualifierpublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitypublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, long timestamp)
columnFamily
- column familycolumnQualifier
- column qualifiertimestamp
- timestamppublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, long timestamp)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitytimestamp
- timestamppublic void put(CharSequence columnFamily, CharSequence columnQualifier, Value value)
columnFamily
- column familycolumnQualifier
- column qualifierpublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, Value value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilityvalue
- cell valuepublic void put(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, Value value)
columnFamily
- column familycolumnQualifier
- column qualifiertimestamp
- timestampvalue
- cell valuepublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitytimestamp
- timestampvalue
- cell valuepublic void putDelete(CharSequence columnFamily, CharSequence columnQualifier)
columnFamily
- column familycolumnQualifier
- column qualifierpublic void putDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitypublic void putDelete(CharSequence columnFamily, CharSequence columnQualifier, long timestamp)
columnFamily
- column familycolumnQualifier
- column qualifiertimestamp
- timestamppublic void putDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitytimestamp
- timestamppublic void put(CharSequence columnFamily, CharSequence columnQualifier, CharSequence value)
columnFamily
- column familycolumnQualifier
- column qualifiervalue
- cell valuepublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, CharSequence value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilityvalue
- cell valuepublic void put(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, CharSequence value)
columnFamily
- column familycolumnQualifier
- column qualifiertimestamp
- timestampvalue
- cell valuepublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, CharSequence value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitytimestamp
- timestampvalue
- cell valuepublic void put(byte[] columnFamily, byte[] columnQualifier, byte[] value)
columnFamily
- column familycolumnQualifier
- column qualifiervalue
- cell valuepublic void put(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, byte[] value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilityvalue
- cell valuepublic void put(byte[] columnFamily, byte[] columnQualifier, long timestamp, byte[] value)
columnFamily
- column familycolumnQualifier
- column qualifiertimestamp
- timestampvalue
- cell valuepublic void put(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp, byte[] value)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitytimestamp
- timestampvalue
- cell valuepublic void putDelete(byte[] columnFamily, byte[] columnQualifier)
columnFamily
- column familycolumnQualifier
- column qualifierpublic void putDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitypublic void putDelete(byte[] columnFamily, byte[] columnQualifier, long timestamp)
columnFamily
- column familycolumnQualifier
- column qualifiertimestamp
- timestamppublic void putDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp)
columnFamily
- column familycolumnQualifier
- column qualifiercolumnVisibility
- column visibilitytimestamp
- timestamppublic List<ColumnUpdate> getUpdates()
protected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val)
public long numBytes()
public long estimatedMemoryUsed()
public int size()
public void addReplicationSource(String peer)
peer
- the peer to addpublic void setReplicationSources(Set<String> sources)
sources
- Set of peer names which have processed this updatepublic Set<String> getReplicationSources()
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
protected void droppingOldTimestamp(long ts)
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public boolean equals(Mutation m)
equals(Object)
. See ACCUMULO-1627 for more information.m
- mutation to comparepublic org.apache.accumulo.core.data.thrift.TMutation toThrift()
TMutation
object containing this
Mutation's data.
Note that this method will move the Mutation into a "serialized" state that will prevent users
from adding more data via Mutation#put().protected Mutation.SERIALIZED_FORMAT getSerializedFormat()
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.