userver: engine::io::RwBase Class Reference
Loading...
Searching...
No Matches
engine::io::RwBase Class Referenceabstract

#include <userver/engine/io/common.hpp>

Detailed Description

Interface for readable and writable streams

Definition at line 110 of file common.hpp.

+ Inheritance diagram for engine::io::RwBase:

Public Member Functions

ReadableBaseGetReadableBase ()
 
WritableBaseGetWritableBase ()
 
virtual bool IsValid () const =0
 Whether the stream is valid.
 
virtual bool WaitReadable (Deadline)=0
 Suspends current task until the stream has data available.
 
virtual std::optional< size_t > ReadNoblock (void *buf, size_t len)
 
virtual size_t ReadSome (void *buf, size_t len, Deadline deadline)=0
 Receives at least one byte from the stream.
 
virtual size_t ReadAll (void *buf, size_t len, Deadline deadline)=0
 
impl::ContextAccessor * TryGetContextAccessor ()
 For internal use only.
 
virtual bool WaitWriteable (Deadline deadline)=0
 Suspends current task until the data is available.
 
virtual size_t WriteAll (const void *buf, size_t len, Deadline deadline)=0
 Sends exactly len bytes of buf.
 
virtual size_t WriteAll (std::initializer_list< IoData > list, Deadline deadline)
 
impl::ContextAccessor * TryGetContextAccessor ()
 For internal use only.
 

Protected Member Functions

void SetReadableContextAccessor (impl::ContextAccessor *ca)
 
void SetWritableContextAccessor (impl::ContextAccessor *ca)
 

Member Function Documentation

◆ GetReadableBase()

ReadableBase & engine::io::RwBase::GetReadableBase ( )
inline

Definition at line 114 of file common.hpp.

◆ GetWritableBase()

WritableBase & engine::io::RwBase::GetWritableBase ( )
inline

Definition at line 116 of file common.hpp.

◆ IsValid()

virtual bool engine::io::ReadableBase::IsValid ( ) const
pure virtualinherited

Whether the stream is valid.

Implemented in engine::io::PipeReader, engine::io::Socket, and engine::io::TlsWrapper.

◆ ReadAll()

virtual size_t engine::io::ReadableBase::ReadAll ( void * buf,
size_t len,
Deadline deadline )
pure virtualinherited

Receives exactly len bytes from the stream.

Note
Can return less than len if stream is closed by peer.

Implemented in engine::io::PipeReader, engine::io::Socket, and engine::io::TlsWrapper.

◆ ReadNoblock()

virtual std::optional< size_t > engine::io::ReadableBase::ReadNoblock ( void * buf,
size_t len )
inlinevirtualinherited

Receives up to len (including zero) bytes from the stream.

Returns
filled-in optional on data presence (e.g. 0, 1, 2... bytes) empty optional otherwise

Reimplemented in engine::io::Socket.

Definition at line 39 of file common.hpp.

◆ ReadSome()

virtual size_t engine::io::ReadableBase::ReadSome ( void * buf,
size_t len,
Deadline deadline )
pure virtualinherited

Receives at least one byte from the stream.

Implemented in engine::io::PipeReader, engine::io::Socket, and engine::io::TlsWrapper.

◆ SetReadableContextAccessor()

void engine::io::ReadableBase::SetReadableContextAccessor ( impl::ContextAccessor * ca)
inlineprotectedinherited

Definition at line 60 of file common.hpp.

◆ SetWritableContextAccessor()

void engine::io::WritableBase::SetWritableContextAccessor ( impl::ContextAccessor * ca)
inlineprotectedinherited

Definition at line 100 of file common.hpp.

◆ TryGetContextAccessor() [1/2]

impl::ContextAccessor * engine::io::ReadableBase::TryGetContextAccessor ( )
inlineinherited

For internal use only.

Definition at line 57 of file common.hpp.

◆ TryGetContextAccessor() [2/2]

impl::ContextAccessor * engine::io::WritableBase::TryGetContextAccessor ( )
inlineinherited

For internal use only.

Definition at line 97 of file common.hpp.

◆ WaitReadable()

virtual bool engine::io::ReadableBase::WaitReadable ( Deadline )
pure virtualinherited

Suspends current task until the stream has data available.

Implemented in engine::io::PipeReader, engine::io::Socket, and engine::io::TlsWrapper.

◆ WaitWriteable()

virtual bool engine::io::WritableBase::WaitWriteable ( Deadline deadline)
pure virtualinherited

Suspends current task until the data is available.

Implemented in engine::io::PipeWriter, engine::io::Socket, and engine::io::TlsWrapper.

◆ WriteAll() [1/2]

virtual size_t engine::io::WritableBase::WriteAll ( const void * buf,
size_t len,
Deadline deadline )
pure virtualinherited

Sends exactly len bytes of buf.

Note
Can return less than len if stream is closed by peer.

Implemented in engine::io::PipeWriter, engine::io::Socket, and engine::io::TlsWrapper.

◆ WriteAll() [2/2]

virtual size_t engine::io::WritableBase::WriteAll ( std::initializer_list< IoData > list,
Deadline deadline )
inlinevirtualinherited

Definition at line 87 of file common.hpp.


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