OpenHiva::ServiceOptions

OpenHiva::ServiceOptions is used to describe the attributes of the server-client. The attributes on the server and client must be the same.

The request data size (reqMsgSize), response data size (resMsgSize), and data cache size (blockNum) in the ServiceOptions input parameter cannot be 0. The message size is calculated as follows: msgSize = reqDataSize or resDataSize + Message header (64 bytes). The value of msgSize cannot exceed 30 MB, and the product of blockNum and msgSize must be less than 300 MB.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
namespace OpenHiva {
class ServiceOptions {
public:
    ServiceOptions &BuildShmOptions(const uint32_t reqMsgSize, const uint32_t resMsgSize, const uint32_t blockNum);
private:
    template <typename ReqType, typename ResType>
    ServiceOptions &BuildCallBack(const std::function<bool(ReqType, ResType)> &serviceCallback); // Set the service callback.
    ServiceOptions &BuildServiceName(const std::string &srvName); // Set the service name.
    std::string serviceName_; // Service name
    uint32_t reqDataSize_{0U}; // The maximum length of the Request message cannot exceed 30,000,000 bytes.
    uint32_t resDataSize_{0U}; // The maximum length of the Response message cannot exceed 30,000,000 bytes.
    uint32_t blockNum_{0U}; // Number of buffered blocks during communication. This parameter describes the maximum number of frames that can be buffered.
    std::function<bool(char8_t *, char8_t *)> callback_{nullptr};
    friend class Node;
};
}