MemoryStore
Defined in: src/store/memory.ts:52
Extended by
Section titled “Extended by”Implements
Section titled “Implements”IStore
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MemoryStore(
opts?):MemoryStore
Defined in: src/store/memory.ts:74
Construct a new in-memory data store for the Digital World Client.
Parameters
Section titled “Parameters”IOpts = {}
Config options
Returns
Section titled “Returns”MemoryStore
Properties
Section titled “Properties”accountData
Section titled “accountData”accountData:
Map<string,DigitalWorldEvent>
Defined in: src/store/memory.ts:60
Implementation of
Section titled “Implementation of”IStore.accountData
userProfiles
Section titled “userProfiles”
readonlyuserProfiles:Map<string,SyncUserProfile>
Defined in: src/store/memory.ts:68
Methods
Section titled “Methods”clearOutOfBandMembers()
Section titled “clearOutOfBandMembers()”clearOutOfBandMembers(
roomId):Promise<void>
Defined in: src/store/memory.ts:402
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.clearOutOfBandMembers
deleteAllData()
Section titled “deleteAllData()”deleteAllData():
Promise<void>
Defined in: src/store/memory.ts:367
Delete all data from this store.
Returns
Section titled “Returns”Promise<void>
An immediately resolved promise.
Implementation of
Section titled “Implementation of”IStore.deleteAllData
destroy()
Section titled “destroy()”destroy():
Promise<void>
Defined in: src/store/memory.ts:462
Stop the store and perform any appropriate cleanup
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.destroy
getAccountData()
Section titled “getAccountData()”getAccountData(
eventType):DigitalWorldEvent|undefined
Defined in: src/store/memory.ts:306
Get account data event by event type
Parameters
Section titled “Parameters”eventType
Section titled “eventType”string
The event type being queried
Returns
Section titled “Returns”DigitalWorldEvent | undefined
the user account_data event of given type, if any
Implementation of
Section titled “Implementation of”IStore.getAccountData
getClientOptions()
Section titled “getClientOptions()”getClientOptions():
Promise<IStoredClientOpts|undefined>
Defined in: src/store/memory.ts:407
Returns
Section titled “Returns”Promise<IStoredClientOpts | undefined>
Implementation of
Section titled “Implementation of”IStore.getClientOptions
getFilter()
Section titled “getFilter()”getFilter(
userId,filterId):Filter|null
Defined in: src/store/memory.ts:238
Retrieve a filter.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
filterId
Section titled “filterId”string
Returns
Section titled “Returns”Filter | null
A filter or null.
Implementation of
Section titled “Implementation of”IStore.getFilter
getFilterIdByName()
Section titled “getFilterIdByName()”getFilterIdByName(
filterName):string|null
Defined in: src/store/memory.ts:247
Retrieve a filter ID with the given name.
Parameters
Section titled “Parameters”filterName
Section titled “filterName”string
The filter name.
Returns
Section titled “Returns”string | null
The filter ID or null.
Implementation of
Section titled “Implementation of”IStore.getFilterIdByName
getOldestToDeviceBatch()
Section titled “getOldestToDeviceBatch()”getOldestToDeviceBatch():
Promise<IndexedToDeviceBatch|null>
Defined in: src/store/memory.ts:436
Fetches the oldest batch of to-device messages in the queue
Returns
Section titled “Returns”Promise<IndexedToDeviceBatch | null>
Implementation of
Section titled “Implementation of”IStore.getOldestToDeviceBatch
getOutOfBandMembers()
Section titled “getOutOfBandMembers()”getOutOfBandMembers(
roomId):Promise<IStateEventWithRoomId[] |null>
Defined in: src/store/memory.ts:386
Returns the out-of-band membership events for this room that were previously loaded.
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
Returns
Section titled “Returns”Promise<IStateEventWithRoomId[] | null>
the events, potentially an empty array if OOB loading didn’t yield any new members
Implementation of
Section titled “Implementation of”IStore.getOutOfBandMembers
getPendingEvents()
Section titled “getPendingEvents()”getPendingEvents(
roomId):Promise<Partial<IEvent>[]>
Defined in: src/store/memory.ts:416
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
Returns
Section titled “Returns”Promise<Partial<IEvent>[]>
Implementation of
Section titled “Implementation of”IStore.getPendingEvents
getRoom()
Section titled “getRoom()”getRoom(
roomId):Room|null
Defined in: src/store/memory.ts:147
Retrieve a room by its’ room ID.
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
The room ID.
Returns
Section titled “Returns”Room | null
The room or null.
Implementation of
Section titled “Implementation of”IStore.getRoom
getRooms()
Section titled “getRooms()”getRooms():
Room[]
Defined in: src/store/memory.ts:155
Retrieve all known rooms.
Returns
Section titled “Returns”Room[]
A list of rooms, which may be empty.
Implementation of
Section titled “Implementation of”IStore.getRooms
getRoomSummaries()
Section titled “getRoomSummaries()”getRoomSummaries():
RoomSummary[]
Defined in: src/store/memory.ts:173
Retrieve a summary of all the rooms.
Returns
Section titled “Returns”RoomSummary[]
A summary of each room.
Implementation of
Section titled “Implementation of”IStore.getRoomSummaries
getSavedSync()
Section titled “getSavedSync()”getSavedSync():
Promise<ISavedSync|null>
Defined in: src/store/memory.ts:351
Returns
Section titled “Returns”Promise<ISavedSync | null>
Promise which resolves with a sync response to restore the client state to where it was at the last save, or null if there is no saved sync data.
Implementation of
Section titled “Implementation of”IStore.getSavedSync
getSavedSyncToken()
Section titled “getSavedSyncToken()”getSavedSyncToken():
Promise<string|null>
Defined in: src/store/memory.ts:359
Returns
Section titled “Returns”Promise<string | null>
If there is a saved sync, the nextBatch token for this sync, otherwise null.
Implementation of
Section titled “Implementation of”IStore.getSavedSyncToken
getSyncToken()
Section titled “getSyncToken()”getSyncToken():
string|null
Defined in: src/store/memory.ts:82
Retrieve the token to stream from.
Returns
Section titled “Returns”string | null
The token or null.
Implementation of
Section titled “Implementation of”IStore.getSyncToken
getUser()
Section titled “getUser()”getUser(
userId):User|null
Defined in: src/store/memory.ts:192
Retrieve a User by its’ user ID.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
The user ID.
Returns
Section titled “Returns”User | null
The user or null.
Implementation of
Section titled “Implementation of”IStore.getUser
getUserProfile()
Section titled “getUserProfile()”getUserProfile(
userId):Promise<SyncUserProfile|undefined>
Defined in: src/store/memory.ts:446
Retrieve a stored user profile for the given user ID, if it exists.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
The user ID to retrieve the profile for.
Returns
Section titled “Returns”Promise<SyncUserProfile | undefined>
The stored profile, or undefined if no profile is stored for this user ID.
Implementation of
Section titled “Implementation of”IStore.getUserProfile
getUsers()
Section titled “getUsers()”getUsers():
User[]
Defined in: src/store/memory.ts:200
Retrieve all known users.
Returns
Section titled “Returns”User[]
A list of users, which may be empty.
Implementation of
Section titled “Implementation of”IStore.getUsers
isNewlyCreated()
Section titled “isNewlyCreated()”isNewlyCreated():
Promise<boolean>
Defined in: src/store/memory.ts:87
Returns
Section titled “Returns”Promise<boolean>
whether or not the database was newly created in this session.
Implementation of
Section titled “Implementation of”IStore.isNewlyCreated
removeEventsFromRoom()
Section titled “removeEventsFromRoom()”removeEventsFromRoom(
roomId,eventIds):Promise<void>
Defined in: src/store/memory.ts:458
Remove all stored events matching the given IDs from the stored accumulated sync.
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
The target room.
eventIds
Section titled “eventIds”string[]
IDs of events to remove.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.removeEventsFromRoom
removeRoom()
Section titled “removeRoom()”removeRoom(
roomId):void
Defined in: src/store/memory.ts:162
Permanently delete a room.
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.removeRoom
removeToDeviceBatch()
Section titled “removeToDeviceBatch()”removeToDeviceBatch(
id):Promise<void>
Defined in: src/store/memory.ts:441
Removes a specific batch of to-device messages from the queue
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.removeToDeviceBatch
removeUserProfiles()
Section titled “removeUserProfiles()”removeUserProfiles(
userIds):Promise<void>
Defined in: src/store/memory.ts:454
Delete stored profiles for the given users.
Parameters
Section titled “Parameters”userIds
Section titled “userIds”string[]
The user IDs whose profiles should be deleted.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.removeUserProfiles
save()
Section titled “save()”save(
force):Promise<void>
Defined in: src/store/memory.ts:334
Save does nothing as there is no backing data store.
Parameters
Section titled “Parameters”boolean
True to force a save (but the memory store still can’t save anything)
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.save
saveToDeviceBatches()
Section titled “saveToDeviceBatches()”saveToDeviceBatches(
batches):Promise<void>
Defined in: src/store/memory.ts:424
Stores batches of outgoing to-device messages
Parameters
Section titled “Parameters”batches
Section titled “batches”ToDeviceBatchWithTxnId[]
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.saveToDeviceBatches
scrollback()
Section titled “scrollback()”scrollback(
room,limit):DigitalWorldEvent[]
Defined in: src/store/memory.ts:211
Retrieve scrollback for this room.
Parameters
Section titled “Parameters”The room
number
The max number of old events to retrieve.
Returns
Section titled “Returns”An array of objects which will be at most ‘limit’ length and at least 0. The objects are the raw event JSON.
Implementation of
Section titled “Implementation of”IStore.scrollback
setFilterIdByName()
Section titled “setFilterIdByName()”setFilterIdByName(
filterName,filterId?):void
Defined in: src/store/memory.ts:269
Set a filter name to ID mapping.
Parameters
Section titled “Parameters”filterName
Section titled “filterName”string
filterId?
Section titled “filterId?”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.setFilterIdByName
setOutOfBandMembers()
Section titled “setOutOfBandMembers()”setOutOfBandMembers(
roomId,membershipEvents):Promise<void>
Defined in: src/store/memory.ts:397
Stores the out-of-band membership events for this room. Note that it still makes sense to store an empty array as the OOB status for the room is marked as fetched, and getOutOfBandMembers will return an empty array instead of null
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
membershipEvents
Section titled “membershipEvents”the membership events to store
Returns
Section titled “Returns”Promise<void>
when all members have been stored
Implementation of
Section titled “Implementation of”IStore.setOutOfBandMembers
setPendingEvents()
Section titled “setPendingEvents()”setPendingEvents(
roomId,events):Promise<void>
Defined in: src/store/memory.ts:420
Parameters
Section titled “Parameters”roomId
Section titled “roomId”string
events
Section titled “events”Partial<IEvent>[]
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.setPendingEvents
setSyncData()
Section titled “setSyncData()”setSyncData(
syncData):Promise<void>
Defined in: src/store/memory.ts:316
setSyncData does nothing as there is no backing data store.
Parameters
Section titled “Parameters”syncData
Section titled “syncData”The sync data
Returns
Section titled “Returns”Promise<void>
An immediately resolved promise.
Implementation of
Section titled “Implementation of”IStore.setSyncData
setSyncToken()
Section titled “setSyncToken()”setSyncToken(
token):void
Defined in: src/store/memory.ts:95
Set the token to stream from.
Parameters
Section titled “Parameters”string
The token to stream from.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.setSyncToken
setUserCreator()
Section titled “setUserCreator()”setUserCreator(
creator):void
Defined in: src/store/memory.ts:114
Set the user creator which is used for creating User objects
Parameters
Section titled “Parameters”creator
Section titled “creator”UserCreator
A callback that accepts an user-id and returns an User object
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.setUserCreator
startup()
Section titled “startup()”startup():
Promise<void>
Defined in: src/store/memory.ts:342
Startup does nothing as this store doesn’t require starting up.
Returns
Section titled “Returns”Promise<void>
An immediately resolved promise.
Implementation of
Section titled “Implementation of”IStore.startup
storeAccountDataEvents()
Section titled “storeAccountDataEvents()”storeAccountDataEvents(
events):void
Defined in: src/store/memory.ts:289
Store user-scoped account data events. N.B. that account data only allows a single event per type, so multiple events with the same type will replace each other.
Parameters
Section titled “Parameters”events
Section titled “events”The events to store.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.storeAccountDataEvents
storeClientOptions()
Section titled “storeClientOptions()”storeClientOptions(
options):Promise<void>
Defined in: src/store/memory.ts:411
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.storeClientOptions
storeEvents()
Section titled “storeEvents()”storeEvents(
room,events,token,toStart):void
Defined in: src/store/memory.ts:222
Store events for a room. The events have already been added to the timeline
Parameters
Section titled “Parameters”The room to store events for.
events
Section titled “events”The events to store.
string | null
The token associated with these events.
toStart
Section titled “toStart”boolean
True if these are paginated results.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.storeEvents
storeFilter()
Section titled “storeFilter()”storeFilter(
filter):void
Defined in: src/store/memory.ts:229
Store a filter.
Parameters
Section titled “Parameters”filter
Section titled “filter”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.storeFilter
storeRoom()
Section titled “storeRoom()”storeRoom(
room):void
Defined in: src/store/memory.ts:103
Store the given room.
Parameters
Section titled “Parameters”The room to be stored. All properties must be stored.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.storeRoom
storeUser()
Section titled “storeUser()”storeUser(
user):void
Defined in: src/store/memory.ts:183
Store a User.
Parameters
Section titled “Parameters”The user to store.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IStore.storeUser
storeUserProfiles()
Section titled “storeUserProfiles()”storeUserProfiles(
userProfiles):Promise<void>
Defined in: src/store/memory.ts:450
Store user profile details from a sync. Existing profiles will be overwritten.
Parameters
Section titled “Parameters”userProfiles
Section titled “userProfiles”Map<string, SyncUserProfile>
A map of userIds to profiles.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”IStore.storeUserProfiles
wantsSave()
Section titled “wantsSave()”wantsSave():
boolean
Defined in: src/store/memory.ts:325
We never want to save becase we have nothing to save to.
Returns
Section titled “Returns”boolean
If the store wants to save
Implementation of
Section titled “Implementation of”IStore.wantsSave