You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Add local storage impl notes
This commit is contained in:
@@ -1,11 +1,32 @@
|
||||
"use strict";
|
||||
/**
|
||||
* This is an internal module.
|
||||
* This is an internal module. Implementation details:
|
||||
*
|
||||
* Room data is stored as follows:
|
||||
* room_data_$ROOMID : { event_id1: Event, event_id2: Event, ... }
|
||||
* room_timeline_$ROOMID : [event_id1, event_id2, event_id3, ...]
|
||||
* User data is stored as follows:
|
||||
* user_$USERID : User
|
||||
* Sync token:
|
||||
* sync_token : $TOKEN
|
||||
*
|
||||
* Retrieving earlier messages requires a Room which then finds the earliest
|
||||
* event_id in the timeline. Then, room_timeline_$ROOMID is inspected to grab
|
||||
* the N earlier event_ids. The event data is then extracted from
|
||||
* room_data_$ROOMID.
|
||||
*
|
||||
* TODO: room_data_$ROOMID may get Large. Should we shard the data off the event
|
||||
* ID? E.g. hash event ID mod 10 and extract from buckets? We really want
|
||||
* events close together to be in the same bucket, so perhaps abusing the
|
||||
* origin_server_ts (which is fine since it's just for optimisation) would
|
||||
* be a better approach?
|
||||
*
|
||||
* @module store/localstorage
|
||||
*/
|
||||
|
||||
/**
|
||||
* Construct a localstorage store.
|
||||
* Construct a local storage store, capable of storing rooms and users.
|
||||
*
|
||||
* @constructor
|
||||
* @throws if the global 'localStorage' does not exist.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user