From 43d430fc9803f60493235d754e05cf4b2bbdcde5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 29 Sep 2020 11:47:49 +0200 Subject: [PATCH] remove unused storage modification functions --- src/matrix/storage/idb/stores/TimelineEventStore.js | 5 ----- src/matrix/storage/idb/utils.js | 11 ----------- src/matrix/storage/memory/stores/RoomTimelineStore.js | 7 ------- 3 files changed, 23 deletions(-) diff --git a/src/matrix/storage/idb/stores/TimelineEventStore.js b/src/matrix/storage/idb/stores/TimelineEventStore.js index a3a829f9..9a5fddfc 100644 --- a/src/matrix/storage/idb/stores/TimelineEventStore.js +++ b/src/matrix/storage/idb/stores/TimelineEventStore.js @@ -253,11 +253,6 @@ export class TimelineEventStore { get(roomId, eventKey) { return this._timelineStore.get(encodeKey(roomId, eventKey.fragmentId, eventKey.eventIndex)); } - // returns the entries as well!! (or not always needed? I guess not always needed, so extra method) - removeRange(roomId, range) { - // TODO: read the entries! - return this._timelineStore.delete(range.asIDBKeyRange(roomId)); - } getByEventId(roomId, eventId) { return this._timelineStore.index("byEventId").get(encodeEventIdKey(roomId, eventId)); diff --git a/src/matrix/storage/idb/utils.js b/src/matrix/storage/idb/utils.js index 1d347f46..ac9f3911 100644 --- a/src/matrix/storage/idb/utils.js +++ b/src/matrix/storage/idb/utils.js @@ -151,17 +151,6 @@ export async function select(db, storeName, toCursor, isDone) { return await fetchResults(cursor, isDone); } -export async function updateSingletonStore(db, storeName, value) { - const tx = db.transaction([storeName], "readwrite"); - const store = tx.objectStore(storeName); - const cursor = await reqAsPromise(store.openCursor()); - if (cursor) { - return reqAsPromise(cursor.update(storeName)); - } else { - return reqAsPromise(store.add(value)); - } -} - export async function findStoreValue(db, storeName, toCursor, matchesValue) { if (!matchesValue) { matchesValue = () => true; diff --git a/src/matrix/storage/memory/stores/RoomTimelineStore.js b/src/matrix/storage/memory/stores/RoomTimelineStore.js index 5cc31173..5be20eae 100644 --- a/src/matrix/storage/memory/stores/RoomTimelineStore.js +++ b/src/matrix/storage/memory/stores/RoomTimelineStore.js @@ -234,11 +234,4 @@ export class RoomTimelineStore extends Store { const event = count ? this._timeline[startIndex] : undefined; return Promise.resolve(event); } - - removeRange(roomId, range) { - this.assertWritable(); - const {startIndex, count} = range.project(roomId); - const removedEntries = this._timeline.splice(startIndex, count); - return Promise.resolve(removedEntries); - } }