Revert the return-promise change

This commit is contained in:
Danila Fedorin 2021-08-31 11:31:17 -07:00
parent eb3f5f1ec2
commit ce20d40ff7
3 changed files with 16 additions and 16 deletions

View File

@ -78,10 +78,10 @@ export class RoomMemberStore {
return userIds;
}
removeAllForRoom(roomId: string): Promise<undefined> {
removeAllForRoom(roomId: string): void {
// exclude both keys as they are theoretical min and max,
// but we should't have a match for just the room id, or room id with max
const range = this._roomMembersStore.IDBKeyRange.bound(roomId, `${roomId}|${MAX_UNICODE}`, true, true);
return this._roomMembersStore.delete(range);
this._roomMembersStore.delete(range);
}
}

View File

@ -34,15 +34,15 @@ export class SessionStore {
}
}
set(key: string, value: any): Promise<IDBValidKey> {
return this._sessionStore.put({key, value});
set(key: string, value: any): void {
this._sessionStore.put({key, value});
}
add(key: string, value: any): Promise<IDBValidKey> {
return this._sessionStore.add({key, value});
add(key: string, value: any): void {
this._sessionStore.add({key, value});
}
remove(key: IDBValidKey): Promise<undefined> {
return this._sessionStore.delete(key);
remove(key: IDBValidKey): void {
this._sessionStore.delete(key);
}
}

View File

@ -262,23 +262,23 @@ export class TimelineEventStore {
/** Inserts a new entry into the store. The combination of roomId and eventKey should not exist yet, or an error is thrown.
* @param entry the entry to insert
* @return a promise resolving to undefined if the operation was successful, or a StorageError if not.
* @return nothing. To wait for the operation to finish, await the transaction it's part of.
* @throws {StorageError} ...
*/
insert(entry: StorageEntry): Promise<IDBValidKey> {
insert(entry: StorageEntry): void {
entry.key = encodeKey(entry.roomId, entry.fragmentId, entry.eventIndex);
entry.eventIdKey = encodeEventIdKey(entry.roomId, entry.event.event_id);
// TODO: map error? or in idb/store?
return this._timelineStore.add(entry);
this._timelineStore.add(entry);
}
/** Updates the entry into the store with the given [roomId, eventKey] combination.
* If not yet present, will insert. Might be slower than add.
* @param entry the entry to update.
* @return a promise resolving to undefined if the operation was successful, or a StorageError if not.
* @return nothing. To wait for the operation to finish, await the transaction it's part of.
*/
update(entry: StorageEntry): Promise<IDBValidKey> {
return this._timelineStore.put(entry);
update(entry: StorageEntry): void {
this._timelineStore.put(entry);
}
get(roomId: string, eventKey: EventKey): Promise<StorageEntry | null> {
@ -289,10 +289,10 @@ export class TimelineEventStore {
return this._timelineStore.index("byEventId").get(encodeEventIdKey(roomId, eventId));
}
removeAllForRoom(roomId: string): Promise<undefined> {
removeAllForRoom(roomId: string): void {
const minKey = encodeKey(roomId, KeyLimits.minStorageKey, KeyLimits.minStorageKey);
const maxKey = encodeKey(roomId, KeyLimits.maxStorageKey, KeyLimits.maxStorageKey);
const range = this._timelineStore.IDBKeyRange.bound(minKey, maxKey);
return this._timelineStore.delete(range);
this._timelineStore.delete(range);
}
}