Class PartitionAllocationMap


  • public class PartitionAllocationMap
    extends Object
    Information structure with partitions state. Page counts map.
    • Constructor Detail

      • PartitionAllocationMap

        public PartitionAllocationMap()
    • Method Detail

      • get

        @Nullable
        public @Nullable PagesAllocationRange get​(GroupPartitionId key)
        Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
        Parameters:
        key - to get
        Returns:
        value or null
      • createCachePartId

        @NotNull
        public static @NotNull GroupPartitionId createCachePartId​(@NotNull
                                                                  @NotNull FullPageId fullId)
        Extracts partition information from full page ID
        Parameters:
        fullId - page related to some cache
        Returns:
        pair of cache ID and partition ID
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if this map contains no key-value mappings
      • size

        public int size()
        Returns:
        the number of key-value mappings in this map.
      • firstKey

        public GroupPartitionId firstKey()
        Returns:
        Returns the first (lowest) key currently in this map.
      • forceSkipIndexPartition

        public boolean forceSkipIndexPartition​(int grpId)
        Forces the index partition for the given group ID to be skipped in collected map.
        Parameters:
        grpId - Group ID to skip.
        Returns:
        true if skipped partition was added to the ignore list during this call.
      • nextKey

        @Nullable
        public @Nullable GroupPartitionId nextKey​(@NotNull
                                                  @NotNull GroupPartitionId key)
        Returns next (higher) key for provided cache and partition or null
        Parameters:
        key - cache and partition to search
        Returns:
        first found key which is greater than provided
      • containsKey

        public boolean containsKey​(GroupPartitionId key)
        Returns:
        true if this map contains a mapping for the specified key
      • put

        public PagesAllocationRange put​(GroupPartitionId key,
                                        PagesAllocationRange val)
        Parameters:
        key - key with which the specified value is to be associated
        val - value to be associated with the specified key
        Returns:
        the previous value associated with key, or null if there was no mapping for key.
      • prepareForSnapshot

        public void prepareForSnapshot()
        Prepare map for snapshot.