Save storage for defunct and pending call links

This commit is contained in:
ayumi-signal 2024-10-22 11:20:35 -07:00 committed by GitHub
parent a7be33b201
commit c6902ec26a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 474 additions and 31 deletions

View file

@ -83,13 +83,41 @@ export type CallLinkConversationType = ReadonlyDeep<
}
>;
// Call link discovered from sync, waiting to refresh state from the calling server
export type PendingCallLinkType = Readonly<{
rootKey: string;
adminKey: string | null;
}> &
StorageServiceFieldsType;
// Call links discovered missing after server refresh
export type DefunctCallLinkType = Readonly<{
roomId: string;
rootKey: string;
adminKey: string | null;
}> &
StorageServiceFieldsType;
export type DefunctCallLinkRecord = Readonly<{
roomId: string;
rootKey: Uint8Array;
adminKey: Uint8Array | null;
storageID: string | null;
storageVersion: number | null;
storageUnknownFields: Uint8Array | null;
storageNeedsSync: 1 | 0;
}>;
export const defunctCallLinkRecordSchema = z.object({
roomId: z.string(),
rootKey: z.instanceof(Uint8Array),
adminKey: z.instanceof(Uint8Array).nullable(),
storageID: z.string().nullable(),
storageVersion: z.number().int().nullable(),
storageUnknownFields: z.instanceof(Uint8Array).nullable(),
storageNeedsSync: z.union([z.literal(1), z.literal(0)]),
}) satisfies z.ZodType<DefunctCallLinkRecord>;
// DB Record
export type CallLinkRecord = Readonly<{
roomId: string;