Class MemoryStore

A store for most of the data js-sdk needs to store, apart from crypto data

Hierarchy

Implements

Constructors

Properties

accountData: Map<string, MatrixEvent> = ...
clientOptions?: IStoredClientOpts
filters: MapWithDefault<string, Map<string, Filter>> = ...
localStorage?: Storage
nextToDeviceBatchId: number = 0
oobMembers: Map<string, IStateEventWithRoomId[]> = ...
pendingEvents: {
    [roomId: string]: Partial<IEvent>[];
} = {}

Type declaration

  • [roomId: string]: Partial<IEvent>[]
pendingToDeviceBatches: IndexedToDeviceBatch[] = []
rooms: Record<string, Room> = {}
syncToken: null | string = null
users: Record<string, User> = {}

Methods

  • Retrieve a filter ID with the given name.

    Returns

    The filter ID or null.

    Parameters

    • filterName: string

      The filter name.

    Returns null | string

  • Returns the out-of-band membership events for this room that were previously loaded.

    Returns

    the events, potentially an empty array if OOB loading didn't yield any new members

    Returns

    in case the members for this room haven't been stored yet

    Parameters

    • roomId: string

    Returns Promise<null | IStateEventWithRoomId[]>

  • Retrieve a room by its' room ID.

    Returns

    The room or null.

    Parameters

    • roomId: string

      The room ID.

    Returns null | Room

  • Returns

    If there is a saved sync, the nextBatch token for this sync, otherwise null.

    Returns Promise<null | string>

  • Retrieve a User by its' user ID.

    Returns

    The user or null.

    Parameters

    • userId: string

      The user ID.

    Returns null | User

  • Save does nothing as there is no backing data store.

    Parameters

    • force: boolean

      True to force a save (but the memory store still can't save anything)

    Returns void

  • Retrieve scrollback for this room.

    Returns

    An array of objects which will be at most 'limit' length and at least 0. The objects are the raw event JSON.

    Parameters

    • room: Room

      The matrix room

    • limit: number

      The max number of old events to retrieve.

    Returns MatrixEvent[]

  • Set a filter name to ID mapping.

    Parameters

    • filterName: string
    • Optional filterId: string

    Returns void

  • 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

    Returns

    when all members have been stored

    Parameters

    Returns Promise<void>

  • Set the token to stream from.

    Parameters

    • token: string

      The token to stream from.

    Returns void

  • Startup does nothing as this store doesn't require starting up.

    Returns

    An immediately resolved promise.

    Returns Promise<void>

  • Store events for a room. The events have already been added to the timeline

    Parameters

    • room: Room

      The room to store events for.

    • events: MatrixEvent[]

      The events to store.

    • token: null | string

      The token associated with these events.

    • toStart: boolean

      True if these are paginated results.

    Returns void

  • We never want to save becase we have nothing to save to.

    Returns

    If the store wants to save

    Returns boolean

Generated using TypeDoc