[NIOFileSystem] Provide an API to specify allowing unlimited sized reads#2914
Merged
glbrntt merged 3 commits intoOct 11, 2024
Merged
Conversation
Motivation: As described in issue [apple#2877](apple#2877), there is no API available to specify allowing a read of unlimited size. Modifications: - Add a new `public static` property, `unlimited`, to `ByteCount` representing an unlimited amount of bytes. - Adapt `ReadableFileHandleProtocol.readToEnd(fromAbsoluteOffset:maximumSizeAllowed:)` to work with `maximumSizeAllowed` being `ByteCount.unlimited`. Result: An API to specify allowing a read of an unlimited size will be available.
glbrntt
requested changes
Oct 11, 2024
Contributor
glbrntt
left a comment
There was a problem hiding this comment.
One nit but looks great otherwise
Comment on lines
+338
to
+341
| var maximumSizeAllowed = maximumSizeAllowed | ||
| if maximumSizeAllowed == .unlimited { | ||
| maximumSizeAllowed = .byteBufferCapacity | ||
| } |
Contributor
There was a problem hiding this comment.
We can do this in a one line to keep maximumSizeAllowed constant:
let maximumSizeAllowed = maximumSizeAllowed == .unlimited ? .byteBufferCapacity : maximumSizeAllowed
glbrntt
approved these changes
Oct 11, 2024
weissi
reviewed
Oct 14, 2024
| } | ||
| } | ||
|
|
||
| func XCTAssertNoThrowAsync<T>( |
Member
There was a problem hiding this comment.
we shouldn't squat on XCTest's XCT* name space, you can make it NIOAssertNoThrowAsync or smth
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.
Motivation:
As described in issue #2877, there is no API available to specify allowing a read of unlimited size.
Modifications:
public staticproperty,unlimited, toByteCountrepresenting an unlimited amount of bytes.ReadableFileHandleProtocol.readToEnd(fromAbsoluteOffset:maximumSizeAllowed:)to work withmaximumSizeAllowedbeingByteCount.unlimited.Result:
An API to specify allowing a read of an unlimited size will be available.