Skip to content

Add cancellable File::file_sync operations. - #26

Merged
samuel-williams-shopify merged 1 commit into
mainfrom
feat/file-sync
Oct 17, 2026
Merged

samuel-williams-shopify merged 1 commit into
mainfrom
feat/file-sync

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Generic File consumers can now explicitly synchronize completed writes through file_sync(file, mode, cancellation).await. SyncMode::All requests contents and metadata; SyncMode::Data permits omitting metadata unrelated to retrieving the contents.

Linux io_uring uses native Fsync requests and checks opcode support during initialization. Buffer-free synchronization requests share submission, cancellation, and terminal-completion tracking with transfers. Readiness and Tokio use sync_all/sync_data on their existing file-operation pools, while the in-memory implementation completes immediately without modeling crash durability.

The operation is lazy, reports OS completion and errors, leaves the cursor unchanged, and retains the file through backend access even if its waiter disappears. Blocking workers check cancellation before execution; started calls preserve their result. Ring cancellation is best effort and successful completion wins a concurrent cancellation request. Callers must await preceding writes; synchronization does not order concurrent work, flush application buffers, or synchronize a parent directory entry.

This adds a required method to File, so external implementations must supply it. Update the design, public documentation, and release notes alongside shared backend contracts and cancellation/resource-lifetime coverage.

@samuel-williams-shopify
samuel-williams-shopify merged commit 75e3ada into main Oct 17, 2026
23 of 34 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the feat/file-sync branch October 17, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant