Improve diff

This commit is contained in:
Andras Schmelczer 2026-05-09 16:45:51 +01:00
parent e5373ab2bb
commit afa3b6dca3
5 changed files with 8 additions and 11 deletions

View file

@ -58,15 +58,6 @@ pub struct CursorPositionFromServer {
pub clients: Vec<ClientCursors>,
}
// One committed version. Non-delete updates are broadcast to every
// connected client *except* the device that authored them — that
// device already has the new state via its HTTP response. Deletes are
// broadcast to every client including the author: the author keeps
// the document in its sync queue until this receipt arrives so a late
// remote update can't sneak in between the HTTP response and the
// queue cleanup. The server also emits these one-at-a-time to catch
// up a freshly-connected client on versions committed while it was
// offline, in ascending `vault_update_id` order.
#[derive(TS, Serialize, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct WebSocketVaultUpdate {

View file

@ -51,6 +51,9 @@ pub fn get_authenticated_handshake(
/// vault send lock; commits past the cursor are then delivered solely
/// through the broadcast channel (filtered by the same cursor on the
/// receive side), so every committed update is delivered exactly once.
/// We could've used a read transaction but that would've meant all other
/// clients would need to wait for the new client to catch up before
/// sending any updates.
pub async fn get_unseen_documents(
state: &AppState,
vault_id: &VaultId,