Class RedisMapState<T>
- java.lang.Object
-
- org.apache.storm.redis.trident.state.AbstractRedisMapState<T>
-
- org.apache.storm.redis.trident.state.RedisMapState<T>
-
- Type Parameters:
T
- value's type class
- All Implemented Interfaces:
IBackingMap<T>
public class RedisMapState<T> extends AbstractRedisMapState<T>
IBackingMap implementation for single Redis environment.- See Also:
AbstractRedisMapState
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
RedisMapState.Factory
RedisMapState.Factory provides single Redis environment version of StateFactory.
-
Field Summary
-
Fields inherited from class org.apache.storm.redis.trident.state.AbstractRedisMapState
DEFAULT_SERIALIZERS
-
-
Constructor Summary
Constructors Constructor Description RedisMapState(redis.clients.jedis.JedisPool jedisPool, Options options, Serializer<T> serializer, KeyFactory keyFactory)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected KeyFactory
getKeyFactory()
Returns KeyFactory which is used for converting state key -> Redis key.protected Serializer
getSerializer()
Returns Serializer which is used for serializing tuple value and deserializing Redis value.static StateFactory
nonTransactional(JedisPoolConfig jedisPoolConfig)
Provides StateFactory for non transactional.static StateFactory
nonTransactional(JedisPoolConfig jedisPoolConfig, RedisDataTypeDescription dataTypeDescription)
Provides StateFactory for non transactional.static StateFactory
nonTransactional(JedisPoolConfig jedisPoolConfig, KeyFactory factory)
Provides StateFactory for non transactional.static StateFactory
nonTransactional(JedisPoolConfig jedisPoolConfig, Options<Object> opts)
Provides StateFactory for non transactional.static StateFactory
opaque(JedisPoolConfig jedisPoolConfig)
Provides StateFactory for opaque transactional.static StateFactory
opaque(JedisPoolConfig jedisPoolConfig, RedisDataTypeDescription dataTypeDescription)
Provides StateFactory for opaque transactional.static StateFactory
opaque(JedisPoolConfig jedisPoolConfig, KeyFactory factory)
Provides StateFactory for opaque transactional.static StateFactory
opaque(JedisPoolConfig jedisPoolConfig, Options<OpaqueValue> opts)
Provides StateFactory for opaque transactional.protected List<String>
retrieveValuesFromRedis(List<String> keys)
Retrieves values from Redis that each value is corresponding to each key.static StateFactory
transactional(JedisPoolConfig jedisPoolConfig)
Provides StateFactory for transactional.static StateFactory
transactional(JedisPoolConfig jedisPoolConfig, RedisDataTypeDescription dataTypeDescription)
Provides StateFactory for transactional.static StateFactory
transactional(JedisPoolConfig jedisPoolConfig, KeyFactory factory)
Provides StateFactory for transactional.static StateFactory
transactional(JedisPoolConfig jedisPoolConfig, Options<TransactionalValue> opts)
Provides StateFactory for transactional.protected void
updateStatesToRedis(Map<String,String> keyValues)
Updates (key, value) pairs to Redis.-
Methods inherited from class org.apache.storm.redis.trident.state.AbstractRedisMapState
multiGet, multiPut
-
-
-
-
Constructor Detail
-
RedisMapState
public RedisMapState(redis.clients.jedis.JedisPool jedisPool, Options options, Serializer<T> serializer, KeyFactory keyFactory)
Constructor.- Parameters:
jedisPool
- JedisPooloptions
- options of Stateserializer
- SerializerkeyFactory
- KeyFactory
-
-
Method Detail
-
opaque
public static StateFactory opaque(JedisPoolConfig jedisPoolConfig)
Provides StateFactory for opaque transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPool- Returns:
- StateFactory
-
opaque
public static StateFactory opaque(JedisPoolConfig jedisPoolConfig, RedisDataTypeDescription dataTypeDescription)
Provides StateFactory for opaque transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPooldataTypeDescription
- definition of data type- Returns:
- StateFactory
-
opaque
public static StateFactory opaque(JedisPoolConfig jedisPoolConfig, KeyFactory factory)
Provides StateFactory for opaque transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPoolfactory
- key factory- Returns:
- StateFactory
-
opaque
public static StateFactory opaque(JedisPoolConfig jedisPoolConfig, Options<OpaqueValue> opts)
Provides StateFactory for opaque transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPoolopts
- options of State- Returns:
- StateFactory
-
transactional
public static StateFactory transactional(JedisPoolConfig jedisPoolConfig)
Provides StateFactory for transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPool- Returns:
- StateFactory
-
transactional
public static StateFactory transactional(JedisPoolConfig jedisPoolConfig, RedisDataTypeDescription dataTypeDescription)
Provides StateFactory for transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPooldataTypeDescription
- definition of data type- Returns:
- StateFactory
-
transactional
public static StateFactory transactional(JedisPoolConfig jedisPoolConfig, KeyFactory factory)
Provides StateFactory for transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPoolfactory
- key factory- Returns:
- StateFactory
-
transactional
public static StateFactory transactional(JedisPoolConfig jedisPoolConfig, Options<TransactionalValue> opts)
Provides StateFactory for transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPoolopts
- options of State- Returns:
- StateFactory
-
nonTransactional
public static StateFactory nonTransactional(JedisPoolConfig jedisPoolConfig)
Provides StateFactory for non transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPool- Returns:
- StateFactory
-
nonTransactional
public static StateFactory nonTransactional(JedisPoolConfig jedisPoolConfig, RedisDataTypeDescription dataTypeDescription)
Provides StateFactory for non transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPooldataTypeDescription
- definition of data type- Returns:
- StateFactory
-
nonTransactional
public static StateFactory nonTransactional(JedisPoolConfig jedisPoolConfig, KeyFactory factory)
Provides StateFactory for non transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPoolfactory
- key factory- Returns:
- StateFactory
-
nonTransactional
public static StateFactory nonTransactional(JedisPoolConfig jedisPoolConfig, Options<Object> opts)
Provides StateFactory for non transactional.- Parameters:
jedisPoolConfig
- configuration for JedisPoolopts
- options of State- Returns:
- StateFactory
-
getSerializer
protected Serializer getSerializer()
Returns Serializer which is used for serializing tuple value and deserializing Redis value.- Specified by:
getSerializer
in classAbstractRedisMapState<T>
- Returns:
- serializer
-
getKeyFactory
protected KeyFactory getKeyFactory()
Returns KeyFactory which is used for converting state key -> Redis key.- Specified by:
getKeyFactory
in classAbstractRedisMapState<T>
- Returns:
- key factory
-
retrieveValuesFromRedis
protected List<String> retrieveValuesFromRedis(List<String> keys)
Retrieves values from Redis that each value is corresponding to each key.- Specified by:
retrieveValuesFromRedis
in classAbstractRedisMapState<T>
- Parameters:
keys
- keys having state values- Returns:
- values which are corresponding to keys
-
updateStatesToRedis
protected void updateStatesToRedis(Map<String,String> keyValues)
Updates (key, value) pairs to Redis.- Specified by:
updateStatesToRedis
in classAbstractRedisMapState<T>
- Parameters:
keyValues
- (key, value) pairs
-
-