Enum Class Converters

java.lang.Object
java.lang.Enum<Converters>
org.apache.cassandra.config.Converters
All Implemented Interfaces:
Serializable, Comparable<Converters>, Constable

public enum Converters extends 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 Details

    • 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 Details

    • values

      public static Converters[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Converters valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getOldType

      public Class<?> getOldType()
      A method to identify what type is needed to be returned by the converter used for a configuration parameter in Replaces annotation in Config
      Returns:
      class type
    • getNewType

      public Class<?> getNewType()
      Expected return type from convert(Object), and input type to unconvert(Object)
      Returns:
      type that convert(Object) is expected to return
    • convert

      public Object convert(Object value)
      Apply the converter specified as part of the Replaces annotation in Config
      Parameters:
      value - we will use from cassandra.yaml to create a new Config parameter of type DurationSpec, DataRateSpec or DataStorageSpec
      Returns:
      new object of type DurationSpec, DataRateSpec or DataStorageSpec
    • unconvert

      public Object unconvert(Object value)
      Apply the converter specified as part of the Replaces annotation in Config 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