org.apache.ignite.internal.processors.cache.distributed.dht.preloader

## 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
`static CachePartitionPartialCountersMap` `EMPTY`

### Constructor Summary

Constructors
Constructor and Description
`CachePartitionPartialCountersMap(int partsCnt)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `add(int partId, long initialUpdCntr, long updCntr)` Adds partition counters for a partition with the given ID.
`boolean` `contains(int partId)`
`long` `initialUpdateCounterAt(int idx)` Gets initial update counter saved at the given index.
`boolean` `isEmpty()`
`int` `partitionAt(int idx)` Gets partition ID saved at the given index.
`int` `partitionIndex(int partId)`
`boolean` `remove(int partId)` Removes element.
`int` `size()`
`static Map<Integer,T2<Long,Long>>` `toCountersMap(CachePartitionPartialCountersMap cntrsMap)`
`String` `toString()`
`void` `trim()` Cuts the array sizes according to curIdx.
`long` `updateCounterAt(int idx)` Gets update counter saved at the given index.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### EMPTY

    public static final CachePartitionPartialCountersMap EMPTY

### 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.

#### 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.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018