org.apache.ignite.internal.processors.cache

## Interface PartitionUpdateCounter

All Superinterfaces:
  Iterable<long[]>

All Known Implementing Classes:
  PartitionUpdateCounterDebugWrapper, PartitionUpdateCounterMvccImpl, PartitionUpdateCounterTrackingImpl, PartitionUpdateCounterVolatileImpl

    public interface PartitionUpdateCounter
    extends Iterable<long[]>

Partition update counter maintains three entities for tracking partition update state.

1. Low water mark (LWM) or update counter - lowest applied sequential update number.
2. High water mark (HWM) or reservation counter - highest seen but unapplied yet update number.
3. Out-of-order applied updates in range between LWM and HWM

### Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods
`CacheGroupContext` `context()`
`PartitionUpdateCounter` `copy()`
`boolean` `empty()`
`GridLongList` `finalizeUpdateCounters()` Flushes pending update counters closing all possible gaps.
`long` `get()` Get LWM.
`@Nullable byte[]` `getBytes()`
`void` `init(long initUpdCntr, @Nullable byte[] cntrUpdData)` Restores update counter state.
`long` `initial()` Deprecated. TODO LWM should be used as initial counter https://ggsystems.atlassian.net/browse/GG-17396
`Iterator<long[]>` `iterator()`
`long` `next()` Increment LWM by 1.
`long` `next(long delta)` Increment LWM by delta.
`long` `reserve(long delta)` Increment HWM by delta.
`long` `reserved()` Returns HWM.
`void` `reset()` Reset counter internal state to zero.
`void` `resetInitialCounter()` Reset the initial counter value to zero.
`boolean` `sequential()`
`void` `update(long val)` Sets update counter to absolute value.
`boolean` `update(long start, long delta)` Applies counter update out of range.
`void` `updateInitial(long start, long delta)` Deprecated. TODO https://ggsystems.atlassian.net/browse/GG-17396

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Method Detail

#### init

    void init(long initUpdCntr,
              @Nullable
              @Nullable byte[] cntrUpdData)

Restores update counter state.

Parameters:
  `initUpdCntr` - LWM.
  `cntrUpdData` - Counter updates raw data.

#### initial

    long initial()

Deprecated. TODO LWM should be used as initial counter https://ggsystems.atlassian.net/browse/GG-17396

#### get

    long get()

Get LWM.

Returns:
  Current LWM.

#### next

    long next()

Increment LWM by 1.

Returns:
  New LWM.

#### next

    long next(long delta)

Increment LWM by delta.

Parameters:
  `delta` - Delta.
Returns:
  New LWM.

#### reserve

    long reserve(long delta)

Increment HWM by delta.

Parameters:
  `delta` - Delta.
Returns:
  New HWM.

#### reserved

    long reserved()

Returns HWM.

Returns:
  Current HWM.

#### update

    void update(long val)
         throws IgniteCheckedException

Sets update counter to absolute value. All missed updates will be discarded.

Parameters:
  `val` - Absolute value.
Throws:
  `IgniteCheckedException` - if counter cannot be set to passed value due to incompatibility with current state.

#### update

    boolean update(long start,
                   long delta)

Applies counter update out of range. Update ranges must not intersect.

Parameters:
  `start` - Start (<= lwm).
  `delta` - Delta.
Returns:
  `True` if update was actually applied.

#### reset

    void reset()

Reset counter internal state to zero.

#### resetInitialCounter

    void resetInitialCounter()

Reset the initial counter value to zero.

#### updateInitial

    void updateInitial(long start,
                       long delta)

Deprecated. TODO https://ggsystems.atlassian.net/browse/GG-17396

Parameters:
  `start` - Counter.
  `delta` - Delta.

#### finalizeUpdateCounters

    GridLongList finalizeUpdateCounters()

Flushes pending update counters closing all possible gaps.

Returns:
  Even-length array of pairs [start, end] for each gap.

#### getBytes

    @Nullable
    @Nullable byte[] getBytes()

#### sequential

    boolean sequential()

Returns:
  `True` if counter has no missed updates.

#### empty

    boolean empty()

Returns:
  `True` if counter has not seen any update.

#### iterator

    Iterator<long[]> iterator()

Specified by:
  `iterator` in interface `Iterable<long[]>`
Returns:
  Iterator for pairs [start, range] for each out-of-order update in the update counter sequence.

#### context

    CacheGroupContext context()

Returns:
  Cache group context.

#### copy

    PartitionUpdateCounter copy()

Returns:
  A deep copy of current instance.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020