cpp_redis  4.0.0
cpp_redis is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations and pipelining.
Classes | Public Types | Public Member Functions | List of all members
cpp_redis::network::tcp_client_iface Class Referenceabstract

#include <tcp_client_iface.hpp>

Inheritance diagram for cpp_redis::network::tcp_client_iface:
cpp_redis::network::tcp_client

Classes

struct  read_request
 
struct  read_result
 
struct  write_request
 
struct  write_result
 

Public Types

typedef std::function< void(read_result &)> async_read_callback_t
 
typedef std::function< void(write_result &)> async_write_callback_t
 
typedef std::function< void()> disconnection_handler_t
 

Public Member Functions

 tcp_client_iface (void)=default
 ctor
 
virtual ~tcp_client_iface (void)=default
 dtor
 
virtual void connect (const std::string &addr, std::uint32_t port, std::uint32_t timeout_msecs=0)=0
 
virtual void disconnect (bool wait_for_removal=false)=0
 
virtual bool is_connected (void) const =0
 
virtual void async_read (read_request &request)=0
 
virtual void async_write (write_request &request)=0
 
virtual void set_on_disconnection_handler (const disconnection_handler_t &disconnection_handler)=0
 

Detailed Description

interface defining how tcp client should be implemented to be used inside cpp_redis

Member Typedef Documentation

◆ async_read_callback_t

async read completion callbacks function taking read_result as a parameter

◆ async_write_callback_t

async write completion callbacks function taking write_result as a parameter

◆ disconnection_handler_t

disconnection handler

Member Function Documentation

◆ async_read()

virtual void cpp_redis::network::tcp_client_iface::async_read ( read_request request)
pure virtual

async read operation

Parameters
requestinformation about what should be read and what should be done after completion

Implemented in cpp_redis::network::tcp_client.

◆ async_write()

virtual void cpp_redis::network::tcp_client_iface::async_write ( write_request request)
pure virtual

async write operation

Parameters
requestinformation about what should be written and what should be done after completion

Implemented in cpp_redis::network::tcp_client.

◆ connect()

virtual void cpp_redis::network::tcp_client_iface::connect ( const std::string &  addr,
std::uint32_t  port,
std::uint32_t  timeout_msecs = 0 
)
pure virtual

start the tcp client

Parameters
addrhost to be connected to
portport to be connected to
timeout_msecsmax time to connect in ms

Implemented in cpp_redis::network::tcp_client.

◆ disconnect()

virtual void cpp_redis::network::tcp_client_iface::disconnect ( bool  wait_for_removal = false)
pure virtual

stop the tcp client

Parameters
wait_for_removalwhen sets to true, disconnect blocks until the underlying TCP client has been effectively removed from the io_service and that all the underlying callbacks have completed.

Implemented in cpp_redis::network::tcp_client.

◆ is_connected()

virtual bool cpp_redis::network::tcp_client_iface::is_connected ( void  ) const
pure virtual
Returns
whether the client is currently connected or not

Implemented in cpp_redis::network::tcp_client.

◆ set_on_disconnection_handler()

virtual void cpp_redis::network::tcp_client_iface::set_on_disconnection_handler ( const disconnection_handler_t disconnection_handler)
pure virtual

set on disconnection handler

Parameters
disconnection_handlerhandler to be called in case of a disconnection

Implemented in cpp_redis::network::tcp_client.


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