proxygen
folly::WriteChainAsyncTransportWrapper< T > Class Template Referenceabstract

#include <WriteChainAsyncTransportWrapper.h>

Inheritance diagram for folly::WriteChainAsyncTransportWrapper< T >:
folly::DecoratedAsyncTransportWrapper< T > folly::AsyncTransportWrapper folly::AsyncTransport folly::AsyncReader folly::AsyncWriter folly::DelayedDestruction folly::AsyncSocketBase folly::DelayedDestructionBase

Public Member Functions

void write (folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags=folly::WriteFlags::NONE) override
 
void writev (folly::AsyncTransportWrapper::WriteCallback *callback, const iovec *vec, size_t count, folly::WriteFlags flags=folly::WriteFlags::NONE) override
 
void writeChain (folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override=0
 
- Public Member Functions inherited from folly::DecoratedAsyncTransportWrapper< T >
 DecoratedAsyncTransportWrapper (typename T::UniquePtr transport)
 
const AsyncTransportWrappergetWrappedTransport () const override
 
ReadCallbackgetReadCallback () const override
 
void setReadCB (folly::AsyncTransportWrapper::ReadCallback *callback) override
 
folly::EventBasegetEventBase () const override
 
void attachEventBase (folly::EventBase *eventBase) override
 
void close () override
 
void closeNow () override
 
void closeWithReset () override
 
bool connecting () const override
 
void detachEventBase () override
 
bool error () const override
 
size_t getAppBytesReceived () const override
 
size_t getAppBytesWritten () const override
 
void getLocalAddress (folly::SocketAddress *address) const override
 
void getPeerAddress (folly::SocketAddress *address) const override
 
folly::ssl::X509UniquePtr getPeerCert () const override
 
size_t getRawBytesReceived () const override
 
size_t getRawBytesWritten () const override
 
uint32_t getSendTimeout () const override
 
bool good () const override
 
bool isDetachable () const override
 
bool isEorTrackingEnabled () const override
 
bool readable () const override
 
bool writable () const override
 
void setEorTracking (bool track) override
 
void setSendTimeout (uint32_t timeoutInMs) override
 
void shutdownWrite () override
 
void shutdownWriteNow () override
 
std::string getApplicationProtocol () const noexceptoverride
 
std::string getSecurityProtocol () const override
 
bool isReplaySafe () const override
 
void setReplaySafetyCallback (folly::AsyncTransport::ReplaySafetyCallback *callback) override
 
const AsyncTransportCertificategetPeerCertificate () const override
 
const AsyncTransportCertificategetSelfCertificate () const override
 
- Public Member Functions inherited from folly::AsyncTransportWrapper
template<class T >
const TgetUnderlyingTransport () const
 
template<class T >
TgetUnderlyingTransport ()
 
- Public Member Functions inherited from folly::AsyncTransport
virtual bool isPending () const
 
SocketAddress getLocalAddress () const
 
void getAddress (SocketAddress *address) const override
 
SocketAddress getPeerAddress () const
 
virtual const X509 * getSelfCert () const
 
- Public Member Functions inherited from folly::DelayedDestruction
virtual void destroy ()
 
bool getDestroyPending () const
 
- Public Member Functions inherited from folly::DelayedDestructionBase
virtual ~DelayedDestructionBase ()=default
 
- Public Member Functions inherited from folly::AsyncSocketBase
virtual ~AsyncSocketBase ()=default
 

Additional Inherited Members

- Public Types inherited from folly::AsyncTransportWrapper
using UniquePtr = std::unique_ptr< AsyncTransportWrapper, Destructor >
 
using ReadCallback = AsyncReader::ReadCallback
 
using WriteCallback = AsyncWriter::WriteCallback
 
- Public Types inherited from folly::AsyncTransport
typedef std::unique_ptr< AsyncTransport, DestructorUniquePtr
 
- Protected Member Functions inherited from folly::DecoratedAsyncTransportWrapper< T >
 ~DecoratedAsyncTransportWrapper () override
 
- Protected Member Functions inherited from folly::AsyncTransport
 ~AsyncTransport () override=default
 
- Protected Member Functions inherited from folly::DelayedDestruction
 ~DelayedDestruction () override=default
 
 DelayedDestruction ()
 
- Protected Member Functions inherited from folly::DelayedDestructionBase
 DelayedDestructionBase ()
 
uint32_t getDestructorGuardCount () const
 
- Protected Member Functions inherited from folly::AsyncReader
virtual ~AsyncReader ()=default
 
- Protected Member Functions inherited from folly::AsyncWriter
virtual ~AsyncWriter ()=default
 
- Protected Attributes inherited from folly::DecoratedAsyncTransportWrapper< T >
T::UniquePtr transport_
 

Detailed Description

template<class T>
class folly::WriteChainAsyncTransportWrapper< T >

Helper class that redirects write() and writev() calls to writeChain().

Definition at line 28 of file WriteChainAsyncTransportWrapper.h.

Member Function Documentation

template<class T>
void folly::WriteChainAsyncTransportWrapper< T >::write ( folly::AsyncTransportWrapper::WriteCallback callback,
const void *  buf,
size_t  bytes,
folly::WriteFlags  flags = folly::WriteFlags::NONE 
)
inlineoverridevirtual

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.

Reimplemented from folly::DecoratedAsyncTransportWrapper< T >.

Definition at line 33 of file WriteChainAsyncTransportWrapper.h.

Referenced by folly::test::TEST().

37  {
38  auto ioBuf = folly::IOBuf::wrapBuffer(buf, bytes);
39  writeChain(callback, std::move(ioBuf), flags);
40  }
flags
Definition: http_parser.h:127
static std::unique_ptr< IOBuf > wrapBuffer(const void *buf, std::size_t capacity)
Definition: IOBuf.cpp:353
void writeChain(folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override=0
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class T>
void folly::WriteChainAsyncTransportWrapper< T >::writeChain ( folly::AsyncTransportWrapper::WriteCallback callback,
std::unique_ptr< folly::IOBuf > &&  buf,
folly::WriteFlags  flags = folly::WriteFlags::NONE 
)
overridepure virtual
template<class T>
void folly::WriteChainAsyncTransportWrapper< T >::writev ( folly::AsyncTransportWrapper::WriteCallback callback,
const iovec *  vec,
size_t  count,
folly::WriteFlags  flags = folly::WriteFlags::NONE 
)
inlineoverridevirtual

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.

Reimplemented from folly::DecoratedAsyncTransportWrapper< T >.

Definition at line 42 of file WriteChainAsyncTransportWrapper.h.

Referenced by folly::test::TEST().

46  {
47  auto writeBuffer = folly::IOBuf::wrapIov(vec, count);
48  writeChain(callback, std::move(writeBuffer), flags);
49  }
flags
Definition: http_parser.h:127
void writeChain(folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&buf, folly::WriteFlags flags=folly::WriteFlags::NONE) override=0
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
Definition: Traits.h:588
int * count
static std::unique_ptr< IOBuf > wrapIov(const iovec *vec, size_t count)
Definition: IOBuf.cpp:1027

The documentation for this class was generated from the following file: