mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
* Add offset writes and file size support to NonBlockingFileIO Motivation: NonBlockingFileIO currently only supports writes from 0 or appending, if opened with O_APPEND. To facilitate random read/write file access the API needs to evolve. Modifications: - Add toOffset function parameter to write for offset file write access - Add changeFileSize function for growing or shrinking the file - Add readFileSize function for asynchronously reading the file size Result: - Improve API for random access scenarios - Provide method for reading and writing file size * Conform to code review * Formatting * Update Sources/NIO/NonBlockingFileIO.swift Co-Authored-By: Johannes Weiss <johannesweiss@apple.com> * Update Sources/NIO/NonBlockingFileIO.swift Co-Authored-By: Johannes Weiss <johannesweiss@apple.com> * Modify offset handling to support partial writes. Clean up stray comment. * Fix precondition check within offset pwrite handling * Improve guard for readability * White space cleanup * Single spacing issue Co-authored-by: Johannes Weiss <johannesweiss@apple.com>