Introduce in-memory transactions for sessions

This commit is contained in:
Fedor Indutny 2021-05-17 11:03:42 -07:00 committed by Scott Nonnenberg
parent 403b3c5fc6
commit 94d2c56ab9
12 changed files with 874 additions and 391 deletions

View file

@ -131,11 +131,11 @@ export type UnprocessedType = {
timestamp: number;
version: number;
attempts: number;
envelope: string;
envelope?: string;
source?: string;
sourceUuid?: string;
sourceDevice?: string;
sourceDevice?: number;
serverTimestamp?: number;
decrypted?: string;
};
@ -188,6 +188,10 @@ export type DataInterface = {
createOrUpdateSession: (data: SessionType) => Promise<void>;
createOrUpdateSessions: (array: Array<SessionType>) => Promise<void>;
commitSessionsAndUnprocessed(options: {
sessions: Array<SessionType>;
unprocessed: Array<UnprocessedType>;
}): Promise<void>;
getSessionById: (id: string) => Promise<SessionType | undefined>;
getSessionsById: (conversationId: string) => Promise<Array<SessionType>>;
bulkAddSessions: (array: Array<SessionType>) => Promise<void>;