Package org.apache.cassandra.config
Class DataStorageSpec.IntKibibytesBound
java.lang.Object
org.apache.cassandra.config.DataStorageSpec
org.apache.cassandra.config.DataStorageSpec.IntKibibytesBound
- Enclosing class:
- DataStorageSpec
Represents a data storage quantity used for Cassandra configuration. The bound is [0, Integer.MAX_VALUE) in kibibytes.
If the user sets a different unit - we still validate that converted to kibibytes the quantity will not exceed
that upper bound. (CASSANDRA-17571)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.config.DataStorageSpec
DataStorageSpec.DataStorageUnit, DataStorageSpec.IntBytesBound, DataStorageSpec.IntKibibytesBound, DataStorageSpec.IntMebibytesBound, DataStorageSpec.LongBytesBound, DataStorageSpec.LongMebibytesBound -
Constructor Summary
ConstructorsConstructorDescriptionIntKibibytesBound(long kibibytes) Creates aDataStorageSpec.IntKibibytesBoundof the specified amount in kibibytes.IntKibibytesBound(long quantity, DataStorageSpec.DataStorageUnit unit) Creates aDataStorageSpec.IntKibibytesBoundof the specified amount in the specified unit.IntKibibytesBound(String value) Creates aDataStorageSpec.IntKibibytesBoundof the specified amount. -
Method Summary
Modifier and TypeMethodDescriptioninttoBytes()Returns the amount of data storage in bytes as anintlongintReturns the amount of data storage in kibibytes as anint
-
Constructor Details
-
IntKibibytesBound
Creates aDataStorageSpec.IntKibibytesBoundof the specified amount.- Parameters:
value- the data storage
-
IntKibibytesBound
Creates aDataStorageSpec.IntKibibytesBoundof the specified amount in the specified unit.- Parameters:
quantity- where quantity shouldn't be bigger than Integer.MAX_VALUE - 1 in kibibytesunit- in which the provided quantity is
-
IntKibibytesBound
public IntKibibytesBound(long kibibytes) Creates aDataStorageSpec.IntKibibytesBoundof the specified amount in kibibytes.- Parameters:
kibibytes- where kibibytes shouldn't be bigger than Integer.MAX_VALUE-1
-
-
Method Details
-
toBytes
public int toBytes()Returns the amount of data storage in bytes as anint- Returns:
- the amount of data storage in bytes or
Integer.MAX_VALUEif the number of bytes is too large.
-
toKibibytes
public int toKibibytes()Returns the amount of data storage in kibibytes as anint- Returns:
- the amount of data storage in kibibytes or
Integer.MAX_VALUEif the number of kibibytes is too large.
-
toBytesInLong
public long toBytesInLong()- Returns:
- the amount of data storage in bytes.
-