FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::venues::RestChannel Class Reference

#include <fastmm/venues/rest_channel.hpp>

Public Types

using Callback = net::HttpResponseCallback
 
using PlainClient = net::HttpClient< net::PlainStream >
 
using TlsClient = net::HttpClient< net::TlsStream< net::PlainStream > >
 

Public Member Functions

 RestChannel (net::Reactor &reactor, RestChannelConfig cfg)
 
 ~RestChannel ()
 
 RestChannel (const RestChannel &)=delete
 
RestChannel & operator= (const RestChannel &)=delete
 
bool request (std::string_view method, std::string_view target, std::string_view extra_headers, std::string_view body, Callback cb)
 target is the path plus query without the base prefix.
 
bool request (std::string_view method, net::HttpTargetMaker make_target, std::string_view extra_headers, std::string_view body, Callback cb)
 The same, with the target (without the base prefix) made when the request is written, not when it is queued: a signed query is stamped and signed then, however long it waited behind the requests ahead of it on the one connection (net::HttpClient).
 
void schedule_reset ()
 Drops the connection (deferred to the reactor loop so it is safe from callbacks).
 
void reset () noexcept
 
void set_max_queue (std::size_t n) noexcept
 For a subscription that grew after connect: see rest_queue_for().
 
bool connected () const noexcept
 
std::size_t queued () const noexcept
 Requests queued on the connection, the one in flight included.
 
std::size_t max_queue () const noexcept
 
std::uint64_t requests () const noexcept
 
std::uint64_t errors () const noexcept
 
const std::string & host () const noexcept
 
bool tls () const noexcept
 

Member Typedef Documentation

◆ Callback

◆ PlainClient

◆ TlsClient

using fastmm::venues::RestChannel::TlsClient = net::HttpClient<net::TlsStream<net::PlainStream> >

Constructor & Destructor Documentation

◆ RestChannel() [1/2]

fastmm::venues::RestChannel::RestChannel ( net::Reactor &  reactor,
RestChannelConfig  cfg 
)
inline

◆ ~RestChannel()

fastmm::venues::RestChannel::~RestChannel ( )
inline

◆ RestChannel() [2/2]

fastmm::venues::RestChannel::RestChannel ( const RestChannel &  )
delete

Member Function Documentation

◆ operator=()

RestChannel & fastmm::venues::RestChannel::operator= ( const RestChannel &  )
delete

◆ request() [1/2]

bool fastmm::venues::RestChannel::request ( std::string_view  method,
std::string_view  target,
std::string_view  extra_headers,
std::string_view  body,
Callback  cb 
)
inline

target is the path plus query without the base prefix.

The callback runs on the reactor thread; a transport failure arrives as HttpResponse::error != None. Returns false when the request could not even be queued (resolve/connect failure, queue full).

◆ request() [2/2]

bool fastmm::venues::RestChannel::request ( std::string_view  method,
net::HttpTargetMaker  make_target,
std::string_view  extra_headers,
std::string_view  body,
Callback  cb 
)
inline

The same, with the target (without the base prefix) made when the request is written, not when it is queued: a signed query is stamped and signed then, however long it waited behind the requests ahead of it on the one connection (net::HttpClient).

Empty: not sent, the callback gets NetError::Canceled.

◆ schedule_reset()

void fastmm::venues::RestChannel::schedule_reset ( )
inline

Drops the connection (deferred to the reactor loop so it is safe from callbacks).

◆ reset()

void fastmm::venues::RestChannel::reset ( )
inlinenoexcept

◆ set_max_queue()

void fastmm::venues::RestChannel::set_max_queue ( std::size_t  n)
inlinenoexcept

For a subscription that grew after connect: see rest_queue_for().

◆ connected()

bool fastmm::venues::RestChannel::connected ( ) const
inlinenoexcept

◆ queued()

std::size_t fastmm::venues::RestChannel::queued ( ) const
inlinenoexcept

Requests queued on the connection, the one in flight included.

◆ max_queue()

std::size_t fastmm::venues::RestChannel::max_queue ( ) const
inlinenoexcept

◆ requests()

std::uint64_t fastmm::venues::RestChannel::requests ( ) const
inlinenoexcept

◆ errors()

std::uint64_t fastmm::venues::RestChannel::errors ( ) const
inlinenoexcept

◆ host()

const std::string & fastmm::venues::RestChannel::host ( ) const
inlinenoexcept

◆ tls()

bool fastmm::venues::RestChannel::tls ( ) const
inlinenoexcept