Claims room for a message of data_bytes bytes and returns (success, reserved); write the payload into
reserved.user_write_pointer, then call writer_commit_message. Nothing is visible to the reader until the commit.
It does not wait. It fails (success is false) when the ring has no room right now, in which case try again after
the reader has caught up; when the message could never fit (more than the ring's capacity less 16 bytes); when
data_bytes is negative; when the reader has disconnected; or when the channel is corrupt. At the end of the ring a message
that does not fit moves to the start, and the gap is skipped by the reader. data_bytes of 0 is a valid, empty message.
Reserving again before committing hands out the same space, so use one reservation at a time.
writer_reserve_message :: (
channel: *Write_Channel,
data_bytes: s64
) -> (success: bool, reserved: Reserved_Message)
Claims room for a message of data_bytes bytes and returns (success, reserved); write the payload into
reserved.user_write_pointer, then call writer_commit_message. Nothing is visible to the reader until the commit.
It does not wait. It fails (success is false) when the ring has no room right now, in which case try again after
the reader has caught up; when the message could never fit (more than the ring's capacity less 16 bytes); when
data_bytes is negative; when the reader has disconnected; or when the channel is corrupt. At the end of the ring a message
that does not fit moves to the start, and the gap is skipped by the reader. data_bytes of 0 is a valid, empty message.
Reserving again before committing hands out the same space, so use one reservation at a time.
Parameters
- channel: *Write_Channel
- data_bytes: s64
Returns
- success: bool
- reserved: Reserved_Message