Class InMemorySessionStore
-
- All Implemented Interfaces:
-
org.signal.libsignal.protocol.state.SessionStore
public class InMemorySessionStore implements SessionStore
-
-
Constructor Summary
Constructors Constructor Description InMemorySessionStore()
-
Method Summary
Modifier and Type Method Description synchronized SessionRecordloadSession(SignalProtocolAddress remoteAddress)Returns a copy of the SessionRecord corresponding to the recipientId + deviceId tuple, or a new SessionRecord if one does not currently exist. synchronized List<SessionRecord>loadExistingSessions(List<SignalProtocolAddress> addresses)Returns the SessionRecords corresponding to the given addresses. synchronized List<Integer>getSubDeviceSessions(String name)Returns all known devices with active sessions for a recipient synchronized voidstoreSession(SignalProtocolAddress address, SessionRecord record)Commit to storage the SessionRecord for a given recipientId + deviceId tuple. synchronized booleancontainsSession(SignalProtocolAddress address)Determine whether there is a committed SessionRecord for a recipientId + deviceId tuple. synchronized voiddeleteSession(SignalProtocolAddress address)Remove a SessionRecord for a recipientId + deviceId tuple. synchronized voiddeleteAllSessions(String name)Remove the SessionRecords corresponding to all devices of a recipientId. -
-
Method Detail
-
loadSession
synchronized SessionRecord loadSession(SignalProtocolAddress remoteAddress)
Returns a copy of the SessionRecord corresponding 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.
- Returns:
a copy of the SessionRecord corresponding to the recipientId + deviceId tuple, or a new SessionRecord if one does not currently exist.
-
loadExistingSessions
synchronized List<SessionRecord> loadExistingSessions(List<SignalProtocolAddress> addresses)
Returns the SessionRecords corresponding to the given addresses.
- Parameters:
addresses- The name and device ID of each remote client.- Returns:
the SessionRecords corresponding to each recipientId + deviceId tuple.
-
getSubDeviceSessions
synchronized List<Integer> getSubDeviceSessions(String name)
Returns all known devices with active sessions for a recipient
- Parameters:
name- the name of the client.- Returns:
all known sub-devices with active sessions.
-
storeSession
synchronized void storeSession(SignalProtocolAddress address, SessionRecord record)
Commit to storage the SessionRecord for a given recipientId + deviceId tuple.
- Parameters:
address- the address of the remote client.record- the current SessionRecord for the remote client.
-
containsSession
synchronized boolean containsSession(SignalProtocolAddress address)
Determine whether there is a committed SessionRecord for a recipientId + deviceId tuple.
- Parameters:
address- the address of the remote client.- Returns:
true if a SessionRecord exists, false otherwise.
-
deleteSession
synchronized void deleteSession(SignalProtocolAddress address)
Remove a SessionRecord for a recipientId + deviceId tuple.
- Parameters:
address- the address of the remote client.
-
deleteAllSessions
synchronized void deleteAllSessions(String name)
Remove the SessionRecords corresponding to all devices of a recipientId.
- Parameters:
name- the name of the remote client.
-
-
-
-