2014-06-11 23:40:19 +02:00
|
|
|
/*
|
2015-08-08 19:36:14 +02:00
|
|
|
* Copyright (c) 2012-2015 The original author or authors
|
2014-06-11 23:40:19 +02:00
|
|
|
* ------------------------------------------------------
|
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
|
* and Apache License v2.0 which accompanies this distribution.
|
|
|
|
|
*
|
|
|
|
|
* The Eclipse Public License is available at
|
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
*
|
|
|
|
|
* The Apache License v2.0 is available at
|
|
|
|
|
* http://www.opensource.org/licenses/apache2.0.php
|
|
|
|
|
*
|
|
|
|
|
* You may elect to redistribute this code under either of these licenses.
|
|
|
|
|
*/
|
2015-11-20 20:54:27 +01:00
|
|
|
package io.moquette.spi;
|
2013-12-26 15:28:07 +01:00
|
|
|
|
2015-11-15 11:16:18 +01:00
|
|
|
import java.util.Collection;
|
2013-12-26 15:28:07 +01:00
|
|
|
import java.util.List;
|
2014-09-19 22:00:51 +02:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
2015-11-20 20:54:27 +01:00
|
|
|
import io.moquette.spi.impl.subscriptions.Subscription;
|
2013-12-26 15:28:07 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store used to handle the persistence of the subscriptions tree.
|
|
|
|
|
*
|
|
|
|
|
* @author andrea
|
|
|
|
|
*/
|
2014-06-30 23:36:00 +02:00
|
|
|
public interface ISessionsStore {
|
2013-12-26 15:28:07 +01:00
|
|
|
|
2015-11-18 23:45:09 +01:00
|
|
|
void initStore();
|
|
|
|
|
|
2014-06-30 22:59:37 +02:00
|
|
|
/**
|
|
|
|
|
* Add a new subscription to the session
|
|
|
|
|
*/
|
2015-06-21 16:36:47 +02:00
|
|
|
void addNewSubscription(Subscription newSubscription);
|
2013-12-26 15:28:07 +01:00
|
|
|
|
2015-06-21 17:48:28 +02:00
|
|
|
/**
|
|
|
|
|
* Removed a specific subscription
|
|
|
|
|
* */
|
|
|
|
|
void removeSubscription(String topic, String clientID);
|
|
|
|
|
|
2014-06-30 22:59:37 +02:00
|
|
|
/**
|
|
|
|
|
* Remove all the subscriptions of the session
|
|
|
|
|
*/
|
|
|
|
|
void wipeSubscriptions(String sessionID);
|
2013-12-26 15:28:07 +01:00
|
|
|
|
2014-09-19 22:00:51 +02:00
|
|
|
/**
|
|
|
|
|
* Updates the subscriptions set for the clientID
|
|
|
|
|
* */
|
|
|
|
|
void updateSubscriptions(String clientID, Set<Subscription> subscriptions);
|
|
|
|
|
|
2014-06-30 23:00:39 +02:00
|
|
|
List<Subscription> listAllSubscriptions();
|
2014-07-27 12:20:53 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return true iff there are subscriptions persisted with clientID
|
|
|
|
|
*/
|
|
|
|
|
boolean contains(String clientID);
|
2015-09-20 14:10:28 +02:00
|
|
|
|
2015-11-08 18:25:55 +01:00
|
|
|
ClientSession createNewSession(String clientID, boolean cleanSession);
|
2015-10-24 16:26:43 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return the session for the given clientID, null if not found.
|
|
|
|
|
* */
|
|
|
|
|
ClientSession sessionForClient(String clientID);
|
2015-11-08 18:25:55 +01:00
|
|
|
|
|
|
|
|
void activate(String clientID);
|
|
|
|
|
|
|
|
|
|
void deactivate(String clientID);
|
2015-11-15 11:16:18 +01:00
|
|
|
|
|
|
|
|
void inFlightAck(String clientID, int messageID);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Save the binding messageID, clientID <-> guid
|
|
|
|
|
* */
|
|
|
|
|
void inFlight(String clientID, int messageID, String guid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store the guid to be later published.
|
|
|
|
|
* */
|
|
|
|
|
void bindToDeliver(String guid, String clientID);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* List the guids for retained messages for the session
|
|
|
|
|
* */
|
|
|
|
|
Collection<String> enqueued(String clientID);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Remove form the queue of stored messages for session.
|
|
|
|
|
* */
|
|
|
|
|
void removeEnqueued(String clientID, String guid);
|
|
|
|
|
|
|
|
|
|
void secondPhaseAcknowledged(String clientID, int messageID);
|
|
|
|
|
|
|
|
|
|
void secondPhaseAckWaiting(String clientID, int messageID);
|
2015-11-16 23:45:47 +01:00
|
|
|
|
|
|
|
|
String mapToGuid(String clientID, int messageID);
|
2013-12-26 15:28:07 +01:00
|
|
|
}
|