libzypp 17.37.17
|
#include <zypp-core/zyppng/rpc/stompframestream.h>
Public Types | |
using | Ptr = StompFrameStreamRef |
Public Types inherited from zyppng::Base | |
using | Ptr = std::shared_ptr<Base> |
using | WeakPtr = std::weak_ptr<Base> |
Public Member Functions | |
std::optional< zypp::PluginFrame > | nextMessage (const std::string &msgName="") |
std::optional< zypp::PluginFrame > | nextMessageWait (const std::string &msgName="") |
bool | sendFrame (const zypp::PluginFrame &message) |
template<typename T> | |
bool | sendMessage (const T &message) |
void | readAllMessages () |
SignalProxy< void()> | sigMessageReceived () |
SignalProxy< void()> | sigInvalidMessageReceived () |
Public Member Functions inherited from zyppng::Base | |
Base () | |
virtual | ~Base () |
WeakPtr | parent () const |
void | addChild (const Base::Ptr &child) |
void | removeChild (const Ptr &child) |
const std::unordered_set< Ptr > & | children () const |
std::thread::id | threadId () const |
template<typename T> | |
std::vector< std::weak_ptr< T > > | findChildren () const |
template<typename T> | |
std::shared_ptr< T > | shared_this () const |
template<typename T> | |
std::shared_ptr< T > | shared_this () |
template<typename T> | |
std::weak_ptr< T > | weak_this () const |
template<typename T> | |
std::weak_ptr< T > | weak_this () |
template<typename SenderFunc, typename ReceiverFunc> | |
auto | connect (SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc, typename ReceiverFunc, typename ... Tracker> | |
std::enable_if_t< std::is_member_function_pointer_v< SenderFunc >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Static Public Member Functions | |
static Ptr | create (IODevice::Ptr iostr) |
template<class T> | |
static expected< T > | parseMessage (const zypp::PluginFrame &m) |
Static Public Member Functions inherited from zyppng::Base | |
template<typename Obj, typename Functor> | |
static decltype(auto) | make_base_slot (Obj *o, Functor &&f) |
template<typename SenderFunc, typename ReceiverFunc> | |
static auto | connect (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc, typename ReceiverFunc, typename ... Tracker> | |
static auto | connectFunc (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Private Types | |
enum | ParserState { ReceiveCommand , ReceiveHeaders , ReceiveBody , ParseError } |
Private Member Functions | |
StompFrameStream (IODevice::Ptr iostr) | |
bool | readNextMessage () |
void | timeout (const zyppng::Timer &) |
Private Attributes | |
enum zyppng::StompFrameStream::ParserState | _parserState = ReceiveCommand |
std::optional< zypp::PluginFrame > | _pendingMessage |
std::optional< int64_t > | _pendingBodyLen |
IODevice::Ptr | _ioDev |
Timer::Ptr | _nextMessageTimer = Timer::create() |
std::deque< zypp::PluginFrame > | _messages |
Signal< void()> | _sigNextMessage |
Signal< void()> | _sigInvalidMessageReceived |
Additional Inherited Members | |
Protected Member Functions inherited from zyppng::Base | |
Base (BasePrivate &dd) | |
Protected Attributes inherited from zyppng::Base | |
std::unique_ptr< BasePrivate > | d_ptr |
Implements the basic protocol for sending zypp RPC messages over a IODevice using the STOMP frame format as message type.
Definition at line 94 of file stompframestream.h.
using zyppng::StompFrameStream::Ptr = StompFrameStreamRef |
Definition at line 98 of file stompframestream.h.
|
private |
Enumerator | |
---|---|
ReceiveCommand | |
ReceiveHeaders | |
ReceiveBody | |
ParseError |
Definition at line 174 of file stompframestream.h.
|
private |
Definition at line 27 of file stompframestream.cc.
|
inlinestatic |
Uses the given iostream to send and receive messages. If the device is already open and readable tries to read messages right away. So make sure to check if messages have already been received via nextMessage
Definition at line 105 of file stompframestream.h.
std::optional< zypp::PluginFrame > zyppng::StompFrameStream::nextMessage | ( | const std::string & | msgName = "" | ) |
Returns the next message in the queue, wait for the sigMessageReceived signal to know when new messages have arrived. If msgName is specified returns the next message in the queue that matches the msgName
Definition at line 217 of file stompframestream.cc.
std::optional< zypp::PluginFrame > zyppng::StompFrameStream::nextMessageWait | ( | const std::string & | msgName = "" | ) |
Waits until at least one message is in the queue and returns it. Will return a empty optional if a error occurs.
If msgName is set this will block until a message with the given message name arrives and returns it
Definition at line 259 of file stompframestream.cc.
bool zyppng::StompFrameStream::sendFrame | ( | const zypp::PluginFrame & | message | ) |
Send out a PluginFrame to the other side, depending on the underlying device state this will be buffered and send when the device is writeable again.
Definition at line 292 of file stompframestream.cc.
|
inline |
Definition at line 133 of file stompframestream.h.
|
inlinestatic |
Definition at line 148 of file stompframestream.h.
void zyppng::StompFrameStream::readAllMessages | ( | ) |
Reads all messages from the underlying IO Device, this is usually called automatically but when shutting down this can be used to process all remaining messages.
Definition at line 320 of file stompframestream.cc.
SignalProxy< void()> zyppng::StompFrameStream::sigMessageReceived | ( | ) |
Emitted when new messages have arrived. This will continuously be emitted as long as messages are in the queue.
Definition at line 310 of file stompframestream.cc.
SignalProxy< void()> zyppng::StompFrameStream::sigInvalidMessageReceived | ( | ) |
Signal is emitted every time there was data on the line that could not be parsed
Definition at line 315 of file stompframestream.cc.
|
private |
Definition at line 37 of file stompframestream.cc.
|
private |
Definition at line 208 of file stompframestream.cc.
|
private |
|
private |
Definition at line 181 of file stompframestream.h.
|
private |
Definition at line 182 of file stompframestream.h.
|
private |
Definition at line 184 of file stompframestream.h.
|
private |
Definition at line 185 of file stompframestream.h.
|
private |
Definition at line 186 of file stompframestream.h.
|
private |
Definition at line 187 of file stompframestream.h.
|
private |
Definition at line 188 of file stompframestream.h.