Skip to content

Input wanted: move queueRead and queueWrite to AbstractIoUringChannel? #24

@bbeaupain

Description

@bbeaupain

Looking for some input on this one!

When initially designing the project, I decided to place the main I/O methods in the IoUring class like so:

  • ring.queueRead(channel, buffer)
  • ring.queueWrite(channel, buffer)

Where a channel could be backed by either a socket or a file. This felt like it more closely matched what's happening under the hood in the native layer, where all reading/writing is queued, and only executes when the ring executes.

Recently, @ohpauleez made a contribution that allows for reading/writing files with offsets in the destination file - including a third parameter to the above methods, called offset. This is a great addition, but the call will explode if made with a channel that is backed by a socket instead of a file.

Proposing moving the I/O queuing methods to the specific channel implementation, instead of the ring:

  • channel.queueRead(ring, buffer) // also possibly "offset" for File-specific channel implementations
  • channel.queueWrite(ring, buffer)

This requires an API change, but removes a potential foot-gun for usage situations. I think this is a worthwhile change, but open to other input or suggestions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions