25#ifndef JOIN_CORE_IO_OPERATION_HPP
26#define JOIN_CORE_IO_OPERATION_HPP
35#include <sys/socket.h>
41 class CompletionHandler;
221 bool linked =
false) noexcept;
233 bool linked = false) noexcept;
246 bool linked = false) noexcept;
292 bool linked =
false) noexcept;
316 bool linked = false) noexcept;
347 bool linked =
false) noexcept;
370 bool linked = false) noexcept;
386 int fd () const noexcept;
completion handler interface class.
Definition proactor.hpp:79
pool of buffers provided to the I/O backend.
Definition io_ring_buffer.hpp:49
Definition acceptor.hpp:32
payload for accept.
Definition io_operation.hpp:129
socklen_t * addrlen
peer address length.
Definition io_operation.hpp:137
int fd
file descriptor.
Definition io_operation.hpp:131
int flags
accept flags.
Definition io_operation.hpp:140
sockaddr * addr
peer address.
Definition io_operation.hpp:134
payload for connect.
Definition io_operation.hpp:168
const sockaddr * addr
remote address.
Definition io_operation.hpp:173
socklen_t addrlen
address length.
Definition io_operation.hpp:176
int fd
file descriptor.
Definition io_operation.hpp:170
payload for sendmsg / recvmsg.
Definition io_operation.hpp:265
int flags
sendmsg / recvmsg flags.
Definition io_operation.hpp:273
uint32_t namelen
reserved name area length.
Definition io_operation.hpp:276
msghdr * msg
message header.
Definition io_operation.hpp:270
uint32_t controllen
reserved control area length.
Definition io_operation.hpp:279
int fd
file descriptor.
Definition io_operation.hpp:267
payload for poll.
Definition io_operation.hpp:99
uint32_t events
requested events.
Definition io_operation.hpp:104
int fd
file descriptor.
Definition io_operation.hpp:101
payload for read / read fixed / write / write fixed.
Definition io_operation.hpp:194
unsigned long len
number of bytes to transfer.
Definition io_operation.hpp:202
bool fixed
use registered buffer (ignored with reactor backend).
Definition io_operation.hpp:208
uint16_t index
registered buffer index (ignored with reactor backend).
Definition io_operation.hpp:205
int fd
file descriptor.
Definition io_operation.hpp:196
void * buf
buffer.
Definition io_operation.hpp:199
payload for recv / send.
Definition io_operation.hpp:322
int fd
file descriptor.
Definition io_operation.hpp:324
unsigned long len
number of bytes to transfer.
Definition io_operation.hpp:330
int flags
send / recv flags.
Definition io_operation.hpp:333
void * buf
buffer.
Definition io_operation.hpp:327
Describes a single asynchronous operation submitted to the Proactor.
Definition io_operation.hpp:47
bool linked
link this SQE to the next one (next executes only if this succeeds, io_uring only).
Definition io_operation.hpp:401
static IoOperation makeWrite(int fd, const void *buf, uint32_t len, CompletionHandler *handler, bool linked=false) noexcept
build a regular write operation.
Definition io_operation.cpp:170
bool more
true while a multishot operation stays armed.
Definition io_operation.hpp:407
uint16_t group
provided buffer group.
Definition io_operation.hpp:410
static IoOperation makeSendmsg(int fd, const msghdr *msg, int flags, CompletionHandler *handler, bool linked=false) noexcept
build a send-message operation.
Definition io_operation.cpp:263
static IoOperation makeConnect(int fd, const sockaddr *addr, socklen_t addrlen, CompletionHandler *handler) noexcept
build a connect operation.
Definition io_operation.cpp:136
static IoOperation makeSend(int fd, const void *buf, uint32_t len, int flags, CompletionHandler *handler, bool linked=false) noexcept
build a send operation.
Definition io_operation.cpp:316
static IoOperation makeReadFixed(int fd, void *buf, uint32_t len, uint16_t index, CompletionHandler *handler, bool linked=false) noexcept
build a fixed-buffer read operation.
Definition io_operation.cpp:189
static IoOperation makeRecvMulti(int fd, uint16_t group, int flags, CompletionHandler *handler) noexcept
build a multishot receive operation.
Definition io_operation.cpp:298
static IoOperation makeWriteFixed(int fd, const void *buf, uint32_t len, uint16_t index, CompletionHandler *handler, bool linked=false) noexcept
build a fixed-buffer write operation.
Definition io_operation.cpp:208
uint32_t index
index of this operation in the proactor pending ops (io_uring only).
Definition io_operation.hpp:398
static IoOperation makeRead(int fd, void *buf, uint32_t len, CompletionHandler *handler, bool linked=false) noexcept
build a regular read operation.
Definition io_operation.cpp:152
static IoOperation makePollMulti(int fd, uint32_t events, CompletionHandler *handler) noexcept
build a multishot poll operation, staying armed until cancelled or failed.
Definition io_operation.cpp:87
static IoOperation makeRecvmsgMulti(int fd, uint16_t group, msghdr *msg, int flags, CompletionHandler *handler) noexcept
build a multishot receive-message operation.
Definition io_operation.cpp:243
static IoOperation makeAccept(int fd, sockaddr *addr, socklen_t *addrlen, int flags, CompletionHandler *handler) noexcept
build an accept operation.
Definition io_operation.cpp:102
Data data
operation code specific payload.
Definition io_operation.hpp:416
State
operation lifecycle state.
Definition io_operation.hpp:52
static IoOperation makeRecvmsg(int fd, msghdr *msg, int flags, CompletionHandler *handler, bool linked=false) noexcept
build a receive-message operation.
Definition io_operation.cpp:227
bool multishot
rearm the operation after each completion.
Definition io_operation.hpp:404
static IoOperation makeAcceptMulti(int fd, int flags, CompletionHandler *handler) noexcept
build a multishot accept operation.
Definition io_operation.cpp:119
CompletionHandler * handler
handler to dispatch to on completion.
Definition io_operation.hpp:413
std::atomic< State > state
operation state.
Definition io_operation.hpp:392
static IoOperation makeRecv(int fd, void *buf, uint32_t len, int flags, CompletionHandler *handler, bool linked=false) noexcept
build a receive operation.
Definition io_operation.cpp:280
static IoOperation makePoll(int fd, uint32_t events, CompletionHandler *handler) noexcept
build a poll operation.
Definition io_operation.cpp:73
State resume
state to restore when the current hold is released.
Definition io_operation.hpp:395
IoOperation & operator=(const IoOperation &other) noexcept
copy assignment operator.
Definition io_operation.cpp:55
uint8_t code
operation code.
Definition io_operation.hpp:389
IoRingBuffer * ring
buffer ring bound to this operation.
Definition io_operation.hpp:419
IoOperation()=default
default constructor.
Opcode
operation code.
Definition io_operation.hpp:63
int fd() const noexcept
return the file descriptor associated with this operation.
Definition io_operation.cpp:334
Definition io_operation.hpp:373
RwData rw
Definition io_operation.hpp:377
MsgData msg
Definition io_operation.hpp:378
PollData poll
Definition io_operation.hpp:374
AcceptData accept
Definition io_operation.hpp:375
StreamData stream
Definition io_operation.hpp:379
ConnectData connect
Definition io_operation.hpp:376