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

    
https://github.com/apache/incubator-apex-malhar/pull/125#discussion_r48274840
  
    --- Diff: 
library/src/main/java/com/datatorrent/lib/util/StorageAgentKeyValueStore.java 
---
    @@ -0,0 +1,88 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package com.datatorrent.lib.util;
    +
    +import java.io.IOException;
    +import java.util.List;
    +
    +/**
    + * Interface for KeyValue store
    + * 
    + */
    +public interface StorageAgentKeyValueStore
    +{
    +
    +  /**
    +   * Connects to the service.
    +   *
    +   * @throws IOException
    +   */
    +  public void connect() throws IOException;
    +
    +  /**
    +   * Disconnects from the service.
    +   *
    +   * @throws IOException
    +   */
    +  public void disconnect() throws IOException;
    +
    +  /**
    +   *
    +   * @return returns whether the service is connected.
    +   */
    +  public boolean isConnected();
    +
    +  /**
    +   * Gets the value given the key.
    +   *
    +   * @param key
    +   * @return the value
    +   */
    +  public Object get(Object key);
    +
    +  /**
    +   * Sets the key with the value in the store.
    +   *
    +   * @param key
    +   * @param value
    +   */
    +  public void put(Object key, Object value);
    +
    +  /**
    +   * Removes the key and the value given the key
    +   * 
    +   * @param key
    +   */
    +  public void remove(Object key);
    +
    +  /**
    +   * Get all the keys associated with key
    +   * 
    +   * @param key
    +   * @return the list of all associated keys
    +   */
    +  public List<String> getKeys(Object key);
    --- End diff --
    
    Rationale for getKeys() method.
    
    StorageAgent needs to provide below fours operations for operator 
checkpointing 
    1 save(opertorId, windowId)
    2 load(opertorId, windowId)
    3 delete(opertorId, windowId)
    4 getWindowIds(opertorId)
    
    All Key value based systems perform operations based on key so to 
accommodate these operations need to form a key with combination of operatorId 
& windowId to uniquely identify checkpoints.
    Note that each checkpoints will be written to different table/region by 
store implementation by using name provided by setTableName method.
    
    To support 4th operation of getting windows ids related given operator id 
store implementation will have to scan keys using some form of query and return 
related windowids.
    
    Please check provided concrete implementation of GeodeStore  
     


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to