org.apache.storm.redis.trident.state

## Class AbstractRedisStateQuerier<T extends State>

- java.lang.Object
- - org.apache.storm.trident.operation.BaseOperation
  - - org.apache.storm.trident.state.BaseQueryFunction<T,List<Values>>
    - - org.apache.storm.redis.trident.state.AbstractRedisStateQuerier<T>

- All Implemented Interfaces:
    Serializable, EachOperation, Operation, QueryFunction<T,List<Values>>
  Direct Known Subclasses:
    RedisClusterStateQuerier, RedisStateQuerier

      public abstract class AbstractRedisStateQuerier<T extends State>
      extends BaseQueryFunction<T,List<Values>>

  AbstractRedisStateQuerier is base class of any RedisStateQuerier, which implements BaseQueryFunction.

  Derived classes should provide how to retrieve values from Redis, and AbstractRedisStateQuerier takes care of rest things.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `additionalKey`
    `protected RedisDataTypeDescription.RedisDataType` | `dataType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractRedisStateQuerier(RedisLookupMapper lookupMapper)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<List<Values>>` | `batchRetrieve(T state, List<TridentTuple> inputs)`
    `void` | `execute(TridentTuple tuple, List<Values> values, TridentCollector collector)`
    `protected abstract List<String>` | `retrieveValuesFromRedis(T state, List<String> keys)` Retrieves values from Redis that each value is corresponding to each key.

    - ### Methods inherited from class org.apache.storm.trident.operation.BaseOperation

      `cleanup, prepare`

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

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

    - ### Methods inherited from interface org.apache.storm.trident.operation.Operation

      `cleanup, prepare`

- - ### Field Detail

    - #### dataType

          protected final RedisDataTypeDescription.RedisDataType dataType

    - #### additionalKey

          protected final String additionalKey

  - ### Constructor Detail

    - #### AbstractRedisStateQuerier

          public AbstractRedisStateQuerier(RedisLookupMapper lookupMapper)

      Constructor.

      Parameters:
        `lookupMapper` - mapper for querying

  - ### Method Detail

    - #### batchRetrieve

          public List<List<Values>> batchRetrieve(T state,
                                                  List<TridentTuple> inputs)

    - #### execute

          public void execute(TridentTuple tuple,
                              List<Values> values,
                              TridentCollector collector)

    - #### retrieveValuesFromRedis

          protected abstract List<String> retrieveValuesFromRedis(T state,
                                                                  List<String> keys)

      Retrieves values from Redis that each value is corresponding to each key.

      Parameters:
        `state` - State for handling query
        `keys` - keys having state values
      Returns:
        values which are corresponding to keys

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