Skip to content

Transport class

The transport class is the one that does the management for RocketBuf. Basically this should be an abstract class and there should be separate implementations for brokers and subscribers . On **subscribers **, the class should have dependency on TcpClient/RdmaClient. It should register handlers on these networking clients to handle data events, and when a buffer is reclaimed use it to receive further data. It should also have the following APIs:

// event that triggers when data comes in from broker. The application should add this to its data buffer
function<void(iovec)> on_incoming_data;

// called when the buffer `buf` is consumed. The transport class will reclaim this buffer. 
void on_data_consumed(iovec buf);

On brokers this class should be the dependency of the application class with the following APIs:

// get a buffer of a certain size to write to
iovec get_buffer(size_t size);

// commit a buffer. The commited buffer will be disseminated.
void commit(iovec buf);