folly::AsyncReader::ReadCallback

Callback interface used to receive data read from the transport.

Synopsis

Declared in <folly/io/async/AsyncTransport.h>

class ReadCallback;

Types

NameDescription
ZeroCopyMemStore Memory store supplying and reclaiming buffers for zero-copy reads.

Enums

NameDescription
ReadMode Strategy used to deliver read data to the callback.

Member Functions

NameDescription
~ReadCallback [destructor] [virtual]Destroy the read callback.
getReadBuffer [virtual]It is possible that in some cases, getReadBuffer() may be called multiple times before readDataAvailable() is invoked. In this case, the data will be written to the buffer returned from the most recent call to readDataAvailable(). If the previous calls to readDataAvailable() returned different buffers, the ReadCallback is responsible for ensuring that they are not leaked.
getReadBuffers [virtual]It is possible that in some cases, getReadBuffers() may be called multiple times before readDataAvailable() is invoked. In this case, the data will be written to the buffer returned from the most recent call to readDataAvailable(). If the previous calls to readDataAvailable() returned different buffers, the ReadCallback is responsible for ensuring that they are not leaked.
getReadMode Return the current read mode.
getZeroCopyFallbackBuffer [virtual]Get a buffer to read data into when using zero-copy reads if some data cannot be read using a zero-copy page.
isBufferMovable [virtual]When data becomes available, isBufferMovable() will be invoked to figure out which API will be used, readBufferAvailable() or readDataAvailable(). If isBufferMovable() returns true, that means ReadCallback supports the IOBuf ownership transfer and readBufferAvailable() will be used. Otherwise, not.
maxBufferSize [virtual]Suggested buffer size, allocated for read operations, if callback is movable and supports folly::IOBuf
readBufferAvailable [virtual]readBufferAvailable() will be invoked when data has been successfully read.
readDataAvailable [virtual]readDataAvailable() will be invoked when data has been successfully read into the buffer(s) returned by the last call to getReadBuffer()/getReadBuffers()
readEOF [virtual]readEOF() will be invoked when the transport is closed.
readErr [virtual]readError() will be invoked if an error occurs reading from the transport.
readZeroCopyDataAvailable [virtual]readZeroCopyDataAvailable() will be called when data is available from a zero-copy read.
readZeroCopyEnabled [virtual]Return a ZeroCopyMemStore to use if the callback would like to enable zero-copy reads. Return nullptr to disable zero-copy reads.
setReadMode Set the read mode used to deliver data to this callback.

Protected Data Members

NameDescription
readMode_ Current read mode.

Derived Classes

NameDescription
DefaultOpenSSLAsyncFinishCallback A class to wait for asynchronous operations with OpenSSL 1.1.0
ReadCallback Handles data reads for an AsyncTransport.