public class

MultiRowUniquenessConstraint

extends Object
implements UniquenessConstraint
java.lang.Object
   ↳ com.netflix.astyanax.recipes.uniqueness.MultiRowUniquenessConstraint

Class Overview

Check uniqueness for multiple rows. This test is done by 1. First writing a unique column to all rows, in a single batch. Include a TTL for some failure conditions. 2. Reading back the unique columns from each row (must be done in a separate call) and making sure there is only one such column 3. Committing the columns without a TTL

Summary

Public Constructors
MultiRowUniquenessConstraint(Keyspace keyspace)
Public Methods
void acquire()
Acquire the row(s) for uniqueness.
void acquireAndMutate(MutationBatch mutation)
Acquire the uniqueness constraint and apply the final mutation if the row if found to be unique
String getLockColumn()
Return the lock column written to ALL rows
void release()
Release the uniqueness lock for this row.
MultiRowUniquenessConstraint withColumnPrefix(String prefix)
Specify the prefix that uniquely distinguishes the lock columns from data columns
MultiRowUniquenessConstraint withConsistencyLevel(ConsistencyLevel consistencyLevel)
Consistency level used
MultiRowUniquenessConstraint withLockId(String column)
Override the autogenerated lock column.
MultiRowUniquenessConstraint withRow(ColumnFamily<StringString> columnFamily, String rowKey)
Add a row to the set of rows being tested for uniqueness
MultiRowUniquenessConstraint withTtl(Integer ttl)
TTL to use for the uniquness operation.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.netflix.astyanax.recipes.uniqueness.UniquenessConstraint

Public Constructors

public MultiRowUniquenessConstraint (Keyspace keyspace)

Public Methods

public void acquire ()

Acquire the row(s) for uniqueness. Call release() when the uniqueness on the row(s) is no longer needed, such as when deleting the rows.

public void acquireAndMutate (MutationBatch mutation)

Acquire the uniqueness constraint and apply the final mutation if the row if found to be unique

public String getLockColumn ()

Return the lock column written to ALL rows

public void release ()

Release the uniqueness lock for this row. Only call this when you no longer need the uniqueness lock

Throws
Exception

public MultiRowUniquenessConstraint withColumnPrefix (String prefix)

Specify the prefix that uniquely distinguishes the lock columns from data columns

public MultiRowUniquenessConstraint withConsistencyLevel (ConsistencyLevel consistencyLevel)

Consistency level used

public MultiRowUniquenessConstraint withLockId (String column)

Override the autogenerated lock column.

public MultiRowUniquenessConstraint withRow (ColumnFamily<StringString> columnFamily, String rowKey)

Add a row to the set of rows being tested for uniqueness

public MultiRowUniquenessConstraint withTtl (Integer ttl)

TTL to use for the uniquness operation. This is the TTL for the columns to expire in the event of a client crash before the uniqueness can be committed