GothenburgBitFactory / GothenburgBitFactory/taskchampion-sync-server

Add a `GetLatestVersionId` transaction to the sync protocol

Open
#4 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
193
Forks
28
Avg merge
6h 16m
Merged PRs (30d)
6

Description

The current sync protocol supports GetChildVersion, which can be used to iterate through versions from parent -> child. And, it supports AddVersion, which adds a new version if its parent is the latest version. But there's no way to find out what the latest version is.

That would be useful when getting changes from the server. There are two scenarios that look OK to the client, but are actually errors:
- Iteration with GetChildVersion stops because there is no child version -- but the parent version is not the latest! This might happen if a version is somehow lost on the server.
- A new replica is initialized without a snapshot on the server, and the version with parent NIL_VERSION_ID has been deleted. The client gets no snapshot, so begins iterating at NIL_VERSION_ID, and seeing no child of that version ID, assumes it has all of the data. A snapshot might be missing due to corruption or due to a new replica that hasn't yet gotten a snapshot.

(In fact, in terms of the sync code these are exactly the same situation -- iteration stops, but the replica is not up to date)

A `GetLatestVersionId` transaction would simply return the latest version id. The client can make this transaction after it has finished iterating with `GetChildVersion`. If iteration didn't stop with the latest version id, then things have gone wrong and it should fail with an error.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.