-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving PooledRecvBufferAllocator
from NIOPosix to NIOCore
#3110
base: main
Are you sure you want to change the base?
Conversation
@@ -58,7 +61,7 @@ internal struct PooledRecvBufferAllocator { | |||
} | |||
|
|||
/// Update the capacity of the underlying buffer pool. | |||
mutating func updateCapacity(to newCapacity: Int) { | |||
public mutating func updateCapacity(to newCapacity: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update the docs for this and the other public
methods to include a list of arguments (i.e. the Parameters
keyword as in the public init
above)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the missing documentation. Let me know if you think I should change anything else.
@@ -12,10 +12,8 @@ | |||
// | |||
//===----------------------------------------------------------------------===// | |||
|
|||
import NIOCore | |||
|
|||
/// A receive buffer allocator which cycles through a pool of buffers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should extend this to express when users might want to use this type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this addition to the comment accurate and sufficient: This type is useful when allocating new buffers for every IO read is expensive or undesirable.
?
Moving
PooledRecvBufferAllocator
from NIOPosix to NIOCore, making it part of its public interface.Motivation:
We want to introduce the capability of reusing receiving buffers from a pool into swift-nio-transport-services project. To prevent duplicating this functionality there, this change is making the existing functionality from NIO part of its public API.
Modifications:
Moved the type
PooledRecvBufferAllocator
from NIOPosix module to NIOCore and turned it into a public type.Result:
PooledRecvBufferAllocator
is part of NIOCore public API.