public class

ColumnPrefixUniquenessConstraint

extends Object
implements UniquenessConstraint
java.lang.Object
   ↳ com.netflix.astyanax.recipes.uniqueness.ColumnPrefixUniquenessConstraint<K>

Class Overview

Perform a uniqueness constraint using the locking recipe. The usage here is to take the lock and then re-write the column without a TTL to 'persist' it in cassandra.

Summary

Public Constructors
ColumnPrefixUniquenessConstraint(Keyspace keyspace, ColumnFamily<K, String> columnFamily, K key)
Public Methods
void acquire()
Acquire the row(s) for uniqueness.
void acquireAndMutate(MutationBatch m)
Acquire the uniqueness constraint and apply the final mutation if the row if found to be unique
String readUniqueColumn()
void release()
Release the uniqueness lock for this row.
ColumnPrefixUniquenessConstraint<K> withConsistencyLevel(ConsistencyLevel consistencyLevel)
ColumnPrefixUniquenessConstraint<K> withPrefix(String prefix)
ColumnPrefixUniquenessConstraint<K> withTtl(Integer ttl)
ColumnPrefixUniquenessConstraint<K> withUniqueId(String unique)
Specify the unique value to use for the column name when doing the uniqueness constraint.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.netflix.astyanax.recipes.uniqueness.UniquenessConstraint

Public Constructors

public ColumnPrefixUniquenessConstraint (Keyspace keyspace, ColumnFamily<K, String> columnFamily, K key)

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 m)

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

public String readUniqueColumn ()

Throws
Exception

public void release ()

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

Throws
Exception

public ColumnPrefixUniquenessConstraint<K> withConsistencyLevel (ConsistencyLevel consistencyLevel)

public ColumnPrefixUniquenessConstraint<K> withPrefix (String prefix)

public ColumnPrefixUniquenessConstraint<K> withTtl (Integer ttl)

public ColumnPrefixUniquenessConstraint<K> withUniqueId (String unique)

Specify the unique value to use for the column name when doing the uniqueness constraint. In many cases this will be a TimeUUID that is used as the row key to store the actual data for the unique key tracked in this column family.