mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Syncing ephemeral element updates
This commit is contained in:
parent
c57249481e
commit
310a9ae4e0
60 changed files with 1104 additions and 906 deletions
|
@ -1,11 +1,12 @@
|
|||
import type { StoreIncrement } from "../store";
|
||||
import type { StoreChange, StoreDelta } from "../store";
|
||||
import type { DTO } from "../utility-types";
|
||||
|
||||
export type CLIENT_INCREMENT = DTO<StoreIncrement>;
|
||||
export type DELTA = DTO<StoreDelta>;
|
||||
export type CHANGE = DTO<StoreChange>;
|
||||
|
||||
export type RELAY_PAYLOAD = { buffer: ArrayBuffer };
|
||||
export type RELAY_PAYLOAD = CHANGE;
|
||||
export type PUSH_PAYLOAD = DELTA;
|
||||
export type PULL_PAYLOAD = { lastAcknowledgedVersion: number };
|
||||
export type PUSH_PAYLOAD = CLIENT_INCREMENT;
|
||||
|
||||
export type CHUNK_INFO = {
|
||||
id: string;
|
||||
|
@ -25,22 +26,21 @@ export type CLIENT_MESSAGE = { chunkInfo: CHUNK_INFO } & (
|
|||
| { type: "push"; payload: PUSH_PAYLOAD }
|
||||
);
|
||||
|
||||
export type SERVER_INCREMENT = { id: string; version: number; payload: string };
|
||||
export type SERVER_DELTA = { id: string; version: number; payload: string };
|
||||
export type SERVER_MESSAGE =
|
||||
| {
|
||||
type: "relayed";
|
||||
// CFDO: should likely be just elements
|
||||
// payload: { increments: Array<CLIENT_INCREMENT> } | RELAY_PAYLOAD;
|
||||
payload: RELAY_PAYLOAD;
|
||||
}
|
||||
| { type: "acknowledged"; payload: { increments: Array<SERVER_INCREMENT> } }
|
||||
| { type: "acknowledged"; payload: { deltas: Array<SERVER_DELTA> } }
|
||||
| {
|
||||
type: "rejected";
|
||||
payload: { increments: Array<CLIENT_INCREMENT>; message: string };
|
||||
payload: { deltas: Array<DELTA>; message: string };
|
||||
};
|
||||
|
||||
export interface IncrementsRepository {
|
||||
save(increment: CLIENT_INCREMENT): SERVER_INCREMENT | null;
|
||||
getAllSinceVersion(version: number): Array<SERVER_INCREMENT>;
|
||||
export interface DeltasRepository {
|
||||
save(delta: DELTA): SERVER_DELTA | null;
|
||||
getAllSinceVersion(version: number): Array<SERVER_DELTA>;
|
||||
getLastVersion(): number;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue