SessionStore.java [src/csip] Revision: 71821307bfe742c00c6dc582c171224a9ac59935  Date: Fri Apr 21 11:46:19 MDT 2017
/*
 * $Id$
 *
 * This file is part of the Cloud Services Integration Platform (CSIP),
 * a Model-as-a-Service framework, API and application suite.
 *
 * 2012-2017, Olaf David and others, OMSLab, Colorado State University.
 *
 * OMSLab licenses this file to you under the MIT license.
 * See the LICENSE file in the project root for more information.
 */
package csip;

import java.util.Set;

/**
 * session store.
 */
interface SessionStore {

    /**
     * Set a model session.
     *
     * @param suid
     * @param session
     * @throws Exception
     */
    void setSession(String suid, ModelSession session) throws Exception;


    /**
     * Get a model session
     * @param suid
     * @return the model session
     * @throws Exception
     */
    ModelSession getSession(String suid) throws Exception;


    boolean hasSession(String suid) throws Exception;


    /**
     * Remove a model session.
     *
     * @param suid
     */
    void removeSession(String suid);


    /**
     * Shutdown the session store
     * @throws Exception
     */
    void shutdown() throws Exception;


    /**
     *
     * @param skip the number of keys to skip
     * @param limit the number of keys to return (0) means all
     * @param sortby the 'field' to sort by.
     * @param sortAscending true if sort is ascending, false otherwise.
     * @return the keys.
     */
    Set<String> keys(int skip, int limit, String sortby, boolean sortAscending);


    /**
     * Get the number of elements.
     * @return the number of elements.
     */
    long getCount();


    /**
     * Ping the store.
     *
     * @throws Exception if something is wrong.
     */
    void ping() throws Exception;
    
}