completeIO(for:offset:length:status:flags:operationID:replyHandler:)
Completes an I/O operation for a given file.
Declaration
func completeIO(for file: FSItem, offset: off_t, length: Int, status: any Error, flags: FSCompleteIOFlags, operationID: FSOperationID, replyHandler reply: @escaping @Sendable ((any Error)?) -> Void)func completeIO(for file: FSItem, offset: off_t, length: Int, status: any Error, flags: FSCompleteIOFlags, operationID: FSOperationID) async throwsParameters
- file:
The file for which the I/O operation completed.
- offset:
The starting logical offset at which I/O started.
- length:
The length of the I/O range (in bytes).
- status:
Any error that occurred during the operation. If no error occurred, this parameter is
nil. - flags:
Flags that affect the behavior of the complete I/O operation.
- operationID:
A unique identifier of the blockmap call. Any value other than
0(Objective-C) or Unspecified (Swift) corresponds to a previous call to Blockmapfile(_:offset:length:flags:operationid:packer:replyhandler:) with the sameoperationID. - reply:
A block or closure to indicate success or failure. If completing I/O fails, pass an error as the one parameter to the reply handler. If completing I/O succeeds, pass
nil. For anasyncSwift implementation, there’s no reply handler; simply throw an error or return normally.
Discussion
Implement this method by updating a file’s metadata, such as its size and modification time.
FSKit may call this method without an earlier call to blockmapFile(_:offset:length:flags:operationID:packer:replyHandler:). In this case, the operationID is 0 (Objective-C) or unspecified (Swift).