Server snapshot WIP

This commit is contained in:
Marcel Mraz 2025-01-29 17:32:25 +01:00
parent 49925038fd
commit 7b72406824
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
10 changed files with 97 additions and 45 deletions

View file

@ -4,6 +4,7 @@ import type { DTO } from "../utility-types";
export type CLIENT_DELTA = DTO<StoreDelta>;
export type CLIENT_CHANGE = DTO<StoreChange>;
export type RESTORE_PAYLOAD = {};
export type RELAY_PAYLOAD = CLIENT_CHANGE;
export type PUSH_PAYLOAD = CLIENT_DELTA;
export type PULL_PAYLOAD = { lastAcknowledgedVersion: number };
@ -15,6 +16,7 @@ export type CHUNK_INFO = {
};
export type CLIENT_MESSAGE = (
| { type: "restore"; payload: RESTORE_PAYLOAD }
| { type: "relay"; payload: RELAY_PAYLOAD }
| { type: "pull"; payload: PULL_PAYLOAD }
| { type: "push"; payload: PUSH_PAYLOAD }
@ -48,7 +50,8 @@ export type SERVER_MESSAGE =
| {
type: "rejected";
payload: { deltas: Array<CLIENT_DELTA>; message: string };
};
}
| { type: "restored"; payload: { elements: Array<ExcalidrawElement> } };
export interface DeltasRepository {
save(delta: CLIENT_DELTA): SERVER_DELTA | null;