org.apache.ignite.internal.processors.cache

## Class PartitionUpdateCounterErrorWrapper

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.PartitionUpdateCounterErrorWrapper

All Implemented Interfaces:
  Iterable<long[]>, PartitionUpdateCounter

    public class PartitionUpdateCounterErrorWrapper
    extends Object
    implements PartitionUpdateCounter

Update counter wrapper for error logging.

### Constructor Summary

Constructors
Constructor and Description
`PartitionUpdateCounterErrorWrapper(int partId, PartitionUpdateCounter delegate)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `comparableState()`
`CacheGroupContext` `context()`
`PartitionUpdateCounter` `copy()`
`boolean` `empty()`
`boolean` `equals(Object o)`
`GridLongList` `finalizeUpdateCounters()` Flushes pending update counters closing all possible gaps.
`long` `get()` Get LWM.
`@Nullable byte[]` `getBytes()`
`long` `highestAppliedCounter()` Returns highest applied update counter.
`void` `init(long initUpdCntr, @Nullable byte[] cntrUpdData)` Restores update counter state.
`long` `initial()`
`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()`
`String` `toString()`
`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)`

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

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

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

`forEach, spliterator`

### Constructor Detail

#### PartitionUpdateCounterErrorWrapper

    public PartitionUpdateCounterErrorWrapper(int partId,
                                              PartitionUpdateCounter delegate)

Parameters:
  `partId` - Part id.
  `delegate` - Delegate.

### Method Detail

#### reserve

    public long reserve(long delta)

Increment HWM by delta.

Specified by:
  `reserve` in interface `PartitionUpdateCounter`
Parameters:
  `delta` - Delta.
Returns:
  New HWM.

#### init

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

Restores update counter state.

Specified by:
  `init` in interface `PartitionUpdateCounter`
Parameters:
  `initUpdCntr` - LWM.
  `cntrUpdData` - Counter updates raw data.

#### next

    public long next()

Increment LWM by 1.

Specified by:
  `next` in interface `PartitionUpdateCounter`
Returns:
  New LWM.

#### next

    public long next(long delta)

Increment LWM by delta.

Specified by:
  `next` in interface `PartitionUpdateCounter`
Parameters:
  `delta` - Delta.
Returns:
  New LWM.

#### update

    public void update(long val)
                throws IgniteCheckedException

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

Specified by:
  `update` in interface `PartitionUpdateCounter`
Parameters:
  `val` - Absolute value.
Throws:
  `IgniteCheckedException` - if counter cannot be set to passed value due to incompatibility with current state.

#### update

    public boolean update(long start,
                          long delta)

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

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

#### reset

    public void reset()

Reset counter internal state to zero.

Specified by:
  `reset` in interface `PartitionUpdateCounter`

#### updateInitial

    public void updateInitial(long start,
                              long delta)

Specified by:
  `updateInitial` in interface `PartitionUpdateCounter`
Parameters:
  `start` - Counter.
  `delta` - Delta.

#### finalizeUpdateCounters

    public GridLongList finalizeUpdateCounters()

Flushes pending update counters closing all possible gaps.

Specified by:
  `finalizeUpdateCounters` in interface `PartitionUpdateCounter`
Returns:
  Even-length array of pairs [start, end] for each gap.

#### resetInitialCounter

    public void resetInitialCounter()

Reset the initial counter value to zero.

Specified by:
  `resetInitialCounter` in interface `PartitionUpdateCounter`

#### initial

    public long initial()

Specified by:
  `initial` in interface `PartitionUpdateCounter`

#### get

    public long get()

Get LWM.

Specified by:
  `get` in interface `PartitionUpdateCounter`
Returns:
  Current LWM.

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### reserved

    public long reserved()

Returns HWM.

Specified by:
  `reserved` in interface `PartitionUpdateCounter`
Returns:
  Current HWM.

#### highestAppliedCounter

    public long highestAppliedCounter()

Returns highest applied update counter.

Specified by:
  `highestAppliedCounter` in interface `PartitionUpdateCounter`
Returns:
  Highest applied counter.

#### getBytes

    @Nullable
    public @Nullable byte[] getBytes()

Specified by:
  `getBytes` in interface `PartitionUpdateCounter`

#### sequential

    public boolean sequential()

Specified by:
  `sequential` in interface `PartitionUpdateCounter`
Returns:
  `True` if counter has no missed updates.

#### empty

    public boolean empty()

Specified by:
  `empty` in interface `PartitionUpdateCounter`
Returns:
  `True` if counter has not seen any update.

#### iterator

    public Iterator<long[]> iterator()

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

#### context

    public CacheGroupContext context()

Specified by:
  `context` in interface `PartitionUpdateCounter`
Returns:
  Cache group context.

#### copy

    public PartitionUpdateCounter copy()

Specified by:
  `copy` in interface `PartitionUpdateCounter`
Returns:
  A deep copy of current instance.

#### comparableState

    public Object comparableState()

Specified by:
  `comparableState` in interface `PartitionUpdateCounter`
Returns:
  Comparable counter state.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023