Package org.apache.cassandra.config
Enum Converters
- java.lang.Object
-
- java.lang.Enum<Converters>
-
- org.apache.cassandra.config.Converters
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Converters>
public enum Converters extends java.lang.Enum<Converters>
Converters for backward compatibility with the old cassandra.yaml where duration, data rate and data storage configuration parameters were provided only by value and the expected unit was part of the configuration parameter name(suffix). (CASSANDRA-15234) It is important to be noted that this converter is not intended to be used when we don't change name of a configuration parameter but we want to add unit. This would always default to the old value provided without a unit at the moment. In case this functionality is needed at some point, please, raise a Jira ticket. There is only one exception handling three parameters (key_cache_save_period, row_cache_save_period, counter_cache_save_period) - the SECONDS_CUSTOM_DURATION converter.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BYTES_CUSTOM_DATASTORAGE
This converter is used to support backward compatibility for parameters where in the past negative number was used as a value Example: native_transport_max_concurrent_requests_in_bytes_per_ip = -1 and native_transport_max_request_data_in_flight_per_ip = null are equal.BYTES_DATASTORAGE
IDENTITY
This converter is used when we change the name of a cassandra.yaml configuration parameter but we want to be able to still use the old name too.INTEGER_PRIMITIVE_LONG
KEYSPACE_COUNT_THRESHOLD_TO_GUARDRAIL
KIBIBYTES_DATASTORAGE
LONG_BYTES_DATASTORAGE_MEBIBYTES_DATASTORAGE
LONG_BYTES_DATASTORAGE_MEBIBYTES_INT
MEBIBYTES_DATA_STORAGE_INT
MEBIBYTES_DATA_STORAGE_LONG
MEBIBYTES_PER_SECOND_DATA_RATE
MEGABITS_TO_BYTES_PER_SECOND_DATA_RATE
This converter is a custom one to support backward compatibility for stream_throughput_outbound and inter_dc_stream_throughput_outbound which were provided in megabits per second prior CASSANDRA-15234.MILLIS_CUSTOM_DURATION
This converter is used to support backward compatibility for parameters where in the past -1 was used as a value Example: credentials_update_interval_in_ms = -1 and credentials_update_interval = null are equal.MILLIS_DURATION_DOUBLE
MILLIS_DURATION_INT
MILLIS_DURATION_LONG
MINUTES_CUSTOM_DURATION
This converter is used to support backward compatibility for parameters where in the past -1 was used as a value Example: index_summary_resize_interval_in_minutes = -1 and index_summary_resize_interval = null are equal.NEGATIVE_MEBIBYTES_DATA_STORAGE_INT
NEGATIVE_SECONDS_DURATION
SECONDS_CUSTOM_DURATION
This converter is used to support backward compatibility for Duration parameters where we added the opportunity for the users to add a unit in the parameters' values but we didn't change the names.SECONDS_DURATION
TABLE_COUNT_THRESHOLD_TO_GUARDRAIL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
convert(java.lang.Object value)
java.lang.Class<?>
getNewType()
Expected return type fromconvert(Object)
, and input type tounconvert(Object)
java.lang.Class<?>
getOldType()
java.lang.Object
unconvert(java.lang.Object value)
static Converters
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Converters[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
IDENTITY
public static final Converters IDENTITY
This converter is used when we change the name of a cassandra.yaml configuration parameter but we want to be able to still use the old name too. No units involved.
-
INTEGER_PRIMITIVE_LONG
public static final Converters INTEGER_PRIMITIVE_LONG
-
MILLIS_DURATION_LONG
public static final Converters MILLIS_DURATION_LONG
-
MILLIS_DURATION_INT
public static final Converters MILLIS_DURATION_INT
-
MILLIS_DURATION_DOUBLE
public static final Converters MILLIS_DURATION_DOUBLE
-
MILLIS_CUSTOM_DURATION
public static final Converters MILLIS_CUSTOM_DURATION
This converter is used to support backward compatibility for parameters where in the past -1 was used as a value Example: credentials_update_interval_in_ms = -1 and credentials_update_interval = null are equal.
-
SECONDS_DURATION
public static final Converters SECONDS_DURATION
-
NEGATIVE_SECONDS_DURATION
public static final Converters NEGATIVE_SECONDS_DURATION
-
SECONDS_CUSTOM_DURATION
public static final Converters SECONDS_CUSTOM_DURATION
This converter is used to support backward compatibility for Duration parameters where we added the opportunity for the users to add a unit in the parameters' values but we didn't change the names. (key_cache_save_period, row_cache_save_period, counter_cache_save_period) Example: row_cache_save_period = 0 and row_cache_save_period = 0s (quantity of 0s) are equal.
-
MINUTES_CUSTOM_DURATION
public static final Converters MINUTES_CUSTOM_DURATION
This converter is used to support backward compatibility for parameters where in the past -1 was used as a value Example: index_summary_resize_interval_in_minutes = -1 and index_summary_resize_interval = null are equal.
-
MEBIBYTES_DATA_STORAGE_LONG
public static final Converters MEBIBYTES_DATA_STORAGE_LONG
-
MEBIBYTES_DATA_STORAGE_INT
public static final Converters MEBIBYTES_DATA_STORAGE_INT
-
NEGATIVE_MEBIBYTES_DATA_STORAGE_INT
public static final Converters NEGATIVE_MEBIBYTES_DATA_STORAGE_INT
-
KIBIBYTES_DATASTORAGE
public static final Converters KIBIBYTES_DATASTORAGE
-
BYTES_DATASTORAGE
public static final Converters BYTES_DATASTORAGE
-
LONG_BYTES_DATASTORAGE_MEBIBYTES_INT
public static final Converters LONG_BYTES_DATASTORAGE_MEBIBYTES_INT
-
LONG_BYTES_DATASTORAGE_MEBIBYTES_DATASTORAGE
public static final Converters LONG_BYTES_DATASTORAGE_MEBIBYTES_DATASTORAGE
-
BYTES_CUSTOM_DATASTORAGE
public static final Converters BYTES_CUSTOM_DATASTORAGE
This converter is used to support backward compatibility for parameters where in the past negative number was used as a value Example: native_transport_max_concurrent_requests_in_bytes_per_ip = -1 and native_transport_max_request_data_in_flight_per_ip = null are equal. All negative numbers are printed as 0 in virtual tables.
-
MEBIBYTES_PER_SECOND_DATA_RATE
public static final Converters MEBIBYTES_PER_SECOND_DATA_RATE
-
MEGABITS_TO_BYTES_PER_SECOND_DATA_RATE
public static final Converters MEGABITS_TO_BYTES_PER_SECOND_DATA_RATE
This converter is a custom one to support backward compatibility for stream_throughput_outbound and inter_dc_stream_throughput_outbound which were provided in megabits per second prior CASSANDRA-15234.
-
KEYSPACE_COUNT_THRESHOLD_TO_GUARDRAIL
public static final Converters KEYSPACE_COUNT_THRESHOLD_TO_GUARDRAIL
-
TABLE_COUNT_THRESHOLD_TO_GUARDRAIL
public static final Converters TABLE_COUNT_THRESHOLD_TO_GUARDRAIL
-
-
Method Detail
-
values
public static Converters[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Converters c : Converters.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Converters valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getOldType
public java.lang.Class<?> getOldType()
A method to identify what type is needed to be returned by the converter used for a configuration parameter inReplaces
annotation inConfig
- Returns:
- class type
-
getNewType
public java.lang.Class<?> getNewType()
Expected return type fromconvert(Object)
, and input type tounconvert(Object)
- Returns:
- type that
convert(Object)
is expected to return
-
convert
public java.lang.Object convert(java.lang.Object value)
- Parameters:
value
- we will use from cassandra.yaml to create a newConfig
parameter of typeDurationSpec
,DataRateSpec
orDataStorageSpec
- Returns:
- new object of type
DurationSpec
,DataRateSpec
orDataStorageSpec
-
unconvert
public java.lang.Object unconvert(java.lang.Object value)
Apply the converter specified as part of theReplaces
annotation inConfig
to get config parameters' values in the old format pre-CASSANDRA-15234 and in the right units, used in the Virtual Tables to ensure backward compatibility- Parameters:
value
- we will use to calculate the output value- Returns:
- the numeric value
-
-