Class InMemorySessionStore
- java.lang.Object
-
- org.signal.libsignal.protocol.state.impl.InMemorySessionStore
-
- All Implemented Interfaces:
SessionStore
public class InMemorySessionStore extends java.lang.Object implements SessionStore
-
-
Constructor Summary
Constructors Constructor Description InMemorySessionStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsSession(SignalProtocolAddress address)Determine whether there is a committedSessionRecordfor a recipientId + deviceId tuple.voiddeleteAllSessions(java.lang.String name)Remove theSessionRecords corresponding to all devices of a recipientId.voiddeleteSession(SignalProtocolAddress address)Remove aSessionRecordfor a recipientId + deviceId tuple.java.util.List<java.lang.Integer>getSubDeviceSessions(java.lang.String name)Returns all known devices with active sessions for a recipientjava.util.List<SessionRecord>loadExistingSessions(java.util.List<SignalProtocolAddress> addresses)Returns theSessionRecords corresponding to the given addresses.SessionRecordloadSession(SignalProtocolAddress remoteAddress)Returns a copy of theSessionRecordcorresponding to the recipientId + deviceId tuple, or a new SessionRecord if one does not currently exist.voidstoreSession(SignalProtocolAddress address, SessionRecord record)Commit to storage theSessionRecordfor a given recipientId + deviceId tuple.
-
-
-
Method Detail
-
loadSession
public SessionRecord loadSession(SignalProtocolAddress remoteAddress)
Description copied from interface:SessionStoreReturns a copy of theSessionRecordcorresponding to the recipientId + deviceId tuple, or a new SessionRecord if one does not currently exist.It is important that implementations return a copy of the current durable information. The returned SessionRecord may be modified, but those changes should not have an effect on the durable session state (what is returned by subsequent calls to this method) without the store method being called here first.
- Specified by:
loadSessionin interfaceSessionStore- Parameters:
remoteAddress- The name and device ID of the remote client.- Returns:
- a copy of the SessionRecord corresponding to the recipientId + deviceId tuple, or a new SessionRecord if one does not currently exist.
-
loadExistingSessions
public java.util.List<SessionRecord> loadExistingSessions(java.util.List<SignalProtocolAddress> addresses) throws NoSessionException
Description copied from interface:SessionStoreReturns theSessionRecords corresponding to the given addresses.- Specified by:
loadExistingSessionsin interfaceSessionStore- Parameters:
addresses- The name and device ID of each remote client.- Returns:
- the SessionRecords corresponding to each recipientId + deviceId tuple.
- Throws:
NoSessionException- if any address does not have an active session.
-
getSubDeviceSessions
public java.util.List<java.lang.Integer> getSubDeviceSessions(java.lang.String name)
Description copied from interface:SessionStoreReturns all known devices with active sessions for a recipient- Specified by:
getSubDeviceSessionsin interfaceSessionStore- Parameters:
name- the name of the client.- Returns:
- all known sub-devices with active sessions.
-
storeSession
public void storeSession(SignalProtocolAddress address, SessionRecord record)
Description copied from interface:SessionStoreCommit to storage theSessionRecordfor a given recipientId + deviceId tuple.- Specified by:
storeSessionin interfaceSessionStore- Parameters:
address- the address of the remote client.record- the current SessionRecord for the remote client.
-
containsSession
public boolean containsSession(SignalProtocolAddress address)
Description copied from interface:SessionStoreDetermine whether there is a committedSessionRecordfor a recipientId + deviceId tuple.- Specified by:
containsSessionin interfaceSessionStore- Parameters:
address- the address of the remote client.- Returns:
- true if a
SessionRecordexists, false otherwise.
-
deleteSession
public void deleteSession(SignalProtocolAddress address)
Description copied from interface:SessionStoreRemove aSessionRecordfor a recipientId + deviceId tuple.- Specified by:
deleteSessionin interfaceSessionStore- Parameters:
address- the address of the remote client.
-
deleteAllSessions
public void deleteAllSessions(java.lang.String name)
Description copied from interface:SessionStoreRemove theSessionRecords corresponding to all devices of a recipientId.- Specified by:
deleteAllSessionsin interfaceSessionStore- Parameters:
name- the name of the remote client.
-
-