|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.scale7.cassandra.pelops.Operand
org.scale7.cassandra.pelops.Mutator
public class Mutator
Facilitates the mutation of data within a Cassandra keyspace: the desired mutations should first be specified by
calling methods such as writeColumn(...), which should then be sent to Cassandra in a single batch by
calling execute(...). After the desired batch of mutations has been executed, the Mutator
object can not be re-used.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.scale7.cassandra.pelops.Operand |
|---|
Operand.IOperation<ReturnType> |
| Field Summary | |
|---|---|
protected boolean |
deleteIfNull
|
static int |
NO_TTL
Used to indicate that the ttl property on column instances should not be set. |
protected long |
timestamp
|
protected int |
ttl
|
| Fields inherited from class org.scale7.cassandra.pelops.Operand |
|---|
thrift |
| Constructor Summary | |
|---|---|
Mutator(IThriftPool thrift)
Create a batch mutation operation. |
|
Mutator(IThriftPool thrift,
long timestamp,
boolean deleteIfNull)
Create a batch mutation operation. |
|
Mutator(IThriftPool thrift,
long timestamp,
boolean deleteIfNull,
int ttl)
Create a batch mutation operation. |
|
| Method Summary | |
|---|---|
Mutator |
deleteColumn(String colFamily,
Bytes rowKey,
Bytes colName)
Delete a column or super column. |
Mutator |
deleteColumn(String colFamily,
String rowKey,
Bytes colName)
Delete a column or super column. |
Mutator |
deleteColumn(String colFamily,
String rowKey,
String colName)
Delete a column or super column |
Mutator |
deleteColumns(String colFamily,
Bytes rowKey,
Bytes... colNames)
Delete a list of columns or super columns. |
Mutator |
deleteColumns(String colFamily,
Bytes rowKey,
List<Bytes> colNames)
Delete a list of columns or super columns. |
Mutator |
deleteColumns(String colFamily,
String rowKey,
Bytes... colNames)
Delete a list of columns or super columns. |
Mutator |
deleteColumns(String colFamily,
String rowKey,
List<Bytes> colNames)
Delete a list of columns or super columns. |
Mutator |
deleteColumns(String colFamily,
String rowKey,
String... colNames)
Delete a list of columns or super columns. |
Mutator |
deleteSubColumn(String colFamily,
Bytes rowKey,
Bytes colName,
Bytes subColName)
Delete a column or super column. |
Mutator |
deleteSubColumn(String colFamily,
String rowKey,
Bytes colName,
Bytes subColName)
Delete a column or super column. |
Mutator |
deleteSubColumn(String colFamily,
String rowKey,
Bytes colName,
String subColName)
Delete a column or super column. |
Mutator |
deleteSubColumn(String colFamily,
String rowKey,
String colName,
Bytes subColName)
Delete a column or super column. |
Mutator |
deleteSubColumn(String colFamily,
String rowKey,
String colName,
String subColName)
Delete a column or super column. |
Mutator |
deleteSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
List<Bytes> subColNames)
Delete a list of sub-columns |
Mutator |
deleteSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
String... subColNames)
Delete a list of sub-columns |
Mutator |
deleteSubColumns(String colFamily,
String rowKey,
Bytes colName)
Delete all sub-columns |
Mutator |
deleteSubColumns(String colFamily,
String rowKey,
Bytes colName,
List<Bytes> subColNames)
Delete a list of sub-columns |
Mutator |
deleteSubColumns(String colFamily,
String rowKey,
Bytes colName,
String... subColNames)
Delete a list of sub-columns |
Mutator |
deleteSubColumns(String colFamily,
String rowKey,
String colName)
Delete all sub-columns |
Mutator |
deleteSubColumns(String colFamily,
String rowKey,
String colName,
List<Bytes> subColNames)
Delete a list of sub-columns |
Mutator |
deleteSubColumns(String colFamily,
String rowKey,
String colName,
String... subColNames)
Delete a list of sub-columns |
void |
execute(org.apache.cassandra.thrift.ConsistencyLevel cLevel)
Execute the mutations that have been specified by sending them to Cassandra in a single batch. |
protected Map<Bytes,Map<String,List<org.apache.cassandra.thrift.Mutation>>> |
getBatch()
|
protected org.scale7.cassandra.pelops.Mutator.MutationList |
getMutationList(String colFamily,
Bytes key)
|
Bytes |
getMutationTimestamp(boolean microsToMillis)
Get the default time stamp used by this Mutator instance as a byte[]. |
long |
getMutationTimestampValue()
Get the raw time stamp value used by this Mutator instance. |
org.apache.cassandra.thrift.Column |
newColumn(Bytes colName,
Bytes colValue)
Create new Column object with the time stamp passed to the constructor |
org.apache.cassandra.thrift.Column |
newColumn(Bytes colName,
Bytes colValue,
int ttl)
Create new Column object with the time stamp passed to the constructor |
org.apache.cassandra.thrift.Column |
newColumn(Bytes colName,
String colValue)
Create new Column object with the time stamp passed to the constructor |
org.apache.cassandra.thrift.Column |
newColumn(Bytes colName,
String colValue,
int ttl)
Create new Column object with the time stamp passed to the constructor |
org.apache.cassandra.thrift.Column |
newColumn(String colName,
Bytes colValue)
Create new Column object with the time stamp passed to the constructor |
org.apache.cassandra.thrift.Column |
newColumn(String colName,
Bytes colValue,
int ttl)
Create new Column object with the time stamp passed to the constructor |
org.apache.cassandra.thrift.Column |
newColumn(String colName,
String colValue)
Create new Column object with the time stamp passed to the constructor |
org.apache.cassandra.thrift.Column |
newColumn(String colName,
String colValue,
int ttl)
Create new Column object with the time stamp passed to the constructor |
List<org.apache.cassandra.thrift.Column> |
newColumnList(org.apache.cassandra.thrift.Column... columns)
Create a list of Column objects. |
Mutator |
writeColumn(String colFamily,
Bytes rowKey,
org.apache.cassandra.thrift.Column column)
Write a column value. |
Mutator |
writeColumn(String colFamily,
Bytes rowKey,
org.apache.cassandra.thrift.Column column,
boolean deleteIfNullValue)
Write a column value. |
Mutator |
writeColumn(String colFamily,
String rowKey,
org.apache.cassandra.thrift.Column column)
Write a column value. |
Mutator |
writeColumns(String colFamily,
Bytes rowKey,
List<org.apache.cassandra.thrift.Column> columns)
Write a list of columns to a key |
Mutator |
writeColumns(String colFamily,
Bytes rowKey,
List<org.apache.cassandra.thrift.Column> columns,
boolean deleteIfNullValue)
Write a list of columns to a key. |
Mutator |
writeColumns(String colFamily,
String rowKey,
List<org.apache.cassandra.thrift.Column> columns)
Write a list of columns to a key |
Mutator |
writeSubColumn(String colFamily,
Bytes rowKey,
Bytes colName,
org.apache.cassandra.thrift.Column subColumn)
Write a single sub-column value to a super column. |
Mutator |
writeSubColumn(String colFamily,
String rowKey,
Bytes colName,
org.apache.cassandra.thrift.Column subColumn)
Write a single sub-column value to a super column. |
Mutator |
writeSubColumn(String colFamily,
String rowKey,
String colName,
org.apache.cassandra.thrift.Column subColumn)
Write a single sub-column value to a super column. |
Mutator |
writeSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
List<org.apache.cassandra.thrift.Column> subColumns)
Write multiple sub-column values to a super column. |
Mutator |
writeSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
List<org.apache.cassandra.thrift.Column> subColumns,
boolean deleteIfNullValue)
Write multiple sub-column values to a super column. |
Mutator |
writeSubColumns(String colFamily,
String rowKey,
Bytes colName,
List<org.apache.cassandra.thrift.Column> subColumns)
Write multiple sub-column values to a super column. |
Mutator |
writeSubColumns(String colFamily,
String rowKey,
String colName,
List<org.apache.cassandra.thrift.Column> subColumns)
Write multiple sub-column values to a super column. |
| Methods inherited from class org.scale7.cassandra.pelops.Operand |
|---|
tryOperation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_TTL
protected final long timestamp
protected final boolean deleteIfNull
protected final int ttl
| Constructor Detail |
|---|
public Mutator(IThriftPool thrift)
public Mutator(IThriftPool thrift,
long timestamp,
boolean deleteIfNull)
timestamp - The time stamp to use for the operation.
public Mutator(IThriftPool thrift,
long timestamp,
boolean deleteIfNull,
int ttl)
thrift - the pooltimestamp - The time stamp to use for the operation.deleteIfNull - determine if null values on columns will result in a deletettl - the ttl (in seconds) that columns created using the various newColumn(Bytes, Bytes)
helper methods will default to (null to indicate no default)| Method Detail |
|---|
public void execute(org.apache.cassandra.thrift.ConsistencyLevel cLevel)
throws PelopsException
cLevel - The Cassandra consistency level to be used
PelopsException
public Mutator writeColumn(String colFamily,
String rowKey,
org.apache.cassandra.thrift.Column column)
colFamily - The column familyrowKey - The key of the row to modifycolumn - The value of the column
public Mutator writeColumn(String colFamily,
Bytes rowKey,
org.apache.cassandra.thrift.Column column)
colFamily - The column familyrowKey - The key of the row to modifycolumn - The value of the column
public Mutator writeColumn(String colFamily,
Bytes rowKey,
org.apache.cassandra.thrift.Column column,
boolean deleteIfNullValue)
colFamily - The column familyrowKey - The key of the row to modifycolumn - The value of the columndeleteIfNullValue - If true and the provided column does NOT have value (as determined by the
Column.isSetValue() method) then issue a
delete instead.
public Mutator writeColumns(String colFamily,
String rowKey,
List<org.apache.cassandra.thrift.Column> columns)
colFamily - The column familyrowKey - The key of the row to modifycolumns - The list of columns to write
public Mutator writeColumns(String colFamily,
Bytes rowKey,
List<org.apache.cassandra.thrift.Column> columns)
colFamily - The column familyrowKey - The key of the row to modifycolumns - The list of columns to write
public Mutator writeColumns(String colFamily,
Bytes rowKey,
List<org.apache.cassandra.thrift.Column> columns,
boolean deleteIfNullValue)
colFamily - The column familyrowKey - The key of the row to modifycolumns - The list of columns to writedeleteIfNullValue - If true and if the provided columns do NOT have value (as determined by the
Column.isSetValue() method) then issue a
delete instead.
public Mutator writeSubColumn(String colFamily,
String rowKey,
String colName,
org.apache.cassandra.thrift.Column subColumn)
writeSubColumns
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super columnsubColumn - The sub-column
public Mutator writeSubColumn(String colFamily,
String rowKey,
Bytes colName,
org.apache.cassandra.thrift.Column subColumn)
writeSubColumns
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super columnsubColumn - The sub-column
public Mutator writeSubColumn(String colFamily,
Bytes rowKey,
Bytes colName,
org.apache.cassandra.thrift.Column subColumn)
writeSubColumns
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super columnsubColumn - The sub-column
public Mutator writeSubColumns(String colFamily,
String rowKey,
String colName,
List<org.apache.cassandra.thrift.Column> subColumns)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super columnsubColumns - A list of the sub-columns to write
public Mutator writeSubColumns(String colFamily,
String rowKey,
Bytes colName,
List<org.apache.cassandra.thrift.Column> subColumns)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super columnsubColumns - A list of the sub-columns to write
public Mutator writeSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
List<org.apache.cassandra.thrift.Column> subColumns)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super columnsubColumns - A list of the sub-columns to write
public Mutator writeSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
List<org.apache.cassandra.thrift.Column> subColumns,
boolean deleteIfNullValue)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super columnsubColumns - A list of the sub-columns to writedeleteIfNullValue - If true and if the provided columns do NOT have values (as determined by the
Column.isSetValue() method) then issue a
call to deleteSubColumns(String, String, Bytes) with the columns that
have no values.
public Mutator deleteColumn(String colFamily,
String rowKey,
String colName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the column or super column to delete.
public Mutator deleteColumn(String colFamily,
String rowKey,
Bytes colName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the column or super column to delete.
public Mutator deleteColumn(String colFamily,
Bytes rowKey,
Bytes colName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the column or super column to delete.
public Mutator deleteColumns(String colFamily,
String rowKey,
Bytes... colNames)
colFamily - The column familyrowKey - The key of the row to modifycolNames - The column and/or super column names to delete
public Mutator deleteColumns(String colFamily,
Bytes rowKey,
Bytes... colNames)
colFamily - The column familyrowKey - The key of the row to modifycolNames - The column and/or super column names to delete
public Mutator deleteColumns(String colFamily,
String rowKey,
String... colNames)
colFamily - The column familyrowKey - The key of the row to modifycolNames - The column and/or super column names to delete
public Mutator deleteColumns(String colFamily,
String rowKey,
List<Bytes> colNames)
colFamily - The column familyrowKey - The key of the row to modifycolNames - The column and/or super column names to delete
public Mutator deleteColumns(String colFamily,
Bytes rowKey,
List<Bytes> colNames)
colFamily - The column familyrowKey - The key of the row to modifycolNames - The column and/or super column names to delete
public Mutator deleteSubColumn(String colFamily,
String rowKey,
String colName,
String subColName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modify.subColName - The name of the sub-column to delete.
public Mutator deleteSubColumn(String colFamily,
String rowKey,
Bytes colName,
String subColName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modify.subColName - The name of the sub-column to delete.
public Mutator deleteSubColumn(String colFamily,
String rowKey,
String colName,
Bytes subColName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modify.subColName - The name of the sub-column to delete.
public Mutator deleteSubColumn(String colFamily,
String rowKey,
Bytes colName,
Bytes subColName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modify.subColName - The name of the sub-column to delete.
public Mutator deleteSubColumn(String colFamily,
Bytes rowKey,
Bytes colName,
Bytes subColName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modify.subColName - The name of the sub-column to delete.
public Mutator deleteSubColumns(String colFamily,
String rowKey,
String colName,
String... subColNames)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modifysubColNames - The sub-column names to delete (empty value will result in all columns being removed)
public Mutator deleteSubColumns(String colFamily,
String rowKey,
Bytes colName,
String... subColNames)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modifysubColNames - The sub-column names to delete (empty value will result in all columns being removed)
public Mutator deleteSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
String... subColNames)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modifysubColNames - The sub-column names to delete (empty value will result in all columns being removed)
public Mutator deleteSubColumns(String colFamily,
String rowKey,
String colName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modify
public Mutator deleteSubColumns(String colFamily,
String rowKey,
String colName,
List<Bytes> subColNames)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modifysubColNames - The sub-column names to delete
public Mutator deleteSubColumns(String colFamily,
String rowKey,
Bytes colName)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modify
public Mutator deleteSubColumns(String colFamily,
String rowKey,
Bytes colName,
List<Bytes> subColNames)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modifysubColNames - The sub-column names to delete
public Mutator deleteSubColumns(String colFamily,
Bytes rowKey,
Bytes colName,
List<Bytes> subColNames)
colFamily - The column familyrowKey - The key of the row to modifycolName - The name of the super column to modifysubColNames - The sub-column names to delete
public org.apache.cassandra.thrift.Column newColumn(String colName,
String colValue)
colName - The column namecolValue - The column value
Column object
public org.apache.cassandra.thrift.Column newColumn(String colName,
String colValue,
int ttl)
colName - The column namecolValue - The column valuettl - The time to live (in seconds) for the column
Column object
public org.apache.cassandra.thrift.Column newColumn(Bytes colName,
String colValue)
colName - The column namecolValue - The column value
Column object
public org.apache.cassandra.thrift.Column newColumn(Bytes colName,
String colValue,
int ttl)
colName - The column namecolValue - The column valuettl - The time to live (in seconds) for the column
Column object
public org.apache.cassandra.thrift.Column newColumn(String colName,
Bytes colValue)
colName - The column namecolValue - The column value
Column object
public org.apache.cassandra.thrift.Column newColumn(String colName,
Bytes colValue,
int ttl)
colName - The column namecolValue - The column valuettl - The time to live (in seconds) for the column
Column object
public org.apache.cassandra.thrift.Column newColumn(Bytes colName,
Bytes colValue)
colName - The column namecolValue - The column value
Column object
public org.apache.cassandra.thrift.Column newColumn(Bytes colName,
Bytes colValue,
int ttl)
colName - The column namecolValue - The column valuettl - The time to live (in seconds) for the column (-1 for default)
Column objectpublic List<org.apache.cassandra.thrift.Column> newColumnList(org.apache.cassandra.thrift.Column... columns)
Column objects.
columns - The columns from which to compose the list
Column objectspublic Bytes getMutationTimestamp(boolean microsToMillis)
Mutator instance as a byte[].
microsToMillis - If the time stamp is UTC microseconds (as is a self-constructed time stamp), whether to convert this into a standard milliseconds value
long valuepublic long getMutationTimestampValue()
Mutator instance.
protected Map<Bytes,Map<String,List<org.apache.cassandra.thrift.Mutation>>> getBatch()
protected org.scale7.cassandra.pelops.Mutator.MutationList getMutationList(String colFamily,
Bytes key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||