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 and Description
    --- | ---
    `static class` | `WindowState.WindowPartition<T>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MAX_PARTITION_EVENTS`
    `static int` | `MIN_PARTITIONS`

  - ### Constructor Summary

    Constructors
    Constructor and 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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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`

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

      `forEach`

- - ### Field Detail

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

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

    - #### add

          public boolean add(Event<T> event)

      Specified by:
        `add` in interface `Collection<Event<T>>`
      Overrides:
        `add` in class `AbstractCollection<Event<T>>`

    - #### iterator

          public Iterator<Event<T>> iterator()

      Specified by:
        `iterator` in interface `Iterable<Event<T>>`
      Specified by:
        `iterator` in interface `Collection<Event<T>>`
      Specified by:
        `iterator` in class `AbstractCollection<Event<T>>`

    - #### clearIteratorPins

          public void clearIteratorPins()

    - #### size

          public int size()

      Specified by:
        `size` in interface `Collection<Event<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.

Copyright © 2019 The Apache Software Foundation. All rights reserved.