[ 
https://issues.apache.org/jira/browse/STORM-1886?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15360640#comment-15360640
 ] 

ASF GitHub Bot commented on STORM-1886:
---------------------------------------

Github user arunmahadevan commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1470#discussion_r69395742
  
    --- Diff: 
external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java
 ---
    @@ -60,22 +64,23 @@ public RedisKeyValueState(String namespace) {
         }
     
         public RedisKeyValueState(String namespace, JedisPoolConfig 
poolConfig) {
    -        this(namespace, poolConfig, new DefaultStateSerializer<K>(), new 
DefaultStateSerializer<V>());
    +        this(namespace, poolConfig, new DefaultStateSerializer<K>(), new 
DefaultStateSerializer<Optional<V>>());
         }
     
    -    public RedisKeyValueState(String namespace, JedisPoolConfig 
poolConfig, Serializer<K> keySerializer, Serializer<V> valueSerializer) {
    +    public RedisKeyValueState(String namespace, JedisPoolConfig 
poolConfig, Serializer<K> keySerializer, Serializer<Optional<V>> 
valueSerializer) {
             this(namespace, JedisCommandsContainerBuilder.build(poolConfig), 
keySerializer, valueSerializer);
         }
     
         public RedisKeyValueState(String namespace, 
JedisCommandsInstanceContainer jedisContainer,
    -                              Serializer<K> keySerializer, Serializer<V> 
valueSerializer) {
    +                              Serializer<K> keySerializer, 
Serializer<Optional<V>> valueSerializer) {
             base64Encoder = new BASE64Encoder();
             base64Decoder = new BASE64Decoder();
             this.namespace = namespace;
             this.prepareNamespace = namespace + "$prepare";
             this.txidNamespace = namespace + "$txid";
             this.keySerializer = keySerializer;
             this.valueSerializer = valueSerializer;
    +        this.tombstone = 
encode(valueSerializer.serialize(Optional.<V>absent()));
    --- End diff --
    
    Internally absent seems to return a static final Absent<Object> cast to 
Optional<T>, so the type does not really matter. Its not major, but the 
tombstone could be a constant reference to Optional.<Object>absent().The 
current one is also fine.


> Extend KeyValueState interface with delete method
> -------------------------------------------------
>
>                 Key: STORM-1886
>                 URL: https://issues.apache.org/jira/browse/STORM-1886
>             Project: Apache Storm
>          Issue Type: Improvement
>            Reporter: Balazs Kossovics
>
> Even if the implementation of checkpointing only uses the get/put methods of 
> the KeyValueState interface, the existance of a delete method could be really 
> useful in the general case.
> I made a first implementation, what do you think about?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to