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 Details

  • Constructor Details

    • AbstractRedisMapState

      public AbstractRedisMapState()
  • Method Details

    • 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