Package org.apache.storm.windowing.persistence

# Class WindowState<T>

java.lang.Object
java.util.AbstractCollection<Event<T>>
org.apache.storm.windowing.persistence.WindowState<T>

All Implemented Interfaces:
  `Iterable<Event<T>>`, `Collection<Event<T>>`

public class WindowState<T> extends AbstractCollection<Event<T>>
A wrapper around the window related states that are checkpointed.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `WindowState.WindowPartition<T>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `MAX_PARTITION_EVENTS`
  `static final int`
  `MIN_PARTITIONS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WindowState(KeyValueState<Long,WindowState.WindowPartition<T>> windowPartitionsState, KeyValueState<String,Deque<Long>> partitionIdsState, KeyValueState<String,Optional<?>> windowSystemState, Supplier<Map<String,Optional<?>>> windowSystemStateSupplier, long maxEventsInMemory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(Event<T> event)`
  `void`
  `clearIteratorPins()`
  `void`
  `commit(long txid)`
  Commits the `WindowState`.
  `Iterator<Event<T>>`
  `iterator()`
  `void`
  `prepareCommit(long txid)`
  Prepares the `WindowState` for commit.
  `void`
  `rollback(boolean reInit)`
  Rolls back the `WindowState`.
  `int`
  `size()`

  ### Methods inherited from class java.util.AbstractCollection

  `addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

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

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

  ### Methods inherited from interface java.util.Collection

  `equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray`

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

  `forEach`

- ## Field Details

  - ### MAX_PARTITION_EVENTS

    public static final int MAX_PARTITION_EVENTS
    See Also:
      - Constant Field Values

  - ### MIN_PARTITIONS

    public static final int MIN_PARTITIONS
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### WindowState

    public WindowState(KeyValueState<Long,WindowState.WindowPartition<T>> windowPartitionsState, KeyValueState<String,Deque<Long>> partitionIdsState, KeyValueState<String,Optional<?>> windowSystemState, Supplier<Map<String,Optional<?>>> windowSystemStateSupplier, long maxEventsInMemory)

- ## Method Details

  - ### add

    public boolean add(Event<T> event)
    Specified by:
      `add` in interface `Collection<T>`
    Overrides:
      `add` in class `AbstractCollection<Event<T>>`

  - ### iterator

    public Iterator<Event<T>> iterator()
    Specified by:
      `iterator` in interface `Collection<T>`
    Specified by:
      `iterator` in interface `Iterable<T>`
    Specified by:
      `iterator` in class `AbstractCollection<Event<T>>`

  - ### clearIteratorPins

    public void clearIteratorPins()

  - ### size

    public int size()
    Specified by:
      `size` in interface `Collection<T>`
    Specified by:
      `size` in class `AbstractCollection<Event<T>>`

  - ### prepareCommit

    public void prepareCommit(long txid)
    Prepares the `WindowState` for commit.
    Parameters:
      `txid` - the transaction id

  - ### commit

    public void commit(long txid)
    Commits the `WindowState`.
    Parameters:
      `txid` - the transaction id

  - ### rollback

    public void rollback(boolean reInit)
    Rolls back the `WindowState`.
    Parameters:
      `reInit` - if the members should be synced with the values from the state.