当前位置:网站首页>[in depth understanding of tcallusdb technology] sample code of scanning data - [generic table]
[in depth understanding of tcallusdb technology] sample code of scanning data - [generic table]
2022-04-22 15:14:00 【Database master】
Preparation of this paper
See Chapter : preparation .
Sample code
Sample code
import com.tencent.tcaplus.client.Client;
import com.tencent.tcaplus.client.ClientFactory;
import com.tencent.tcaplus.client.GenericTableTraverser;
import com.tencent.tcaplus.client.Record;
import com.tencent.tcaplus.client.Request;
import com.tencent.tcaplus.client.Response;
import com.tencent.tdr.tcaplus_protocol_cs.TcaplusProtocolCsConstants;
import java.util.ArrayList;
import java.util.List;
public class Example {
public static void main(String[] arguments) {
// 1. Prepare environmental information
// 1.1. Directory service address list
List<String> dirList = new ArrayList<String>();
dirList.add("tcp://x.x.x.x:9999");
dirList.add("tcp://y.y.y.y:9999");
// 1.2. Business ID
int appId = 1;
// 1.3. Business password
String appPassword = "****************";
// 1.4. Table group ID
int tableGroupId = 1;
// 1.5. Table name
String tableName = "test";
// 2. Create client
Client client = ClientFactory.createClient(appId, tableGroupId, appPassword, dirList);
try {
// 3. The structure is based on part Key A request to read data from a field value
// 3.1. Get request object . In order to improve SDK performance ,Request Objects are reusable
Request request = client.acquireRequest();
// 3.2. establish 1 Scanners
GenericTableTraverser traverser = client.getGenericTableTraverser(tableName);
// 3.3. Add the data to be read Value Field
traverser.addFieldName("typeid");
traverser.addFieldName("Data");
traverser.addFieldName("uname");
// 3.4. Set the maximum number of data pieces returned in a batch , Because the amount of data returned by scanning is usually large , Batch return required
traverser.setLoadOptions(100);
// 3.5. Set the maximum number of data returned in total
traverser.setTotalLimit(10000);
// 4. Start the scanner
Iterator<Record> iterator = traverser.start();
// 5. Loop gets data from iterator , Until all the data is read
while (!iterator.hasNext()) {
Record result = iterator.next();
// TODO Add here the code to process the returned data
}
} finally {
// 6. Destroy client objects
ClientFactory.destroyClient(client);
}
}

TcaplusDB It's a distributed product of Tencent NoSQL database , The code for storage and scheduling is completely self-developed . With cache + Landing fusion architecture 、PB Levels of storage 、 Millisecond delay 、 Lossless horizontal expansion and complex data structure . At the same time, it has rich ecological environment 、 Easy migration 、 Extremely low operation and maintenance costs and five nine high availability features . Customer coverage game 、 Internet 、 government affairs 、 Finance 、 Manufacturing and the Internet of things .
版权声明
本文为[Database master]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221501394847.html
边栏推荐
- Tencent cloud im integration (so easy)
- MySQL initialization error
- Record an SQL, query the company where the user last worked, and search according to the enterprise name + user name
- How to measure small current with oscilloscope and current probe
- Vscode handles code merge conflicts
- 【深入理解TcaplusDB技术】批量删除列表指定位置数据接口说明——[List表]
- Development trend of C in 2022
- 恶意软件分析– Ursnif Trojan
- 情报研判分析平台建设,情指勤一体化管理系统开发
- [in depth understanding of tcallusdb technology] example code - data batch return
猜你喜欢
随机推荐
分布式任務調度平臺XXL-JOB安裝及使用
[C language] learn file operation in 10 minutes
JVM的垃圾回收Serial、Serial Old、Parallel Scavenge、Parallel Old的介绍和STW(Stop The World)
JVM garbage collection parnew and CMS introduction
Bootsrap 模态框文字超出处理
如何选择电流钳或电流探头
Construction of information research and judgment analysis platform and development of information, guidance and logistics integrated management system
微服务技术概览
学校固定资产管理系统由谁来做,云呐RFID固定资产管理系统
JVM的垃圾回收ParNew和CMS的介绍
07-有关函数的知识点
多款无源探头1:1衰减比有什么区别
2022年危险化学品生产单位安全生产管理人员考试题模拟考试平台操作
[World Earth Day] Huawei cloud market | witness the beautiful changes of nature with science and technology
记录一个sql,查询用户最后任职的一家公司,并根据企业名称+用户名称进行搜索
[time series] deepglo: a multi time series prediction model that can learn global dependence and local information
*CTF2022 - Web
Tcallusdb Jun · industry news compilation (V)
[deeply understand tcallusdb technology] delete all data interface descriptions in the list - [list table]
【KMP】




![[Mysql] CHAR_LENGTH函数](/img/1c/57bc70f35429d0add2dbee99e06c1c.png)




