public class CassandraStateRepository extends Object implements StateRepository
This repository implementation can be used to store the feature state in Cassandra using Astyanax client.
CassandraStateRepository stores the feature state in a column family called Togglz by default.
You can choose the name of this column family using a builder provided by this class.
If the repository doesn't find the column family, it will automatically create it.
The column family has the following format:
create column family Togglz
with comparator = 'UTF8Type'
and default_validation_class = UTF8Type
and key_validation_class = UTF8Type;
The class provides a builder which can be used to configure the repository:
StateRepository repository = CassandraStateRepository.newBuilder(keyspace)
.columnFamily("Togglz")
.autoCreateColumnFamily(false)
.mapSerializer(DefaultMapSerializer.singleline())
.build();
You need to provide a Keyspace to use CassandraStateRepository.
It can be created using KeyspaceBuilder or any other way.
| Modifier and Type | Class and Description |
|---|---|
static class |
CassandraStateRepository.Builder
Builder for a
CassandraStateRepository |
| Constructor and Description |
|---|
CassandraStateRepository(com.netflix.astyanax.Keyspace keyspace) |
| Modifier and Type | Method and Description |
|---|---|
FeatureState |
getFeatureState(Feature feature) |
static CassandraStateRepository.Builder |
newBuilder(com.netflix.astyanax.Keyspace keyspace)
Creates a new builder for creating a
CassandraStateRepository. |
void |
setFeatureState(FeatureState featureState) |
public CassandraStateRepository(com.netflix.astyanax.Keyspace keyspace)
public FeatureState getFeatureState(Feature feature)
getFeatureState in interface StateRepositorypublic void setFeatureState(FeatureState featureState)
setFeatureState in interface StateRepositorypublic static CassandraStateRepository.Builder newBuilder(com.netflix.astyanax.Keyspace keyspace)
CassandraStateRepository.keyspace - the Keyspace Togglz should use to query cassandra.
Can be created using the KeyspaceBuilder.Copyright © 2021. All rights reserved.