com.netflix.astyanax.recipes.uniqueness
Class MultiRowUniquenessConstraint

java.lang.Object
  extended by com.netflix.astyanax.recipes.uniqueness.MultiRowUniquenessConstraint
All Implemented Interfaces:
UniquenessConstraint

public class MultiRowUniquenessConstraint
extends Object
implements UniquenessConstraint

Check uniqueness for multiple rows.

Author:
elandau

Constructor Summary
MultiRowUniquenessConstraint(Keyspace keyspace)
           
 
Method Summary
 void acquire()
          Acquire the row(s) for uniqueness.
 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 withLockColumn(String column)
          Override the autogenerated lock column.
 MultiRowUniquenessConstraint withRow(ColumnFamily<String,String> 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiRowUniquenessConstraint

public MultiRowUniquenessConstraint(Keyspace keyspace)
Method Detail

withTtl

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

Parameters:
ttl -
Returns:

withColumnPrefix

public MultiRowUniquenessConstraint withColumnPrefix(String prefix)
Specify the prefix that uniquely distinguishes the lock columns from data columns

Parameters:
prefix -
Returns:

withLockColumn

public MultiRowUniquenessConstraint withLockColumn(String column)
Override the autogenerated lock column. Should always be called AFTER withColumnPrefix.

Parameters:
column -
Returns:

withConsistencyLevel

public MultiRowUniquenessConstraint withConsistencyLevel(ConsistencyLevel consistencyLevel)
Consistency level used

Parameters:
consistencyLevel -
Returns:

withRow

public MultiRowUniquenessConstraint withRow(ColumnFamily<String,String> columnFamily,
                                            String rowKey)
Add a row to the set of rows being tested for uniqueness

Parameters:
columnFamily -
rowKey -
Returns:

getLockColumn

public String getLockColumn()
Return the lock column written to ALL rows

Returns:

acquire

public void acquire()
             throws NotUniqueException,
                    Exception
Description copied from interface: UniquenessConstraint
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.

Specified by:
acquire in interface UniquenessConstraint
Throws:
NotUniqueException
Exception

release

public void release()
             throws Exception
Description copied from interface: UniquenessConstraint
Release the uniqueness lock for this row.

Specified by:
release in interface UniquenessConstraint
Throws:
Exception


Copyright © 2012. All Rights Reserved.