Class CachePartitionPartialCountersMap

    • Constructor Detail

      • CachePartitionPartialCountersMap

        public CachePartitionPartialCountersMap​(int partsCnt)
        Parameters:
        partsCnt - Total number of partitions will be stored in the partial map.
    • Method Detail

      • size

        public int size()
        Returns:
        Total number of partitions added to the map.
      • isEmpty

        public boolean isEmpty()
        Returns:
        True if map is empty.
      • add

        public void add​(int partId,
                        long initialUpdCntr,
                        long updCntr)
        Adds partition counters for a partition with the given ID.
        Parameters:
        partId - Partition ID to add.
        initialUpdCntr - Partition initial update counter.
        updCntr - Partition update counter.
      • remove

        public boolean remove​(int partId)
        Removes element.
        Parameters:
        partId - Partition ID.
        Returns:
        True if element was actually removed.
      • trim

        public void trim()
        Cuts the array sizes according to curIdx. No more entries can be added to this map after this method is called.
      • partitionIndex

        public int partitionIndex​(int partId)
        Parameters:
        partId - Partition ID to search.
        Returns:
        Partition index in the array.
      • contains

        public boolean contains​(int partId)
        Parameters:
        partId - Partition ID.
        Returns:
        True if partition is present in map.
      • partitionAt

        public int partitionAt​(int idx)
        Gets partition ID saved at the given index.
        Parameters:
        idx - Index to get value from.
        Returns:
        Partition ID.
      • initialUpdateCounterAt

        public long initialUpdateCounterAt​(int idx)
        Gets initial update counter saved at the given index.
        Parameters:
        idx - Index to get value from.
        Returns:
        Initial update counter.
      • initialUpdateCounterAt

        public void initialUpdateCounterAt​(int idx,
                                           long cntr)
        Update initial counter by given index. It is used when iterated by WAL with a margin.
        Parameters:
        idx - Index.
        cntr - Counter.
      • updateCounterAt

        public long updateCounterAt​(int idx)
        Gets update counter saved at the given index.
        Parameters:
        idx - Index to get value from.
        Returns:
        Update counter.