|
MCSB
2.0.0
High-throughput shared memory middleware
|
A Client that receives messages reactively, via registration and callback. More...
#include <MCSB/Client.h>
Public Member Functions | |
| Client (const ClientOptions &co, bool connect=1) | |
| Construct from ClientOptions, optionally deferring connection attempt. | |
| Client (int argc, char *const argv[]) | |
| Construct from argc and argv. | |
| void | RegisterForMsgID (uint32_t msgID, MessageHandlerFunction mhf, void *arg=0) |
| Register a RecvMessageDescriptor callback function to handle received messages with the specified msgID. | |
| bool | DeregisterForMsgID (uint32_t msgID, MessageHandlerFunction mhf, void *arg=0) |
| Deregister a RecvMessageDescriptor callback function to no longer receive messages with the specified msgID. | |
| template<class T , void(T::*)(const RecvMessageDescriptor &desc) method> | |
| void | RegisterForMsgID (uint32_t msgID, T *object) |
| Register a RecvMessageDescriptor callback method to handle received messages with the specified msgID. | |
| template<class T , void(T::*)(const RecvMessageDescriptor &desc) method> | |
| bool | DeregisterForMsgID (uint32_t msgID, T *object) |
| Deregister a RecvMessageDescriptor callback method to no longer receive messages with the specified msgID. | |
| template<class T , void(T::*)(uint32_t, const void *, uint32_t) method> | |
| void | RegisterForMsgID (uint32_t msgID, T *object) |
| Register a pointer/length callback method to handle received messages with the specified msgID. | |
| template<class T , void(T::*)(uint32_t, const void *, uint32_t) method> | |
| bool | DeregisterForMsgID (uint32_t msgID, T *object) |
| Deregister a pointer/length callback method to no longer receive messages with the specified msgID. | |
| void | DeregisterForAllMsgs (void) |
| Deregister to eliminate all callbacks and no longer receive any messages. | |
| void | Run (void) |
| Give up your main loop to repeatedly Poll() this client (rarely used). | |
| int | Poll (float timeout=-1., bool serviceRecvMessages=1) |
| Check the control socket, read and optionally call message handler callbacks. | |
| void | Close (void) |
| Close the control socket connection to the Manager. | |
| void | HandleRecvMessage (const RecvMessageDescriptor &rmd) |
| Call any registered callbacks for the passed RecvMessageDescriptor (advanced). | |
| void * | DeregisterForMsgID (uint32_t msgID, MessageHandlerFunction mhf, void *arg, bool(*argsEqualFunc)(void *arg1, void *arg2)) |
| This is needed to support SWIG/Python deregistering of Python methods. | |
Public Member Functions inherited from MCSB::BaseClient | |
| BaseClient (const ClientOptions &co, bool connect=1) | |
| Construct from ClientOptions, optionally deferring connection attempt. | |
| BaseClient (int argc, char *const argv[]) | |
| Construct from argc and argv. | |
| int | SendMessage (uint32_t msgID, const void *msg, uint32_t len) |
| Send a message on a msgID from a pointer and length (copying). | |
| int | SendMessage (uint32_t msgID, const struct iovec msgiov[], int iovcnt) |
| Send a message on a msgID from a standard iovec (copying). | |
| SendMessageDescriptor | GetSendMessageDescriptor (uint32_t len, bool contiguous=1, bool poll=1) |
| Get a descriptor that filled in and later sent with SendMessage. | |
| int | SendMessage (uint32_t msgID, SendMessageDescriptor &desc, uint32_t len) |
| Send a message on a msgID from a descriptor (zero-copy). | |
| bool | PendingRecvMessage (void) |
| Check for a pending receive message. | |
| RecvMessageDescriptor | GetRecvMessageDescriptor (void) |
| Get the next recv message as a descriptor. | |
| int | RegisterMsgIDs (const uint32_t msgIDs[], int count) |
| Register to receive messages with the specified list of msgIDs. | |
| int | DeregisterMsgIDs (const uint32_t msgIDs[], int count) |
| Deregister to no longer receive messages with the specified msgIDs. | |
| void | DeregisterAllMsgIDs (void) |
| Deregister to no longer receive any messages. | |
| int | Poll (float timeout=-1.) |
| Check the control socket, read and handle if it is readable. | |
| uint32_t | BlockSize (void) const |
| Accessor for the block size in bytes. | |
| uint32_t | SlabSize (void) const |
| Accessor for the slab size in bytes. | |
| uint32_t | NumProducerSlabs (void) const |
| The number of producer slabs allocated this client in bytes. | |
| uint32_t | NumConsumerSlabs (void) const |
| The number of consumer slabs allocated this client in bytes. | |
| uint32_t | MaxSendMessageSize (void) const |
| The largest message that can be sent with this client in bytes. | |
| uint32_t | MaxRecvMessageSize (void) const |
| The largest message that can be received with this client in bytes. | |
| int | FD (void) const |
| Accessor for the file descriptor of the control socket. | |
| int | ClientID (void) const |
| Accessor for this client's integer clientID, assigned by the Manager. | |
| int | Flush (float timeout=-1.) |
| Flush pending communication to the Manager (with a sequence token). | |
| bool | Connected (void) const |
| Check whether the control socket is connected. | |
| bool | Connect (void) |
| Connect if not connected, and return whether connected. | |
| const ClientOptions & | GetClientOptions (void) const |
| Get a const reference to the internal ClientOptions object. | |
| unsigned | PendingRecvSegments (void) const |
| The number of segments received but not yet processed (a queue of upcoming RecvMessages). | |
| uint64_t | NumSegmentsRcvd (void) const |
| The total number of segments received since this client connected to the Manager. | |
| int | SendSequenceToken (void) |
| Send a sequence token to the Manager (for flushing). | |
| unsigned | PendingSequenceTokens (void) const |
| Return the number of sequence tokens sent but not received back. | |
| void | SetDropReportHandler (DropReportHandler func, void *arg=0) |
| Install a callback function that handles drop reports (arg is user data). | |
| template<class T , void(T::*)(uint32_t numSegs, uint32_t numBytes) method> | |
| void | SetDropReportHandler (T *object) |
| Install a callback method that handles drop reports. | |
| void | SetConnectionEventHandler (ConnectionEventHandler func, void *arg=0) |
| Install a callback function that handles connection events (arg is user data). | |
| template<class T , void(T::*)(int) method> | |
| void | SetConnectionEventHandler (T *object) |
| Install a callback method that handles connection events. | |
| void | SetRegistrationHandler (RegistrationHandler func, void *arg=0) |
| Install a callback function that handles registration events (arg is user data). | |
| template<class T , void(T::*)(bool reg, int16_t clientID, int16_t groupID, const uint32_t msgIDs[], unsigned count) method> | |
| void | SetRegistrationHandler (T *object) |
| Install a callback method that handles registration events. | |
| int | GroupID (void) const |
| Accessor for this client's integer groupID (if a groupID was requested). | |
| int | RequestGroupID (const char *groupStr, bool wait=1) |
| Request a groupID via string (advanced for routing message). | |
| int | SendManagerEcho (void) |
| Send an echo control message to the Manager (deferring a socket read event). | |
| ClientImpl * | GetClientImpl (void) |
| Get a pointer to the internal (opaque) ClientImpl object. | |
| const ClientImpl * | GetClientImpl (void) const |
| Get a const pointer to the internal (opaque) ClientImpl object. | |
Public Member Functions inherited from MCSB::dbprinter | |
| dbprinter (int verbosity_=kNotice) | |
| Construct, setting the verbosity level. | |
| int | dbprintf (int level, const char *fmt,...) const |
| behaves like fprintf(stderr,...) if verbosity is at or above the specified level | |
| int | dbprintf (int level, const char *fmt, va_list ap) const |
| behaves like vfprintf(stderr,...) if verbosity is at or above the specified level | |
| int | Verbosity (void) const |
| Get the current verbosity level. | |
| int | Verbosity (int v) |
| Set the current verbosity level. | |
Additional Inherited Members | |
Public Types inherited from MCSB::dbprinter | |
| enum | { kCritical =0, kError, kWarning, kNotice, kInfo, kDebug } |
| debug print levels are similar to RFC5424 for syslog | |
Protected Attributes inherited from MCSB::BaseClient | |
| ClientOptions | options |
| The internal options used for this client. | |
A Client that receives messages reactively, via registration and callback.
1.8.5