remove unused storage modification functions

This commit is contained in:
Bruno Windels 2020-09-29 11:47:49 +02:00
parent f993048a2b
commit 43d430fc98
3 changed files with 0 additions and 23 deletions

View file

@ -253,11 +253,6 @@ export class TimelineEventStore {
get(roomId, eventKey) { get(roomId, eventKey) {
return this._timelineStore.get(encodeKey(roomId, eventKey.fragmentId, eventKey.eventIndex)); 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) { getByEventId(roomId, eventId) {
return this._timelineStore.index("byEventId").get(encodeEventIdKey(roomId, eventId)); return this._timelineStore.index("byEventId").get(encodeEventIdKey(roomId, eventId));

View file

@ -151,17 +151,6 @@ export async function select(db, storeName, toCursor, isDone) {
return await fetchResults(cursor, 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) { export async function findStoreValue(db, storeName, toCursor, matchesValue) {
if (!matchesValue) { if (!matchesValue) {
matchesValue = () => true; matchesValue = () => true;

View file

@ -234,11 +234,4 @@ export class RoomTimelineStore extends Store {
const event = count ? this._timeline[startIndex] : undefined; const event = count ? this._timeline[startIndex] : undefined;
return Promise.resolve(event); 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);
}
} }