Migrate save sync to use server-side negotiate API#163
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces client-side save sync resolution with the (under development) server-side negotiate API (
POST /api/sync/negotiate) from rommapp/romm#3137.What changed
Before: grout fetched remote saves per-ROM (N concurrent
GET /api/saves calls), ran its own conflict detection by comparing localmtimesagainstDeviceSyncs.LastSyncedAt,and separately discovered remote-only saves.After: grout scans local saves, computes MD5 content hashes, and sends everything to the server in a single negotiate call. The server determines upload/download/conflict/no_op actions and returns a sync session. Grout executes the plan and marks the session complete.
Changes
romm/sync.go(new): API types and client methods for negotiate/complete endpointsromm/saves.go: Added session_id to upload/download queries. + movedMarkDeviceSynced/ConfirmSaveDownloadedinternal/fileutil/fileutil.go: AddedComputeMD5matching the server's content hash algorithmsync/flow.go(rewritten):ResolveSaveSyncnow calls negotiate instead of doing client-side resolution, andExecuteSaveSynctracks session lifecyclesync/execute.go(extracted from flow.go): Upload/download execution with session ID pass-throughsync/scan.go(extracted from flow.go): Local save scanning and slot selectionRemoved
determineAction,DetermineActions)FetchRemoteSaves,DiscoverRemoteSaves`)LocalSavesWithoutRemote,NewSaveUploadActions)MarkDeviceSynced/ConfirmSaveDownloaded/endpointSaveDownloadedRequires rommapp/romm#3137