Class DataStorageSpec.IntBytesBound

java.lang.Object
org.apache.cassandra.config.DataStorageSpec
org.apache.cassandra.config.DataStorageSpec.IntBytesBound
Enclosing class:
DataStorageSpec

public static final class DataStorageSpec.IntBytesBound extends DataStorageSpec
Represents a data storage quantity used for Cassandra configuration. The bound is [0, Integer.MAX_VALUE) in bytes. If the user sets a different unit - we still validate that converted to bytes the quantity will not exceed that upper bound. (CASSANDRA-17571)
  • Constructor Details

    • IntBytesBound

      public IntBytesBound(String value)
      Creates a DataStorageSpec.IntBytesBound of the specified amount.
      Parameters:
      value - the data storage
    • IntBytesBound

      public IntBytesBound(long quantity, DataStorageSpec.DataStorageUnit unit)
      Creates a DataStorageSpec.IntBytesBound of the specified amount in the specified unit.
      Parameters:
      quantity - where quantity shouldn't be bigger than Integer.MAX_VALUE - 1 in bytes
      unit - in which the provided quantity is
    • IntBytesBound

      public IntBytesBound(long bytes)
      Creates a DataStorageSpec.IntBytesBound of the specified amount in bytes.
      Parameters:
      bytes - where bytes shouldn't be bigger than Integer.MAX_VALUE-1
  • Method Details

    • toBytes

      public int toBytes()
      Returns the amount of data storage in bytes as an int
      Returns:
      the amount of data storage in bytes or Integer.MAX_VALUE if the number of bytes is too large.