|
| 1 | +/* |
| 2 | +Copyright 2021 The Matrix.org Foundation C.I.C. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +import { ISavedSync } from "./index"; |
| 18 | +import { IEvent, IStartClientOpts, ISyncResponse } from ".."; |
| 19 | + |
| 20 | +export interface IIndexedDBBackend { |
| 21 | + connect(): Promise<void>; |
| 22 | + syncToDatabase(userTuples: UserTuple[]): Promise<void>; |
| 23 | + isNewlyCreated(): Promise<boolean>; |
| 24 | + setSyncData(syncData: ISyncResponse): Promise<void>; |
| 25 | + getSavedSync(): Promise<ISavedSync>; |
| 26 | + getNextBatchToken(): Promise<string>; |
| 27 | + clearDatabase(): Promise<void>; |
| 28 | + getOutOfBandMembers(roomId: string): Promise<IEvent[] | null>; |
| 29 | + setOutOfBandMembers(roomId: string, membershipEvents: IEvent[]): Promise<void>; |
| 30 | + clearOutOfBandMembers(roomId: string): Promise<void>; |
| 31 | + getUserPresenceEvents(): Promise<UserTuple[]>; |
| 32 | + getClientOptions(): Promise<IStartClientOpts>; |
| 33 | + storeClientOptions(options: IStartClientOpts): Promise<void>; |
| 34 | +} |
| 35 | + |
| 36 | +export type UserTuple = [userId: string, presenceEvent: Partial<IEvent>]; |
0 commit comments