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.
    • 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 interface java.lang.Comparable<Partition>
      • of

        static Partition of​(int id)
        Wrap numerical id to Partition object.
        Parameters:
        id - the ID of partition
        Returns:
        partition
      • withMinimalTimestamp

        static Partition withMinimalTimestamp​(int id,
                                              long minTimestamp)
        Wrap numerical id to Partition with given minimal timestamp.
        Parameters:
        id - if the ID of partition
        minTimestamp - minimal timestamp of the partition
        Returns:
        partition