tar -xzvf protobuf-2.6.1.tar.gzcd ./protobuf-2.6.1
/usr/local/protobuf
../configure --prefix=/usr/local/protobuf
makemake checkmake install
protoc
command to check whether the installation succeeded. If the following information is displayed, the installation is successful.# protoc --versionlibprotoc 2.6.1
tar –xzf <installation package path> -C <installation directory>,
Directory and File | Description |
include/tcaplus_service/ | TcaplusDB service API header file |
lib/libtcaplusserviceapi.a | TcaplusDB service API library file |
include/tcaplus_service/protobuf/ | Protobuf API header file |
lib/libtcaplusprotobufapi.a | TcaplusDB Protobuf API library file |
examples/tcaplus/ProtoBuf | TcaplusDB Protobuf API sample |
example
and accessing TcaplusDBexample
.tar -xzvf TcaplusPbApi3.36.0.152096.x86_64_release_20170712.tar.gz
cd TcaplusPbApi3.36.0.152096.x86_64_release_20170712/release/x86_64/examples/tcaplus/C++_common_for_pb2
vi common.h
to modify the common.h
header file. Modify the content in the figure below based on your actual business needs:
DIR_URL_ARRAY: cluster access IP address and port.
DIR_URL_COUNT: value fixed at 1.
TABLE_NAME: target table to be accessed.
APP_ID: target access ID.
ZONE_ID: ID of the table group to be accessed.
SIGNATURE: cluster access password.TcaplusPbApi3.36.0.152096.x86_64_release_20170712/release/x86_64/examples/tcaplus
directory, there are sample files of calling APIs asynchronously or by using a coroutine. This step uses calling the Set
API with a coroutine to set data as an example.
Enter the following code on the command line to enter the directory:cd TcaplusPbApi3.18.0.152096.x86_64_release_20170712/release/x86_64/examples/tcaplus/C++_pb2_coroutine_simpletable/SingleOperation/set
Set
API with a coroutine is in the directory. Modify the envcfg.env
file, set the PROTOBUF_HOME
environment variable to the Protobuf installation path on this server (specified by --prefix
), and set the TCAPLUS_HOME
environment variable to the absolute path of the release/x86_64
directory in the TcaplusDB PB API package as shown below:source envcfg.envbash conv.sh
make
command to compile the binary program of example
. After the compilation succeeded, a mytest
executable file will be generated../mytest
to run the binary program. The execution result will be displayed in the command line standard output. If any error occurs, please check the tcaplus_pb.log
log file in the code directory.
Was this page helpful?