hydrogen-web/src/matrix/storage/idb/stores/RoomStateStore.js
Bruno Windels 0fd52be710 encode idb array keys as sortable strings
that's why numeric parts of the keys have to be encoded
as a fixed length, "big-endian" ordered strings, so
string sorting will also sort the numeric keys correctly.

this also assumes room ids don't contain the "|" character,
we should probably escape the separator at some point.
2019-06-26 21:55:33 +02:00

20 lines
373 B
JavaScript

export default class RoomStateStore {
constructor(idbStore) {
this._roomStateStore = idbStore;
}
async getEvents(type) {
}
async getEventsForKey(type, stateKey) {
}
async setStateEvent(roomId, event) {
const key = `${roomId}|${event.type}|${event.state_key}`;
const entry = {roomId, event, key};
return this._roomStateStore.put(entry);
}
}