Package cz.o2.proxima.core.storage
Interface Partition
-
- All Superinterfaces:
java.lang.Comparable<Partition>,java.io.Serializable
- All Known Implementing Classes:
BoundedPartition,CassandraPartition,HadoopPartition,Partition.IntegerPartition
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@Stable @FunctionalInterface public interface Partition extends java.io.Serializable, java.lang.Comparable<Partition>
Interface representing a partition of the commit log. A partition is an element of parallelism, an atomic part that is read all at once and cannot be divided.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPartition.IntegerPartition
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default intcompareTo(Partition other)intgetId()Retrieve id of the partition.default longgetMaxTimestamp()default longgetMinTimestamp()default booleanisBounded()Check if this is bounded or unbounded partition.default booleanisSplittable()Verify if this partition can be split into two when reading.static Partitionof(int id)Wrap numerical id toPartitionobject.default longsize()Estimate size of this partition.default java.util.Collection<Partition>split(int desiredCount)Split this partition to given number of sub-partitions.static PartitionwithMinimalTimestamp(int id, long minTimestamp)Wrap numerical id toPartitionwith given minimal timestamp.
-
-
-
Method Detail
-
getId
int getId()
Retrieve id of the partition.- Returns:
- if od the partition
-
getMinTimestamp
default long getMinTimestamp()
- Returns:
- Retrieve minimal timestamp associated with data in this partition.
-
getMaxTimestamp
default long getMaxTimestamp()
- Returns:
- Retrieve maximal timestamp associated with data in this partition.
-
isBounded
default boolean isBounded()
Check if this is bounded or unbounded partition.- Returns:
trueif this is bounded partition
-
size
default long size()
Estimate size of this partition.- Returns:
- estimated size of this partition or -1 if unknown
-
isSplittable
default boolean isSplittable()
Verify if this partition can be split into two when reading.- Returns:
truewhen the partition can be split and read independently in two consumers.
-
split
default java.util.Collection<Partition> split(int desiredCount)
Split this partition to given number of sub-partitions.- Parameters:
desiredCount- desired number of split partitions- Returns:
- collection of split partitions
-
compareTo
default int compareTo(Partition other)
- Specified by:
compareToin interfacejava.lang.Comparable<Partition>
-
of
static Partition of(int id)
Wrap numerical id toPartitionobject.- Parameters:
id- the ID of partition- Returns:
- partition
-
-