File Message.h

Defines

NO_HEADER
HEADER_MSG_SIZE
SHUTDOWN_HEADER
NO_SEQUENCE_NUM

Variables

static constexpr std::array<uint8_t, 4> shutdownPayload = {0, 0, 1, 1}
namespace faabric
namespace transport

Enums

enum class MessageResponseCode

Types of message send/ receive outcomes.

Values:

enumerator SUCCESS
enumerator TERM
enumerator TIMEOUT
enumerator ERROR

Variables

static std::map<MessageResponseCode, std::string> MessageResponseCodeText = {{MessageResponseCode::SUCCESS, "Success"}, {MessageResponseCode::TERM, "Connection terminated"}, {MessageResponseCode::TIMEOUT, "Message timed out"}, {MessageResponseCode::ERROR, "Error"},}
class Message
#include <Message.h>

Represents message data passed around the transport layer. Essentially an array of bytes, with a size and a flag to say whether there’s more data to follow.

Messages are not copyable, only movable, as they will regularly contain large amounts of data.

Public Functions

Message(size_t bufferSize)
Message(nng_msg *nngMsg)
Message(MessageResponseCode responseCodeIn)
~Message()
Message(const Message &other) = delete
Message &operator=(const Message &other) = delete
inline Message(Message &&other)
inline Message &operator=(Message &&other)
inline MessageResponseCode getResponseCode()
inline std::span<uint8_t> allData()
inline std::span<const uint8_t> allData() const
std::span<char> data()
std::span<const char> data() const
std::span<uint8_t> udata()
std::span<const uint8_t> udata() const
std::vector<uint8_t> dataCopy() const
inline uint8_t getMessageCode() const
inline uint64_t getDeclaredDataSize() const
inline int getSequenceNum() const

Private Members

nng_msg *nngMsg = nullptr
MessageResponseCode responseCode = MessageResponseCode::SUCCESS
uint8_t _header = 0
int _sequenceNum = NO_SEQUENCE_NUM