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 class
Partition.IntegerPartition
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
compareTo(Partition other)
int
getId()
Retrieve id of the partition.default long
getMaxTimestamp()
default long
getMinTimestamp()
default boolean
isBounded()
Check if this is bounded or unbounded partition.default boolean
isSplittable()
Verify if this partition can be split into two when reading.static Partition
of(int id)
Wrap numerical id toPartition
object.default long
size()
Estimate size of this partition.default java.util.Collection<Partition>
split(int desiredCount)
Split this partition to given number of sub-partitions.static Partition
withMinimalTimestamp(int id, long minTimestamp)
Wrap numerical id toPartition
with 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:
true
if 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:
true
when 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:
compareTo
in interfacejava.lang.Comparable<Partition>
-
of
static Partition of(int id)
Wrap numerical id toPartition
object.- Parameters:
id
- the ID of partition- Returns:
- partition
-
-