第 2 章 编译 Protobuf Schema
Data Grid 使用 ProtoStream API 将数据存储为 Protobuf 编码的条目。
protobuf 是一种语言中立的格式,允许客户端使用 Hot Rod 和 REST 端点在远程缓存中创建和检索条目。
2.1. 在 Red Hat Enterprise Linux (RHEL)上编译 Protobuf 模式 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
将 Protobuf 模式 .proto 文件编译到 C++ 标头和源文件,以描述您的数据到 Data Grid。
先决条件
安装 Protobuf 库和
protobuf-devel软件包。yum install protobuf yum install protobuf-devel
# yum install protobuf # yum install protobuf-develCopy to Clipboard Copied! Toggle word wrap Toggle overflow
流程
设置
LD_LIBRARY_PATH环境变量(如果尚未设置)。export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lib64
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lib64Copy to Clipboard Copied! Toggle word wrap Toggle overflow 根据需要为 Hot Rod C++ 客户端编译 Protobuf 模式。
/bin/protoc --cpp_out dllexport_decl=HR_PROTO_EXPORT:/path/to/output/ $FILE
# /bin/protoc --cpp_out dllexport_decl=HR_PROTO_EXPORT:/path/to/output/ $FILECopy to Clipboard Copied! Toggle word wrap Toggle overflow HR_PROTO_EXPORT是一个宏,在编译 Protobuf 模式时,Hot Rod C++ 客户端会展开。- 如果您计划使用查询,请将您的 Protobuf 模式注册到 Data Grid。