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.
This pull request introduces a file change acknowledgment mechanism to the filesync protocol and codebase. The main goal is to enable clients and servers to track which file changes (by sequence number) have been received and acknowledged, improving reliability and observability in the sync process. It also bumps the protocol version and propagates
change_sequencefields throughout file metadata and message types.Protocol and Metadata Updates:
ChangeAcknowledgmentmessage type is added, allowing clients to acknowledge receipt of specific file changes (by sequence number) within a bundle. TheFileMetadatastruct now includes achange_sequencefield. [1] [2] [3]File Bundling and Streaming:
stream_messagesandstream_large_filefunctions now accept an optionalSyncEnginereference and populate thechange_sequencefield for each file or directory. This ensures each change is tracked with a unique sequence number. [1] [2] [3] [4] [5] [6]change_sequenceto 0 for files and directories, ensuring compatibility. [1] [2]Client Handling of Acknowledgments:
ChangeAcknowledgmentmessage after receiving and applying a bundle, listing all nonzero sequence numbers. It also logs received acknowledgments (for future use in tracking delivery guarantees). Large file acknowledgments are noted as a future improvement. [1] [2] [3]Server Tracking and Processing:
sent_bundlesmap to track which bundles (and their sequence numbers) have been sent to clients, who has acknowledged them, and when. TheBundleTrackingstruct is introduced for this purpose, and acknowledgment handling is added to the server receive loop. [1] [2] [3] [4] [5] [6] [7] [8] [9]sent_bundlesreference so that broadcasted bundles are tracked for acknowledgment. [1] [2] [3] [4] [5]Change Coalescing and Stability:
Most important changes:
Protocol and Metadata:
change_sequencetoFileMetadataand a newChangeAcknowledgmentmessage to the protocol, incrementingPROTOCOL_VERSIONto 7. [1] [2] [3]change_sequence. [1] [2] [3] [4] [5]Client acknowledgment logic:
ChangeAcknowledgmentmessage to the server, listing all sequence numbers in the bundle.Server acknowledgment tracking:
BundleTrackingstruct andsent_bundlesmap, recording acknowledgments as they arrive. [1] [2] [3]Bundle broadcasting and tracking:
sent_bundlesthroughout the server's change flush logic. [1] [2] [3] [4]Change coalescing: