This document describes how to manipulate TcaplusDB Protobuf API on Windows x64.
Tcaplus_PbAPI_3.32.0.171987_Win64Vc14MT_Release_20180413
|-- cfg # Configuration directory
|-- docs # Documentation directory
| `-- tcaplus
|-- include # Dependency header file directory
| `-- tcaplus_pb_api
|-- lib # Library directory
| |-- Debug
| `-- Release
|-- examples # Sample directory
`-- tcaplus
|-- C++_common_for_pb2 # Directory of sample common header files
|-- C++_pb2_asyncmode_simpletable # Sample simple PB table in async mode
|-- C++_pb2_coroutine_simpletable # Sample simple PB table in coroutine mode
AppId
, ZoneId
, and AppKey
).TSF4G_BASE-2.7.28.164975_Win64Vc14Mt_Release.zip
dependency package as an example. You should download an appropriate dependency package here as needed.D:\Tencent\tsf4gMT
, relevant files will be installed under the D:\Tencent\tsf4gMT\win64vc14MT
path.Porotbuf-3.5.1
.D:\protobuf-3.5.1
OpenSSL-1.1.0f
.D:\openssl-1.1.0f
TSF4G_HOME="D:\Tencent\tsf4gMT"
PROTOBUF_HOME="D:\protobuf-3.5.1"
OPENSSL_HOME="D:\openssl-1.1.0f"
App
information in the examples/tcaplus/C++_common_for_pb2/common.h
file.table_test.xml
file in the examples
directory to create a TABLE_NAME
table//examples/tcaplus/C++_common_for_pb2/common.h
/******************User-defined****************************/
// Tcapdir access point address list
static const char DIR_URL_ARRAY[][TCAPLUS_MAX_STRING_LENGTH] =
{
"tcp://10.xx.xx.21:9999"
};
// Number of Tcapdir access point addresses
static const int32_t DIR_URL_COUNT = 1;
// Table name
static const char * TABLE_NAME = "tb_online";
// Business ID
static const int32_t APP_ID = 4;
// Regional business server ID
static const int32_t ZONE_ID = 1;
// Business password
static const char * SIGNATURE = "8e24269ba91fxxxa7e89b1cbb77368e";
/******************User-defined******************************/
examples\tcaplus\C++_pb2_coroutine_simpletable\SingleOperation\set
as an example.set/
|-- main.cpp # Sample code of main function
|-- readme.txt
|-- table_test.proto # .proto table definition file for Tcaplus. The table needs to be created in advance
|-- pb_co_set.sln # VisualStudio solution file of the project
|-- pb_co_set.vcxproj # VisualStudio project file of the project
|-- proto_generate.cmd # .proto file compilation script
`-- tlogconf.xml
table_test.proto
.proto_generate.cmd
script and generate the dependent files under the current path.table_test.pb.cc
table_test.pb.h
pb_co_set.sln
in Microsoft Visual Studio 2015.pb_co_set.exe
will be generated under the examples\tcaplus\C++_pb2_coroutine_simpletable\SingleOperation\set/x64
path.pb_co_set.exe
and tlogconf.xml
files into the same directory.administrator
role and use cmd.exe
or powershell.exe
to run the executable file pb_co_set.exe
.tcaplus_pb.log
.*_crypto
sample code, please make sure that the libcrypto-1_1-x64.dll
file is in the OpenSSL compilation directory under the system path.TcaplusDB PB API provides various types of operations and supports async and coroutine modes. You can find the corresponding usage in the sample code. The list of TcaplusDB PB API commands are as shown below:
Command | Description |
---|---|
SET | Sets record by specifying all its primary keys. If the record already exists, an overwrite operation will be performed; otherwise, an insert operation will be performed. |
GET | Queries record by specifying all its primary keys in TcaplusDB PB table. If the record does not exist, an error will be returned. |
ADD | Inserts record by specifying all its primary keys. If the record already exists, an error will be returned. |
DELETE | Deletes record by specifying all its primary keys. If the record does not exist, an error will be returned. |
BATCHGET | Queries multiple records by specifying multiple set of primary keys in TcaplusDB PB table. |
TRAVERSE | Traverses TcaplusDB PB table. Multiple records will be returned. |
FIELDGET | Queries record by specifying all its primary keys in TcaplusDB PB table. This operation queries and transfers only the values of specified fields, which reduces the network transfer traffic. If the record does not exist, an error will be returned. |
FIELDSET | Sets specified fields by specifying all primary keys of record. Only the values of specified fields will be transferred, which reduces the network traffic. If the data record already exists, an update operation will be performed; otherwise, an error will be returned. |
FIELDINC | Auto-increments specified fields by specifying all primary keys of record. This command supports only fields in int32 , int64 , uint32 , and uint64 types. It is similar to FIELDSET . |
GETBYPARTKEY | Queries multiple eligible data entries by specifying certain primary keys. The specified primary key set must have an index created when the table is created; otherwise, an error will be returned. |
Was this page helpful?