folly::AsyncWriter

Interface for the write side of an asynchronous transport.

Synopsis

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

class AsyncWriter;

Types

NameDescription
RXZerocopyParams Parameters controlling receive-side zero-copy.
ReleaseIOBufCallback Callback invoked to release ownership of an IOBuf after a write.
WriteCallback Callback interface used to report the result of a write.

Type Aliases

NameDescription
ZeroCopyEnableFunc Predicate deciding whether a given buffer should use zero-copy writes.

Member Functions

NameDescription
getRXZeroCopy [virtual]Return whether receive-side zero-copy is enabled.
getZeroCopy [virtual]Return whether zero-copy writes are enabled.
setRXZeroCopy [virtual]Enable or disable receive-side zero-copy using the given parameters.
setZeroCopy [virtual]Enable or disable zero-copy writes.
setZeroCopyEnableFunc [virtual]Set the predicate deciding when zero-copy writes are used.
setZeroCopyEnableThreshold [virtual]Set the minimum write size, in bytes, for using zero-copy writes.
write [virtual]If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.
writeChain [virtual]If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.
writev [virtual]If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.

Protected Member Functions

NameDescription
~AsyncWriter [destructor] [virtual]Destroy the writer.

Derived Classes

NameDescription
AsyncPipeWriter Write to a pipe in an async manner.
AsyncTransport AsyncTransport defines an asynchronous API for bidirectional streaming I/O.