OpenHiva::ServiceOptions用来描述Server-Client的属性,Server和Client端必须保持一致。
ServiceOptions入参中的请求数据大小(reqMsgSize)、响应数据大小(resMsgSize)、数据缓存量(blockNum)不能为0,消息大小msgSize=reqDataSize或resDataSize+消息头(64字节),单个消息大小msgSize不能超过30M,blockNum*msgSize需小于300M。
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); // 设置Service回调 ServiceOptions &BuildServiceName(const std::string &srvName); // 设置Service名 std::string serviceName_; // service名 uint32_t reqDataSize_{0U}; // Request消息最大长度,不能超过30000000bytes uint32_t resDataSize_{0U}; // Response消息最大长度,不能超过30000000bytes uint32_t blockNum_{0U}; // 通信时缓存的block个数,描述可以最大缓存多少帧消息 std::function<bool(char8_t *, char8_t *)> callback_{nullptr}; friend class Node; }; } |