T
- the concrete sub-class of TableOptions
public abstract class TableOptions<T extends TableOptions> extends SchemaStatement
Implementation notes: this class is abstract and not meant to use directly.
The type parameter T
allows usage of covariant return type and makes the builder pattern work for different sub-classes.
Modifier and Type | Class and Description |
---|---|
static class |
TableOptions.CachingRowsPerPartition
Define the number of rows to be cached per partition when row caching is enabled
(this feature is only applicable to Cassandra 2.1.x).
|
static class |
TableOptions.CompactionOptions<T extends TableOptions.CompactionOptions>
Compaction options for a CREATE or ALTER TABLE statement.
|
static class |
TableOptions.CompressionOptions
The compression options for a CREATE or ALTER TABLE statement.
|
static class |
TableOptions.SpeculativeRetryValue
The speculative retry options.
|
idempotent, NULL_PAYLOAD_VALUE
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addSpecificOptions(List<String> options) |
T |
bloomFilterFPChance(Double fpChance)
Define the desired false-positive probability for SSTable Bloom filters.
|
String |
buildInternal() |
T |
caching(SchemaBuilder.Caching caching)
Define the caching type for Cassandra 2.0.x.
|
T |
caching(SchemaBuilder.KeyCaching keys,
TableOptions.CachingRowsPerPartition rowsPerPartition)
Define the caching options for Cassandra 2.1.x.
|
T |
comment(String comment)
Define a human readable comment describing the table.
|
T |
compactionOptions(TableOptions.CompactionOptions compactionOptions)
Define the compaction options.
|
T |
compressionOptions(TableOptions.CompressionOptions compressionOptions)
Define the compression options.
|
T |
dcLocalReadRepairChance(Double dcLocalReadRepairChance)
Define the probability of read repairs being invoked over all replicas in the current data center.
|
T |
defaultTimeToLive(Integer defaultTimeToLive)
Define the default expiration time in seconds for a table.
|
T |
freeformOption(String key,
Object value)
Define a free-form option as a key/value pair.
|
T |
gcGraceSeconds(Integer gcGraceSeconds)
Define the time to wait before garbage collecting tombstones (deletion markers).
|
T |
indexInterval(Integer indexInterval)
Define the index interval for Cassandra 2.0.
|
T |
maxIndexInterval(Integer maxIndexInterval)
Define the maximum index interval for Cassandra 2.1.
|
T |
memtableFlushPeriodInMillis(Integer memtableFlushPeriodInMillis)
Define the memtable flush period.
|
T |
minIndexInterval(Integer minIndexInterval)
Define the minimum index interval for Cassandra 2.1.
|
T |
populateIOCacheOnFlush(Boolean populateIOOnCacheFlush)
Define whether to populate IO cache on flush of sstables.
|
T |
readRepairChance(Double readRepairChance)
Define the probability with which read repairs should be invoked on non-quorum reads.
|
T |
replicateOnWrite(Boolean replicateOnWrite)
Define whether to replicate data on write (Cassandra 2.0.x only).
|
T |
speculativeRetry(TableOptions.SpeculativeRetryValue speculativeRetry)
To override normal read timeout when read_repair_chance is not 1.0, sending another request to read, choose one of these values and use the property to create
or alter the table:
ALWAYS: Retry reads of all replicas.
Xpercentile: Retry reads based on the effect on throughput and latency.
Yms: Retry reads after specified milliseconds.
NONE: Do not retry reads.
Using the speculative retry property, you can configure rapid read protection in Cassandra 2.0.2 and later.
|
getKeyspace, getQueryString, getRoutingKey, getValues, hasValues
toString
disableTracing, enableTracing, getConsistencyLevel, getDefaultTimestamp, getFetchSize, getRetryPolicy, getSerialConsistencyLevel, isIdempotent, isTracing, setConsistencyLevel, setDefaultTimestamp, setFetchSize, setIdempotent, setOutgoingPayload, setPagingState, setPagingStateUnsafe, setRetryPolicy, setSerialConsistencyLevel
public T caching(SchemaBuilder.Caching caching)
If no call is made to this method, the default value set by Cassandra is SchemaBuilder.Caching.KEYS_ONLY
.
caching
- the caching type (all enum values are allowed).TableOptions
object.public T caching(SchemaBuilder.KeyCaching keys, TableOptions.CachingRowsPerPartition rowsPerPartition)
If no call is made to this method, the default values set by Cassandra are keys = SchemaBuilder.Caching.ALL
and
rows_per_partition = SchemaBuilder.noRows()
.
keys
- the key cache type.rowsPerPartition
- defines the number of rows to be cached per partition when Row Caching is enabled.
To create instances, use
SchemaBuilder.noRows()
,
SchemaBuilder.allRows()
or
SchemaBuilder.rows(int)
.TableOptions
object.public T bloomFilterFPChance(Double fpChance)
If no call is made to this method, the default value set by Cassandra is:
fpChance
- the false positive change. This value should be between 0 and 1.0.TableOptions
object.public T comment(String comment)
comment
- the comment.TableOptions
object.public T compressionOptions(TableOptions.CompressionOptions compressionOptions)
If no call is made to this method, the default value set by Cassandra is SchemaBuilder.lz4()
.
compressionOptions
- the compression options. To create instances, use
SchemaBuilder.noCompression()
,
SchemaBuilder.lz4()
,
SchemaBuilder.snappy()
or
SchemaBuilder.deflate()
.TableOptions
object.public T compactionOptions(TableOptions.CompactionOptions compactionOptions)
If no call is made to this method, the default value set by Cassandra is SchemaBuilder.sizedTieredStategy()
.
compactionOptions
- the compaction options. To create instances, use
SchemaBuilder.sizedTieredStategy()
,
SchemaBuilder.leveledStrategy()
or
SchemaBuilder.dateTieredStrategy()
TableOptions
object.public T dcLocalReadRepairChance(Double dcLocalReadRepairChance)
If no call is made to this method, the default value set by Cassandra is 0.0.
dcLocalReadRepairChance
- the probability.TableOptions
object.public T defaultTimeToLive(Integer defaultTimeToLive)
Used in MapReduce/Hive scenarios when you have no control of TTL.
If no call is made to this method, the default value set by Cassandra is 0.
defaultTimeToLive
- the default time to live in seconds for a table.TableOptions
object.public T gcGraceSeconds(Integer gcGraceSeconds)
If no call is made to this method, the default value set by Cassandra is 864000 secs (10 days).
gcGraceSeconds
- the grace period.TableOptions
object.public T indexInterval(Integer indexInterval)
If no call is made to this method, the default value set by Cassandra is 128.
indexInterval
- the index interval.TableOptions
object.public T minIndexInterval(Integer minIndexInterval)
If no call is made to this method, the default value set by Cassandra is 128.
minIndexInterval
- the minimum index interval.TableOptions
object.indexInterval(Integer)
public T maxIndexInterval(Integer maxIndexInterval)
If no call is made to this method, the default value set by Cassandra is 2048.
maxIndexInterval
- the maximum index interval.TableOptions
object.indexInterval(Integer)
public T memtableFlushPeriodInMillis(Integer memtableFlushPeriodInMillis)
If no call is made to this method, the default value set by Cassandra is 0.
memtableFlushPeriodInMillis
- the memtable flush period in milliseconds.TableOptions
object.public T populateIOCacheOnFlush(Boolean populateIOOnCacheFlush)
If no call is made to this method, the default value set by Cassandra is false
.
populateIOOnCacheFlush
- whether to populate IO cache on flush of sstables.TableOptions
object.public T readRepairChance(Double readRepairChance)
If no call is made to this method, the default value set by Cassandra is 0.1.
readRepairChance
- the read repair chance.TableOptions
object.public T replicateOnWrite(Boolean replicateOnWrite)
true
, replicates writes to all affected replicas regardless of the consistency level specified by the client for a write request.
For counter tables, this should always be set to true
.
If no call is made to this method, the default value set by Cassandra is true
.
replicateOnWrite
- whether to replicate data on write.TableOptions
object.public T speculativeRetry(TableOptions.SpeculativeRetryValue speculativeRetry)
If no call is made to this method, the default value set by Cassandra is {code 99percentile}.
speculativeRetry
- the speculative retry. To create instances, use
SchemaBuilder.noSpeculativeRetry()
,
SchemaBuilder.always()
,
SchemaBuilder.percentile(int)
or
SchemaBuilder.millisecs(int)
.TableOptions
object.public T freeformOption(String key, Object value)
This method is provided as a fallback if the SchemaBuilder is used with a more recent version of Cassandra that has new, unsupported options.
key
- the name of the option.value
- the value of the option. If it's a String
, it will be included in single quotes, otherwise the result of invoking its
toString
method will be used unquoted.TableOptions
object.public final String buildInternal()
Copyright © 2012–2015. All rights reserved.