Class CachePartitionPartialCountersMap
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap
-
- All Implemented Interfaces:
Serializable
public class CachePartitionPartialCountersMap extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static CachePartitionPartialCountersMapEMPTYstatic IgniteProductVersionPARTIAL_COUNTERS_MAP_SINCE
-
Constructor Summary
Constructors Constructor Description CachePartitionPartialCountersMap(int partsCnt)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int partId, long initialUpdCntr, long updCntr)Adds partition counters for a partition with the given ID.booleancontains(int partId)longinitialUpdateCounterAt(int idx)Gets initial update counter saved at the given index.voidinitialUpdateCounterAt(int idx, long cntr)Update initial counter by given index.booleanisEmpty()intpartitionAt(int idx)Gets partition ID saved at the given index.intpartitionIndex(int partId)booleanremove(int partId)Removes element.intsize()static Map<Integer,T2<Long,Long>>toCountersMap(CachePartitionPartialCountersMap cntrsMap)StringtoString()voidtrim()Cuts the array sizes according to curIdx.longupdateCounterAt(int idx)Gets update counter saved at the given index.
-
-
-
Field Detail
-
PARTIAL_COUNTERS_MAP_SINCE
public static final IgniteProductVersion PARTIAL_COUNTERS_MAP_SINCE
-
EMPTY
public static final CachePartitionPartialCountersMap EMPTY
-
-
Method Detail
-
size
public int size()
- Returns:
- Total number of partitions added to the map.
-
isEmpty
public boolean isEmpty()
- Returns:
Trueif 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:
Trueif 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:
Trueif 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.
-
toCountersMap
public static Map<Integer,T2<Long,Long>> toCountersMap(CachePartitionPartialCountersMap cntrsMap)
- Parameters:
cntrsMap- Partial local counters map.- Returns:
- Partition ID to partition counters map.
-
-