Package org.apache.storm.redis.trident.state

## Class AbstractRedisMapState<T>

- java.lang.Object
- - org.apache.storm.redis.trident.state.AbstractRedisMapState<T>

- Type Parameters:
    `T` - value's type class
  All Implemented Interfaces:
    `IBackingMap<T>`
  Direct Known Subclasses:
    `RedisClusterMapState`, `RedisMapState`

      public abstract class AbstractRedisMapState<T>
      extends Object
      implements IBackingMap<T>

  AbstractRedisMapState is base class of any RedisMapState, which implements IBackingMap.

  Derived classes should provide
  - which Serializer it uses
  - which KeyFactory it uses
  - how to retrieve values from Redis
  - how to store values to Redis
  and AbstractRedisMapState takes care of rest things.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static EnumMap<StateType,​Serializer>` | `DEFAULT_SERIALIZERS` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractRedisMapState()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected abstract KeyFactory` | `getKeyFactory()` | Returns KeyFactory which is used for converting state key -> Redis key.
    `protected abstract Serializer` | `getSerializer()` | Returns Serializer which is used for serializing tuple value and deserializing Redis value.
    `List<T>` | `multiGet​(List<List<Object>> keys)`
    `void` | `multiPut​(List<List<Object>> keys, List<T> vals)`
    `protected abstract List<String>` | `retrieveValuesFromRedis​(List<String> keys)` | Retrieves values from Redis that each value is corresponding to each key.
    `protected abstract void` | `updateStatesToRedis​(Map<String,​String> keyValues)` | Updates (key, value) pairs to Redis.

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

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

- - ### Field Detail

    - #### DEFAULT_SERIALIZERS

          public static final EnumMap<StateType,​Serializer> DEFAULT_SERIALIZERS

  - ### Constructor Detail

    - #### AbstractRedisMapState

          public AbstractRedisMapState()

  - ### Method Detail

    - #### multiGet

          public List<T> multiGet​(List<List<Object>> keys)

      Specified by:
        `multiGet` in interface `IBackingMap<T>`

    - #### multiPut

          public void multiPut​(List<List<Object>> keys,
                               List<T> vals)

      Specified by:
        `multiPut` in interface `IBackingMap<T>`

    - #### getSerializer

          protected abstract Serializer getSerializer()

      Returns Serializer which is used for serializing tuple value and deserializing Redis value.
      Returns:
        serializer

    - #### getKeyFactory

          protected abstract KeyFactory getKeyFactory()

      Returns KeyFactory which is used for converting state key -> Redis key.
      Returns:
        key factory

    - #### retrieveValuesFromRedis

          protected abstract List<String> retrieveValuesFromRedis​(List<String> keys)

      Retrieves values from Redis that each value is corresponding to each key.
      Parameters:
        `keys` - keys having state values
      Returns:
        values which are corresponding to keys

    - #### updateStatesToRedis

          protected abstract void updateStatesToRedis​(Map<String,​String> keyValues)

      Updates (key, value) pairs to Redis.
      Parameters:
        `keyValues` - (key, value) pairs