FiberSelectReader

Constructors

this
this(IInputDevice input, SelectFiber fiber, IOWarning warning_e, IOError error_e, size_t buffer_size)

Constructor.

this
this(typeof(super) other, size_t buffer_size)

Constructor

Members

Aliases

Consumer
alias Consumer = size_t delegate(void[] data)

Consumer callback delegate type

IInputDevice
alias IInputDevice = .IInputDevice

Input device

Functions

consume
bool consume(Consumer consume)

Invokes consume with the data that are currently available and haven't yet been consumed. If the amount of data is sufficient, consume must return the number of bytes it consumed. Otherwise if consume consumed all data and needs more input data to be read from the I/O device, it must return a value greater than the number of data bytes passed to it.

consumed_data
void[] consumed_data()
read
typeof(this) read(T value)

Reads T.sizeof bytes from the socket and writes it to 'value' Suspends if not enough data is available and resumes when the data became available

readConsume
typeof(this) readConsume(Consumer consume)

Reads data from the input conduit, appends it to the data buffer and invokes consume with the data that is currently available and hasn't yet been consumed. If consume feels that the amount of data passed to it is sufficient, it must return the number of bytes it consumed. Otherwise if consume consumed all the data and still needs more input data to be read from the I/O device, it must return a value greater than length of the the data passed to it. The fiber is then suspended to wait for more data to be available from the input device, and consume is invoked again with the newly available data.

readRaw
typeof(this) readRaw(ubyte[] data_out)

Reads data.length bytes from the socket and writes them to the array.

receive
size_t receive()

Reads data from the input conduit and appends them to the data buffer, waiting for data to be read from the input conduit if

remaining_data
void[] remaining_data()
reset
typeof(this) reset()

Resets the amount of consumed/available data to 0.

transmit
bool transmit(Event events)

Reads data from the input conduit and appends them to the data buffer.

Static variables

default_buffer_size
size_t default_buffer_size;

Default input buffer size (16 kB).

Inherited Members

From IFiberSelectProtocol

SelectFiber
alias SelectFiber = .SelectFiber

Local aliases

IOWarning
alias IOWarning = .IOWarning
Undocumented in source.
IOError
alias IOError = .IOError
Undocumented in source.
conduit
ISelectable conduit;

I/O device

events_
Event events_;

Events to register the I/O device for.

warning_e
IOWarning warning_e;

IOWarning exception instance

error_e
IOError error_e;

IOError exception instance

fileHandle
Handle fileHandle()
events
Event events()
error_code
int error_code()
handle
bool handle(Event events)

Resumes the fiber coroutine and handle the events reported for the conduit. The fiber must be suspended (HOLD state).

transmitLoop
void transmitLoop()

Registers this instance in the select dispatcher and repeatedly calls transmit() until the transmission is finished.

transmit
bool transmit(Event events)

Reads/writes data from/to super.conduit for which events have been reported.

Meta