broker/ISessionsStore: code formatter used
This commit is contained in:
@@ -13,12 +13,12 @@
|
|||||||
*
|
*
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
* You may elect to redistribute this code under either of these licenses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.moquette.spi;
|
package io.moquette.spi;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
|
||||||
import io.moquette.spi.IMessagesStore.StoredMessage;
|
import io.moquette.spi.IMessagesStore.StoredMessage;
|
||||||
import io.moquette.spi.impl.subscriptions.Subscription;
|
import io.moquette.spi.impl.subscriptions.Subscription;
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@ import io.moquette.spi.impl.subscriptions.Subscription;
|
|||||||
public interface ISessionsStore {
|
public interface ISessionsStore {
|
||||||
|
|
||||||
class ClientTopicCouple {
|
class ClientTopicCouple {
|
||||||
|
|
||||||
public final String topicFilter;
|
public final String topicFilter;
|
||||||
public final String clientID;
|
public final String clientID;
|
||||||
|
|
||||||
@@ -40,12 +41,15 @@ public interface ISessionsStore {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o)
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
|
||||||
ClientTopicCouple that = (ClientTopicCouple) o;
|
ClientTopicCouple that = (ClientTopicCouple) o;
|
||||||
|
|
||||||
if (topicFilter != null ? !topicFilter.equals(that.topicFilter) : that.topicFilter != null) return false;
|
if (topicFilter != null ? !topicFilter.equals(that.topicFilter) : that.topicFilter != null)
|
||||||
|
return false;
|
||||||
return !(clientID != null ? !clientID.equals(that.clientID) : that.clientID != null);
|
return !(clientID != null ? !clientID.equals(that.clientID) : that.clientID != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,10 +62,7 @@ public interface ISessionsStore {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ClientTopicCouple{" +
|
return "ClientTopicCouple{" + "topicFilter='" + topicFilter + '\'' + ", clientID='" + clientID + '\'' + '}';
|
||||||
"topicFilter='" + topicFilter + '\'' +
|
|
||||||
", clientID='" + clientID + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -72,32 +73,40 @@ public interface ISessionsStore {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new subscription to the session
|
* Add a new subscription to the session
|
||||||
* @param newSubscription the subscription to add.
|
*
|
||||||
|
* @param newSubscription
|
||||||
|
* the subscription to add.
|
||||||
*/
|
*/
|
||||||
void addNewSubscription(Subscription newSubscription);
|
void addNewSubscription(Subscription newSubscription);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removed a specific subscription
|
* Removed a specific subscription
|
||||||
* @param topic the topic of the subscription.
|
*
|
||||||
* @param clientID the session client.
|
* @param topic
|
||||||
* */
|
* the topic of the subscription.
|
||||||
|
* @param clientID
|
||||||
|
* the session client.
|
||||||
|
*/
|
||||||
void removeSubscription(String topic, String clientID);
|
void removeSubscription(String topic, String clientID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all the subscriptions of the session
|
* Remove all the subscriptions of the session
|
||||||
* @param sessionID the client ID
|
*
|
||||||
|
* @param sessionID
|
||||||
|
* the client ID
|
||||||
*/
|
*/
|
||||||
void wipeSubscriptions(String sessionID);
|
void wipeSubscriptions(String sessionID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all topic filters to recreate the subscription tree.
|
* Return all topic filters to recreate the subscription tree.
|
||||||
* */
|
*/
|
||||||
List<ClientTopicCouple> listAllSubscriptions();
|
List<ClientTopicCouple> listAllSubscriptions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param couple the subscription descriptor.
|
* @param couple
|
||||||
|
* the subscription descriptor.
|
||||||
* @return the subscription stored by clientID and topicFilter, if any else null;
|
* @return the subscription stored by clientID and topicFilter, if any else null;
|
||||||
* */
|
*/
|
||||||
Subscription getSubscription(ClientTopicCouple couple);
|
Subscription getSubscription(ClientTopicCouple couple);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -106,7 +115,8 @@ public interface ISessionsStore {
|
|||||||
List<Subscription> getSubscriptions();
|
List<Subscription> getSubscriptions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientID the session client ID.
|
* @param clientID
|
||||||
|
* the session client ID.
|
||||||
* @return true iff there are subscriptions persisted with clientID
|
* @return true iff there are subscriptions persisted with clientID
|
||||||
*/
|
*/
|
||||||
boolean contains(String clientID);
|
boolean contains(String clientID);
|
||||||
@@ -114,13 +124,15 @@ public interface ISessionsStore {
|
|||||||
ClientSession createNewSession(String clientID, boolean cleanSession);
|
ClientSession createNewSession(String clientID, boolean cleanSession);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientID the client owning the session.
|
* @param clientID
|
||||||
|
* the client owning the session.
|
||||||
* @return the session for the given clientID, null if not found.
|
* @return the session for the given clientID, null if not found.
|
||||||
* */
|
*/
|
||||||
ClientSession sessionForClient(String clientID);
|
ClientSession sessionForClient(String clientID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the sessions
|
* Returns all the sessions
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Collection<ClientSession> getAllSessions();
|
Collection<ClientSession> getAllSessions();
|
||||||
@@ -129,24 +141,32 @@ public interface ISessionsStore {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the binding messageID, clientID - guid
|
* Save the binding messageID, clientID - guid
|
||||||
* @param clientID the client ID
|
*
|
||||||
* @param messageID the message ID
|
* @param clientID
|
||||||
* @param guid the uuid of the message to mark as inflight.
|
* the client ID
|
||||||
* */
|
* @param messageID
|
||||||
|
* the message ID
|
||||||
|
* @param guid
|
||||||
|
* the uuid of the message to mark as inflight.
|
||||||
|
*/
|
||||||
void inFlight(String clientID, int messageID, MessageGUID guid);
|
void inFlight(String clientID, int messageID, MessageGUID guid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the next valid packetIdentifier for the given client session.
|
* Return the next valid packetIdentifier for the given client session.
|
||||||
* @param clientID the clientID requesting next packet id.
|
*
|
||||||
|
* @param clientID
|
||||||
|
* the clientID requesting next packet id.
|
||||||
* @return the next valid id.
|
* @return the next valid id.
|
||||||
* */
|
*/
|
||||||
int nextPacketID(String clientID);
|
int nextPacketID(String clientID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List the guids for retained messages for the session
|
* List the guids for retained messages for the session
|
||||||
* @param clientID the client ID owning the queue.
|
*
|
||||||
|
* @param clientID
|
||||||
|
* the client ID owning the queue.
|
||||||
* @return the list of queue message UUIDs.
|
* @return the list of queue message UUIDs.
|
||||||
* */
|
*/
|
||||||
BlockingQueue<StoredMessage> queue(String clientID);
|
BlockingQueue<StoredMessage> queue(String clientID);
|
||||||
|
|
||||||
void dropQueue(String clientID);
|
void dropQueue(String clientID);
|
||||||
@@ -154,10 +174,12 @@ public interface ISessionsStore {
|
|||||||
void moveInFlightToSecondPhaseAckWaiting(String clientID, int messageID);
|
void moveInFlightToSecondPhaseAckWaiting(String clientID, int messageID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientID the client ID accessing the second phase.
|
* @param clientID
|
||||||
* @param messageID the message ID that reached the second phase.
|
* the client ID accessing the second phase.
|
||||||
|
* @param messageID
|
||||||
|
* the message ID that reached the second phase.
|
||||||
* @return the guid of message just acked.
|
* @return the guid of message just acked.
|
||||||
* */
|
*/
|
||||||
MessageGUID secondPhaseAcknowledged(String clientID, int messageID);
|
MessageGUID secondPhaseAcknowledged(String clientID, int messageID);
|
||||||
|
|
||||||
MessageGUID mapToGuid(String clientID, int messageID);
|
MessageGUID mapToGuid(String clientID, int messageID);
|
||||||
@@ -181,8 +203,7 @@ public interface ISessionsStore {
|
|||||||
int getPendingPublishMessagesNo(String clientID);
|
int getPendingPublishMessagesNo(String clientID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of second-phase ACK pending messages for the given
|
* Returns the number of second-phase ACK pending messages for the given client ID
|
||||||
* client ID
|
|
||||||
*
|
*
|
||||||
* @param clientID
|
* @param clientID
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
Reference in New Issue
Block a user