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; return userIds;
} }
removeAllForRoom(roomId: string): Promise<undefined> { removeAllForRoom(roomId: string): void {
// exclude both keys as they are theoretical min and max, // 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 // 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); 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> { set(key: string, value: any): void {
return this._sessionStore.put({key, value}); this._sessionStore.put({key, value});
} }
add(key: string, value: any): Promise<IDBValidKey> { add(key: string, value: any): void {
return this._sessionStore.add({key, value}); this._sessionStore.add({key, value});
} }
remove(key: IDBValidKey): Promise<undefined> { remove(key: IDBValidKey): void {
return this._sessionStore.delete(key); 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. /** 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 * @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} ... * @throws {StorageError} ...
*/ */
insert(entry: StorageEntry): Promise<IDBValidKey> { insert(entry: StorageEntry): void {
entry.key = encodeKey(entry.roomId, entry.fragmentId, entry.eventIndex); entry.key = encodeKey(entry.roomId, entry.fragmentId, entry.eventIndex);
entry.eventIdKey = encodeEventIdKey(entry.roomId, entry.event.event_id); entry.eventIdKey = encodeEventIdKey(entry.roomId, entry.event.event_id);
// TODO: map error? or in idb/store? // 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. /** Updates the entry into the store with the given [roomId, eventKey] combination.
* If not yet present, will insert. Might be slower than add. * If not yet present, will insert. Might be slower than add.
* @param entry the entry to update. * @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> { update(entry: StorageEntry): void {
return this._timelineStore.put(entry); this._timelineStore.put(entry);
} }
get(roomId: string, eventKey: EventKey): Promise<StorageEntry | null> { get(roomId: string, eventKey: EventKey): Promise<StorageEntry | null> {
@ -289,10 +289,10 @@ export class TimelineEventStore {
return this._timelineStore.index("byEventId").get(encodeEventIdKey(roomId, eventId)); 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 minKey = encodeKey(roomId, KeyLimits.minStorageKey, KeyLimits.minStorageKey);
const maxKey = encodeKey(roomId, KeyLimits.maxStorageKey, KeyLimits.maxStorageKey); const maxKey = encodeKey(roomId, KeyLimits.maxStorageKey, KeyLimits.maxStorageKey);
const range = this._timelineStore.IDBKeyRange.bound(minKey, maxKey); const range = this._timelineStore.IDBKeyRange.bound(minKey, maxKey);
return this._timelineStore.delete(range); this._timelineStore.delete(range);
} }
} }