Merge branch '3.0' into feature/grant-3.0
This commit is contained in:
commit
85d7e46ff9
|
@ -19,3 +19,6 @@
|
|||
[submodule "tools/taosadapter"]
|
||||
path = tools/taosadapter
|
||||
url = https://github.com/taosdata/taosadapter.git
|
||||
[submodule "tools/taosws-rs"]
|
||||
path = tools/taosws-rs
|
||||
url = https://github.com/taosdata/taosws-rs.git
|
||||
|
|
209
README-CN.md
209
README-CN.md
|
@ -1,38 +1,59 @@
|
|||
<p>
|
||||
<p align="center">
|
||||
<a href="https://tdengine.com" target="_blank">
|
||||
<img
|
||||
src="docs/assets/tdengine.svg"
|
||||
alt="TDengine"
|
||||
width="500"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
[](https://travis-ci.org/taosdata/TDengine)
|
||||
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
|
||||
[](https://coveralls.io/github/taosdata/TDengine?branch=develop)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/4201)
|
||||
[](https://snapcraft.io/tdengine)
|
||||
|
||||
[](https://www.taosdata.com)
|
||||
|
||||
简体中文 | [English](./README.md)
|
||||
简体中文 | [English](README.md) | 很多职位正在热招中,请看[这里](https://www.taosdata.com/cn/careers/)
|
||||
|
||||
# TDengine 简介
|
||||
|
||||
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。除核心的快10倍以上的时序数据库功能外,还提供缓存、数据订阅、流式计算等功能,最大程度减少研发和运维的复杂度,且核心代码,包括集群功能全部开源(开源协议,AGPL v3.0)。
|
||||
TDengine 是一款高性能、分布式、支持 SQL 的时序数据库(Time-Series Database)。而且除时序数据库功能外,它还提供缓存、数据订阅、流式计算等功能,最大程度减少研发和运维的复杂度,且核心代码,包括集群功能全部开源(开源协议,AGPL v3.0)。与其他时序数据数据库相比,TDengine 有以下特点:
|
||||
|
||||
- 10 倍以上性能提升。定义了创新的数据存储结构,单核每秒就能处理至少2万次请求,插入数百万个数据点,读出一千万以上数据点,比现有通用数据库快了十倍以上。
|
||||
- 硬件或云服务成本降至1/5。由于超强性能,计算资源不到通用大数据方案的1/5;通过列式存储和先进的压缩算法,存储空间不到通用数据库的1/10。
|
||||
- 全栈时序数据处理引擎。将数据库、消息队列、缓存、流式计算等功能融合一起,应用无需再集成Kafka/Redis/HBase/Spark等软件,大幅降低应用开发和维护成本。
|
||||
- 强大的分析功能。无论是十年前还是一秒钟前的数据,指定时间范围即可查询。数据可在时间轴上或多个设备上进行聚合。即席查询可通过Shell/Python/R/Matlab随时进行。
|
||||
- 与第三方工具无缝连接。不用一行代码,即可与Telegraf, Grafana, EMQ X, Prometheus, Matlab, R集成。后续还将支持MQTT, OPC, Hadoop,Spark等, BI工具也将无缝连接。
|
||||
- 零运维成本、零学习成本。安装、集群一秒搞定,无需分库分表,实时备份。标准SQL,支持JDBC,RESTful,支持Python/Java/C/C++/Go/Node.JS, 与MySQL相似,零学习成本。
|
||||
- **高性能**:通过创新的存储引擎设计,无论是数据写入还是查询,TDengine 的性能比通用数据库快 10 倍以上,也远超其他时序数据库,而且存储空间也大为节省。
|
||||
|
||||
- **分布式**:通过原生分布式的设计,TDengine 提供了水平扩展的能力,只需要增加节点就能获得更强的数据处理能力,同时通过多副本机制保证了系统的高可用。
|
||||
|
||||
- **支持 SQL**:TDengine 采用 SQL 作为数据查询语言,减少学习和迁移成本,同时提供 SQL 扩展来处理时序数据特有的分析,而且支持方便灵活的 schemaless 数据写入。
|
||||
|
||||
- **All in One**:将数据库、消息队列、缓存、流式计算等功能融合一起,应用无需再集成 Kafka/Redis/HBase/Spark 等软件,大幅降低应用开发和维护成本。
|
||||
|
||||
- **零管理**:安装、集群几秒搞定,无任何依赖,不用分库分表,系统运行状态监测能与 Grafana 或其他运维工具无缝集成。
|
||||
|
||||
- **零学习成本**:采用 SQL 查询语言,支持 Python、Java、C/C++、Go、Rust、Node.js 等多种编程语言,与 MySQL 相似,零学习成本。
|
||||
|
||||
- **无缝集成**:不用一行代码,即可与 Telegraf、Grafana、EMQX、Prometheus、StatsD、collectd、Matlab、R 等第三方工具无缝集成。
|
||||
|
||||
- **互动 Console**: 通过命令行 console,不用编程,执行 SQL 语句就能做即席查询、各种数据库的操作、管理以及集群的维护.
|
||||
|
||||
TDengine 可以广泛应用于物联网、工业互联网、车联网、IT 运维、能源、金融等领域,让大量设备、数据采集器每天产生的高达 TB 甚至 PB 级的数据能得到高效实时的处理,对业务的运行状态进行实时的监测、预警,从大数据中挖掘出商业价值。
|
||||
|
||||
# 文档
|
||||
|
||||
TDengine是一个高效的存储、查询、分析时序大数据的平台,专为物联网、车联网、工业互联网、运维监测等优化而设计。您可以像使用关系型数据库MySQL一样来使用它,但建议您在使用前仔细阅读一遍下面的文档,特别是 [数据模型](https://www.taosdata.com/cn/documentation/architecture) 与 [数据建模](https://www.taosdata.com/cn/documentation/model)。除本文档之外,欢迎 [下载产品白皮书](https://www.taosdata.com/downloads/TDengine%20White%20Paper.pdf)。
|
||||
TDengine 采用传统的关系数据库模型,您可以像使用关系型数据库 MySQL 一样来使用它。但由于引入了超级表,一个采集点一张表的概念,建议您在使用前仔细阅读一遍下面的文档,特别是 [数据模型](https://www.taosdata.com/cn/documentation/architecture) 与 [数据建模](https://www.taosdata.com/cn/documentation/model)。除本文档之外,欢迎 [下载产品白皮书](https://www.taosdata.com/downloads/TDengine%20White%20Paper.pdf)。
|
||||
|
||||
# 构建
|
||||
|
||||
TDengine目前2.0版服务器仅能在Linux系统上安装和运行,后续会支持Windows、macOS等系统。客户端可以在Windows或Linux上安装和运行。任何OS的应用也可以选择RESTful接口连接服务器taosd。CPU支持X64/ARM64/MIPS64/Alpha64,后续会支持ARM32、RISC-V等CPU架构。用户可根据需求选择通过[源码](https://www.taosdata.com/cn/getting-started/#通过源码安装)或者[安装包](https://www.taosdata.com/cn/getting-started/#通过安装包安装)来安装。本快速指南仅适用于通过源码安装。
|
||||
TDengine 目前 2.0 版服务器仅能在 Linux 系统上安装和运行,后续会支持 Windows、macOS 等系统。客户端可以在 Windows 或 Linux 上安装和运行。任何 OS 的应用也可以选择 RESTful 接口连接服务器 taosd。CPU 支持 X64/ARM64/MIPS64/Alpha64,后续会支持 ARM32、RISC-V 等 CPU 架构。用户可根据需求选择通过[源码](https://www.taosdata.com/cn/getting-started/#通过源码安装)或者[安装包](https://www.taosdata.com/cn/getting-started/#通过安装包安装)来安装。本快速指南仅适用于通过源码安装。
|
||||
|
||||
## 安装工具
|
||||
|
||||
### Ubuntu 16.04 及以上版本 & Debian:
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y gcc cmake build-essential git
|
||||
sudo apt-get install -y gcc cmake build-essential git libssl-dev
|
||||
```
|
||||
|
||||
### Ubuntu 14.04:
|
||||
|
@ -56,10 +77,22 @@ sudo apt-get install -y openjdk-8-jdk
|
|||
sudo apt-get install -y maven
|
||||
```
|
||||
|
||||
#### 为 taos-tools 安装编译需要的软件
|
||||
|
||||
taosTools 是用于 TDengine 的辅助工具软件集合。目前它包含 taosBenchmark(曾命名为 taosdemo)和 taosdump 两个软件。
|
||||
|
||||
默认 TDengine 编译不包含 taosTools。您可以在编译 TDengine 时使用`cmake .. -DBUILD_TOOLS=true` 来同时编译 taosTools。
|
||||
|
||||
为了在 Ubuntu/Debian 系统上编译 [taos-tools](https://github.com/taosdata/taos-tools) 需要安装如下软件:
|
||||
|
||||
```bash
|
||||
sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config
|
||||
```
|
||||
|
||||
### CentOS 7:
|
||||
|
||||
```bash
|
||||
sudo yum install -y gcc gcc-c++ make cmake git
|
||||
sudo yum install -y gcc gcc-c++ make cmake git openssl-devel
|
||||
```
|
||||
|
||||
安装 OpenJDK 8:
|
||||
|
@ -74,10 +107,10 @@ sudo yum install -y java-1.8.0-openjdk
|
|||
sudo yum install -y maven
|
||||
```
|
||||
|
||||
### CentOS 8 & Fedora:
|
||||
### CentOS 8 & Fedora
|
||||
|
||||
```bash
|
||||
sudo dnf install -y gcc gcc-c++ make cmake epel-release git
|
||||
sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel
|
||||
```
|
||||
|
||||
安装 OpenJDK 8:
|
||||
|
@ -92,6 +125,33 @@ sudo dnf install -y java-1.8.0-openjdk
|
|||
sudo dnf install -y maven
|
||||
```
|
||||
|
||||
#### 在 CentOS 上构建 taosTools 安装依赖软件
|
||||
|
||||
为了在 CentOS 上构建 [taosTools](https://github.com/taosdata/taos-tools) 需要安装如下依赖软件
|
||||
|
||||
```bash
|
||||
sudo yum install zlib-devel xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libstdc++-static openssl-devel
|
||||
```
|
||||
|
||||
注意:由于 snappy 缺乏 pkg-config 支持
|
||||
(参考 [链接](https://github.com/google/snappy/pull/86)),会导致
|
||||
cmake 提示无法发现 libsnappy,实际上工作正常。
|
||||
|
||||
### 设置 golang 开发环境
|
||||
|
||||
TDengine 包含数个使用 Go 语言开发的组件,请参考 golang.org 官方文档设置 go 开发环境。
|
||||
|
||||
请使用 1.14 及以上版本。对于中国用户,我们建议使用代理来加速软件包下载。
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
### 设置 rust 开发环境
|
||||
|
||||
TDengine 包含数个使用 Rust 语言开发的组件. 请参考 rust-lang.org 官方文档设置 rust 开发环境。
|
||||
|
||||
## 获取源码
|
||||
|
||||
首先,你需要从 GitHub 克隆源码:
|
||||
|
@ -107,22 +167,41 @@ Go 连接器和 Grafana 插件在其他独立仓库,如果安装它们的话
|
|||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
如果使用 https 协议下载比较慢,可以通过修改 ~/.gitconfig 文件添加以下两行设置使用 ssh 协议下载。需要首先上传 ssh 密钥到 GitHub,详细方法请参考 GitHub 官方文档。
|
||||
|
||||
```
|
||||
[url "git@github.com:"]
|
||||
insteadOf = https://github.com/
|
||||
```
|
||||
|
||||
## 构建 TDengine
|
||||
|
||||
### Linux 系统
|
||||
|
||||
可以运行代码仓库中的 `build.sh` 脚本编译出 TDengine 和 taosTools(包含 taosBenchmark 和 taosdump)。
|
||||
|
||||
```bash
|
||||
mkdir debug && cd debug
|
||||
cmake .. && cmake --build .
|
||||
./build.sh
|
||||
```
|
||||
|
||||
您可以选择使用 Jemalloc 作为内存分配器,替代默认的 glibc:
|
||||
这个脚本等价于执行如下命令:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
mkdir debug
|
||||
cd debug
|
||||
cmake .. -DBUILD_TOOLS=true
|
||||
make
|
||||
```
|
||||
|
||||
您也可以选择使用 jemalloc 作为内存分配器,替代默认的 glibc:
|
||||
|
||||
```bash
|
||||
apt install autoconf
|
||||
cmake .. -DJEMALLOC_ENABLED=true
|
||||
```
|
||||
|
||||
在X86-64、X86、arm64、arm32 和 mips64 平台上,TDengine 生成脚本可以自动检测机器架构。也可以手动配置 CPUTYPE 参数来指定 CPU 类型,如 aarch64 或 aarch32 等。
|
||||
在 X86-64、X86、arm64、arm32 和 mips64 平台上,TDengine 生成脚本可以自动检测机器架构。也可以手动配置 CPUTYPE 参数来指定 CPU 类型,如 aarch64 或 aarch32 等。
|
||||
|
||||
aarch64:
|
||||
|
||||
|
@ -157,7 +236,7 @@ nmake
|
|||
|
||||
如果你使用的是 Visual Studio 2019 或 2017 版本:
|
||||
|
||||
打开cmd.exe,执行 vcvarsall.bat 时,为 64 位操作系统指定“x64”,为 32 位操作系统指定“x86”。
|
||||
打开 cmd.exe,执行 vcvarsall.bat 时,为 64 位操作系统指定“x64”,为 32 位操作系统指定“x86”。
|
||||
|
||||
```bash
|
||||
mkdir debug && cd debug
|
||||
|
@ -174,9 +253,7 @@ cmake .. -G "NMake Makefiles"
|
|||
nmake
|
||||
```
|
||||
|
||||
如果你使用的是 Visual Studio 2022 版本, 脚本 `vcvarsall.bat` 的默认安装路径是 `C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat`。
|
||||
|
||||
### Mac OS X 系统
|
||||
### macOS 系统
|
||||
|
||||
安装 Xcode 命令行工具和 cmake. 在 Catalina 和 Big Sur 操作系统上,需要安装 XCode 11.4+ 版本。
|
||||
|
||||
|
@ -187,13 +264,17 @@ cmake .. && cmake --build .
|
|||
|
||||
# 安装
|
||||
|
||||
生成完成后,安装 TDengine(下文给出的指令以 Linux 为例,如果是在 Windows 下,那么对应的指令会是 `nmake install`):
|
||||
## Linux 系统
|
||||
|
||||
生成完成后,安装 TDengine:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
用户可以在[文件目录结构](https://www.taosdata.com/cn/documentation/administrator#directories)中了解更多在操作系统中生成的目录或文件。
|
||||
从 2.0 版本开始, 从源代码安装也会为 TDengine 配置服务管理。
|
||||
用户也可以选择[从安装包中安装](https://www.taosdata.com/en/getting-started/#Install-from-Package)。
|
||||
|
||||
安装成功后,在终端中启动 TDengine 服务:
|
||||
|
||||
|
@ -209,6 +290,40 @@ taos
|
|||
|
||||
如果 TDengine Shell 连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印出错误消息。
|
||||
|
||||
## Windows 系统
|
||||
|
||||
生成完成后,安装 TDengine:
|
||||
|
||||
```cmd
|
||||
nmake install
|
||||
```
|
||||
|
||||
## macOS 系统
|
||||
|
||||
生成完成后,安装 TDengine:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
安装成功后,如果想以服务形式启动,先配置 `.plist` 文件,在终端中执行:
|
||||
|
||||
```bash
|
||||
sudo cp ../packaging/macOS/com.taosdata.tdengine.plist /Library/LaunchDaemons
|
||||
```
|
||||
|
||||
在终端中启动 TDengine 服务:
|
||||
|
||||
```bash
|
||||
sudo launchctl load /Library/LaunchDaemons/com.taosdata.tdengine.plist
|
||||
```
|
||||
|
||||
在终端中停止 TDengine 服务:
|
||||
|
||||
```bash
|
||||
sudo launchctl unload /Library/LaunchDaemons/com.taosdata.tdengine.plist
|
||||
```
|
||||
|
||||
## 快速运行
|
||||
|
||||
如果不希望以服务方式运行 TDengine,也可以在终端中直接运行它。也即在生成完成后,执行以下命令(在 Windows 下,生成的可执行文件会带有 .exe 后缀,例如会名为 taosd.exe ):
|
||||
|
@ -227,15 +342,15 @@ taos
|
|||
|
||||
# 体验 TDengine
|
||||
|
||||
在TDengine终端中,用户可以通过SQL命令来创建/删除数据库、表等,并进行插入查询操作。
|
||||
在 TDengine 终端中,用户可以通过 SQL 命令来创建/删除数据库、表等,并进行插入查询操作。
|
||||
|
||||
```bash
|
||||
create database demo;
|
||||
use demo;
|
||||
create table t (ts timestamp, speed int);
|
||||
insert into t values ('2019-07-15 00:00:00', 10);
|
||||
insert into t values ('2019-07-15 01:00:00', 20);
|
||||
select * from t;
|
||||
```sql
|
||||
CREATE DATABASE demo;
|
||||
USE demo;
|
||||
CREATE TABLE t (ts TIMESTAMP, speed INT);
|
||||
INSERT INTO t VALUES('2019-07-15 00:00:00', 10);
|
||||
INSERT INTO t VALUES('2019-07-15 01:00:00', 20);
|
||||
SELECT * FROM t;
|
||||
ts | speed |
|
||||
===================================
|
||||
19-07-15 00:00:00.000| 10|
|
||||
|
@ -247,33 +362,35 @@ Query OK, 2 row(s) in set (0.001700s)
|
|||
|
||||
## 官方连接器
|
||||
|
||||
TDengine 提供了丰富的应用程序开发接口,其中包括C/C++、Java、Python、Go、Node.js、C# 、RESTful 等,便于用户快速开发应用:
|
||||
TDengine 提供了丰富的应用程序开发接口,其中包括 C/C++、Java、Python、Go、Node.js、C# 、RESTful 等,便于用户快速开发应用:
|
||||
|
||||
- Java
|
||||
- [Java](https://www.taosdata.com/cn/documentation/connector/java)
|
||||
|
||||
- C/C++
|
||||
- [C/C++](https://www.taosdata.com/cn/documentation/connector#c-cpp)
|
||||
|
||||
- Python
|
||||
- [Python](https://www.taosdata.com/cn/documentation/connector#python)
|
||||
|
||||
- Go
|
||||
- [Go](https://www.taosdata.com/cn/documentation/connector#go)
|
||||
|
||||
- RESTful API
|
||||
- [RESTful API](https://www.taosdata.com/cn/documentation/connector#restful)
|
||||
|
||||
- Node.js
|
||||
- [Node.js](https://www.taosdata.com/cn/documentation/connector#nodejs)
|
||||
|
||||
- [Rust](https://www.taosdata.com/cn/documentation/connector/rust)
|
||||
|
||||
## 第三方连接器
|
||||
|
||||
TDengine 社区生态中也有一些非常友好的第三方连接器,可以通过以下链接访问它们的源码。
|
||||
|
||||
- [Rust Connector](https://github.com/taosdata/TDengine/tree/master/tests/examples/rust)
|
||||
- [Rust Bindings](https://github.com/songtianyi/tdengine-rust-bindings/tree/master/examples)
|
||||
- [.Net Core Connector](https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos)
|
||||
- [Lua Connector](https://github.com/taosdata/TDengine/tree/develop/tests/examples/lua)
|
||||
- [Lua Connector](https://github.com/taosdata/TDengine/tree/develop/examples/lua)
|
||||
|
||||
# 运行和添加测试例
|
||||
|
||||
TDengine 的测试框架和所有测试例全部开源。
|
||||
|
||||
点击 [这里](tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md),了解如何运行测试例和添加新的测试例。
|
||||
点击 [这里](https://github.com/taosdata/TDengine/blob/develop/tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md),了解如何运行测试例和添加新的测试例。
|
||||
|
||||
# 成为社区贡献者
|
||||
|
||||
|
@ -281,8 +398,8 @@ TDengine 的测试框架和所有测试例全部开源。
|
|||
|
||||
# 加入技术交流群
|
||||
|
||||
TDengine 官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小T为好友,即可入群。
|
||||
TDengine 官方社群「物联网大数据群」对外开放,欢迎您加入讨论。搜索微信号 "tdengine",加小 T 为好友,即可入群。
|
||||
|
||||
# [谁在使用TDengine](https://github.com/taosdata/TDengine/issues/2432)
|
||||
# [谁在使用 TDengine](https://github.com/taosdata/TDengine/issues/2432)
|
||||
|
||||
欢迎所有 TDengine 用户及贡献者在 [这里](https://github.com/taosdata/TDengine/issues/2432) 分享您在当前工作中开发/使用 TDengine 的故事。
|
||||
欢迎所有 TDengine 用户及贡献者在 [这里](https://github.com/taosdata/TDengine/issues/2432) 分享您在当前工作中开发/使用 TDengine 的故事。
|
||||
|
|
273
README.md
273
README.md
|
@ -1,116 +1,218 @@
|
|||
<p>
|
||||
<p align="center">
|
||||
<a href="https://tdengine.com" target="_blank">
|
||||
<img
|
||||
src="docs/assets/tdengine.svg"
|
||||
alt="TDengine"
|
||||
width="500"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
[](https://cloud.drone.io/taosdata/TDengine)
|
||||
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
|
||||
[](https://coveralls.io/github/taosdata/TDengine?branch=develop)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/4201)
|
||||
[](https://snapcraft.io/tdengine)
|
||||
|
||||
[](https://www.taosdata.com)
|
||||
|
||||
English | [简体中文](./README-CN.md)
|
||||
English | [简体中文](README-CN.md) | We are hiring, check [here](https://tdengine.com/careers)
|
||||
|
||||
# What is TDengine?
|
||||
|
||||
TDengine is an open-sourced big data platform under [GNU AGPL v3.0](http://www.gnu.org/licenses/agpl-3.0.html), designed and optimized for the Internet of Things (IoT), Connected Cars, Industrial IoT, and IT Infrastructure and Application Monitoring. Besides the 10x faster time-series database, it provides caching, stream computing, message queuing and other functionalities to reduce the complexity and cost of development and operation.
|
||||
TDengine is a high-performance, scalable time-series database with SQL support. Its code including cluster feature is open source under [GNU AGPL v3.0](http://www.gnu.org/licenses/agpl-3.0.html). Besides the database, it provides caching, stream processing, data subscription and other functionalities to reduce the complexity and cost of development and operation. TDengine differentiates itself from other TSDBs with the following advantages.
|
||||
|
||||
- **10x Faster on Insert/Query Speeds**: Through the innovative design on storage, on a single-core machine, over 20K requests can be processed, millions of data points can be ingested, and over 10 million data points can be retrieved in a second. It is 10 times faster than other databases.
|
||||
- **High Performance**: TDengine outperforms other time series databases in data ingestion and querying while significantly reducing storage cost and compute costs, with an innovatively designed and purpose-built storage engine.
|
||||
|
||||
- **1/5 Hardware/Cloud Service Costs**: Compared with typical big data solutions, less than 1/5 of computing resources are required. Via column-based storage and tuned compression algorithms for different data types, less than 1/10 of storage space is needed.
|
||||
- **Scalable**: TDengine provides out-of-box scalability and high-availability through its native distributed design. Nodes can be added through simple configuration to achieve greater data processing power. In addition, this feature is open source.
|
||||
|
||||
- **Full Stack for Time-Series Data**: By integrating a database with message queuing, caching, and stream computing features together, it is no longer necessary to integrate Kafka/Redis/HBase/Spark or other software. It makes the system architecture much simpler and more robust.
|
||||
- **SQL Support**: TDengine uses SQL as the query language, thereby reducing learning and migration costs, while adding SQL extensions to handle time-series data better, and supporting convenient and flexible schemaless data ingestion.
|
||||
|
||||
- **Powerful Data Analysis**: Whether it is 10 years or one minute ago, data can be queried just by specifying the time range. Data can be aggregated over time, multiple time streams or both. Ad Hoc queries or analyses can be executed via TDengine shell, Python, R or Matlab.
|
||||
- **All in One**: TDengine has built-in caching, stream processing and data subscription functions, it is no longer necessary to integrate Kafka/Redis/HBase/Spark or other software in some scenarios. It makes the system architecture much simpler and easy to maintain.
|
||||
|
||||
- **Seamless Integration with Other Tools**: Telegraf, Grafana, Matlab, R, and other tools can be integrated with TDengine without a line of code. MQTT, OPC, Hadoop, Spark, and many others will be integrated soon.
|
||||
- **Seamless Integration**: Without a single line of code, TDengine provide seamless integration with third-party tools such as Telegraf, Grafana, EMQX, Prometheus, StatsD, collectd, etc. More will be integrated.
|
||||
|
||||
- **Zero Management, No Learning Curve**: It takes only seconds to download, install, and run it successfully; there are no other dependencies. Automatic partitioning on tables or DBs. Standard SQL is used, with C/C++, Python, JDBC, Go and RESTful connectors.
|
||||
- **Zero Management**: Installation and cluster setup can be done in seconds. Data partitioning and sharding are executed automatically. TDengine’s running status can be monitored via Grafana or other DevOps tools.
|
||||
|
||||
- **Zero Learning Cost**: With SQL as the query language, support for ubiquitous tools like Python, Java, C/C++, Go, Rust, Node.js connectors, there is zero learning cost.
|
||||
|
||||
- **Interactive Console**: TDengine provides convenient console access to the database to run ad hoc queries, maintain the database, or manage the cluster without any programming.
|
||||
|
||||
TDengine can be widely applied to Internet of Things (IoT), Connected Vehicles, Industrial IoT, DevOps, energy, finance and many other scenarios.
|
||||
|
||||
# Documentation
|
||||
|
||||
For user manual, system design and architecture, engineering blogs, refer to [TDengine Documentation](https://www.taosdata.com/en/documentation/)(中文版请点击[这里](https://www.taosdata.com/cn/documentation20/))
|
||||
for details. The documentation from our website can also be downloaded locally from *documentation/tdenginedocs-en* or *documentation/tdenginedocs-cn*.
|
||||
for details. The documentation from our website can also be downloaded locally from _documentation/tdenginedocs-en_ or _documentation/tdenginedocs-cn_.
|
||||
|
||||
# Building
|
||||
At the moment, TDengine only supports building and running on Linux systems. You can choose to [install from packages](https://www.taosdata.com/en/getting-started/#Install-from-Package) or from the source code. This quick guide is for installation from the source only.
|
||||
|
||||
To build TDengine, use [CMake](https://cmake.org/) 2.8.12.x or higher versions in the project directory.
|
||||
At the moment, TDengine server only supports running on Linux systems. You can choose to [install from packages](https://www.taosdata.com/en/getting-started/#Install-from-Package) or build it from the source code. This quick guide is for installation from the source only.
|
||||
|
||||
## Install tools
|
||||
To build TDengine, use [CMake](https://cmake.org/) 3.0.2 or higher versions in the project directory.
|
||||
|
||||
## Install build dependencies
|
||||
|
||||
### Ubuntu 16.04 and above or Debian
|
||||
|
||||
### Ubuntu 16.04 and above & Debian:
|
||||
```bash
|
||||
sudo apt-get install -y gcc cmake build-essential git
|
||||
sudo apt-get install -y gcc cmake build-essential git libssl-dev
|
||||
```
|
||||
|
||||
### Ubuntu 14.04:
|
||||
### Ubuntu 14.04
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y gcc cmake3 build-essential git binutils-2.26
|
||||
export PATH=/usr/lib/binutils-2.26/bin:$PATH
|
||||
```
|
||||
|
||||
To compile and package the JDBC driver source code, you should have a Java jdk-8 or higher and Apache Maven 2.7 or higher installed.
|
||||
To compile and package the JDBC driver source code, you should have a Java jdk-8 or higher and Apache Maven 2.7 or higher installed.
|
||||
|
||||
To install openjdk-8:
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y openjdk-8-jdk
|
||||
```
|
||||
|
||||
To install Apache Maven:
|
||||
|
||||
```bash
|
||||
sudo apt-get install -y maven
|
||||
sudo apt-get install -y maven
|
||||
```
|
||||
|
||||
### Centos 7:
|
||||
#### Install build dependencies for taosTools
|
||||
|
||||
We provide a few useful tools such as taosBenchmark (was named taosdemo) and taosdump. They were part of TDengine. From TDengine 2.4.0.0, taosBenchmark and taosdump were not released together with TDengine.
|
||||
By default, TDengine compiling does not include taosTools. You can use 'cmake .. -DBUILD_TOOLS=true' to make them be compiled with TDengine.
|
||||
|
||||
To build the [taosTools](https://github.com/taosdata/taos-tools) on Ubuntu/Debian, the following packages need to be installed.
|
||||
|
||||
```bash
|
||||
sudo yum install -y gcc gcc-c++ make cmake git
|
||||
sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config
|
||||
```
|
||||
|
||||
### CentOS 7
|
||||
|
||||
```bash
|
||||
sudo yum install epel-release
|
||||
sudo yum update
|
||||
sudo yum install -y gcc gcc-c++ make cmake3 git openssl-devel
|
||||
sudo ln -sf /usr/bin/cmake3 /usr/bin/cmake
|
||||
```
|
||||
|
||||
To install openjdk-8:
|
||||
|
||||
```bash
|
||||
sudo yum install -y java-1.8.0-openjdk
|
||||
```
|
||||
|
||||
To install Apache Maven:
|
||||
|
||||
```bash
|
||||
sudo yum install -y maven
|
||||
```
|
||||
|
||||
### Centos 8 & Fedora:
|
||||
### CentOS 8 & Fedora
|
||||
|
||||
```bash
|
||||
sudo dnf install -y gcc gcc-c++ make cmake epel-release git
|
||||
sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel
|
||||
```
|
||||
|
||||
To install openjdk-8:
|
||||
|
||||
```bash
|
||||
sudo dnf install -y java-1.8.0-openjdk
|
||||
```
|
||||
|
||||
To install Apache Maven:
|
||||
|
||||
```bash
|
||||
sudo dnf install -y maven
|
||||
```
|
||||
|
||||
#### Install build dependencies for taosTools on CentOS
|
||||
|
||||
To build the [taosTools](https://github.com/taosdata/taos-tools) on CentOS, the following packages need to be installed.
|
||||
|
||||
```bash
|
||||
sudo yum install zlib-devel xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libstdc++-static openssl-devel
|
||||
```
|
||||
|
||||
Note: Since snappy lacks pkg-config support (refer to [link](https://github.com/google/snappy/pull/86)), it lead a cmake prompt libsnappy not found. But snappy will works well.
|
||||
|
||||
### Setup golang environment
|
||||
|
||||
TDengine includes few components developed by Go language. Please refer to golang.org official documentation for golang environment setup.
|
||||
|
||||
Please use version 1.14+. For the user in China, we recommend using a proxy to accelerate package downloading.
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
### Setup rust environment
|
||||
|
||||
TDengine includees few compoments developed by Rust language. Please refer to rust-lang.org official documentation for rust environment setup.
|
||||
|
||||
## Get the source codes
|
||||
|
||||
First of all, you may clone the source codes from github:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/taosdata/TDengine.git
|
||||
cd TDengine
|
||||
```
|
||||
|
||||
The connectors for go & grafana have been moved to separated repositories,
|
||||
The connectors for go & Grafana and some tools have been moved to separated repositories,
|
||||
so you should run this command in the TDengine directory to install them:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
You can modify the file ~/.gitconfig to use ssh protocol instead of https for better download speed. You need to upload ssh public key to GitHub first. Please refer to GitHub official documentation for detail.
|
||||
|
||||
```
|
||||
[url "git@github.com:"]
|
||||
insteadOf = https://github.com/
|
||||
```
|
||||
|
||||
## Build TDengine
|
||||
|
||||
### On Linux platform
|
||||
|
||||
You can run the bash script `build.sh` to build both TDengine and taosTools including taosBenchmark and taosdump as below:
|
||||
|
||||
```bash
|
||||
mkdir debug && cd debug
|
||||
cmake .. && cmake --build .
|
||||
./build.sh
|
||||
```
|
||||
|
||||
It equals to execute following commands:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
mkdir debug
|
||||
cd debug
|
||||
cmake .. -DBUILD_TOOLS=true
|
||||
make
|
||||
```
|
||||
|
||||
Note TDengine 2.3.x.0 and later use a component named 'taosAdapter' to play http daemon role by default instead of the http daemon embedded in the early version of TDengine. The taosAdapter is programmed by go language. If you pull TDengine source code to the latest from an existing codebase, please execute 'git submodule update --init --recursive' to pull taosAdapter source code. Please install go language version 1.14 or above for compiling taosAdapter. If you meet difficulties regarding 'go mod', especially you are from China, you can use a proxy to solve the problem.
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
The embedded http daemon still be built from TDengine source code by default. Or you can use the following command to choose to build taosAdapter.
|
||||
|
||||
```
|
||||
cmake .. -DBUILD_HTTP=false
|
||||
```
|
||||
|
||||
You can use Jemalloc as memory allocator instead of glibc:
|
||||
|
||||
```
|
||||
apt install autoconf
|
||||
cmake .. -DJEMALLOC_ENABLED=true
|
||||
|
@ -120,24 +222,28 @@ TDengine build script can detect the host machine's architecture on X86-64, X86,
|
|||
You can also specify CPUTYPE option like aarch64 or aarch32 too if the detection result is not correct:
|
||||
|
||||
aarch64:
|
||||
|
||||
```bash
|
||||
cmake .. -DCPUTYPE=aarch64 && cmake --build .
|
||||
```
|
||||
|
||||
aarch32:
|
||||
|
||||
```bash
|
||||
cmake .. -DCPUTYPE=aarch32 && cmake --build .
|
||||
```
|
||||
|
||||
mips64:
|
||||
|
||||
```bash
|
||||
cmake .. -DCPUTYPE=mips64 && cmake --build .
|
||||
```
|
||||
|
||||
### On Windows platform
|
||||
|
||||
If you use Visual Studio 2013, please open a command window by executing "cmd.exe".
|
||||
If you use the Visual Studio 2013, please open a command window by executing "cmd.exe".
|
||||
Please specify "amd64" for 64 bits Windows or specify "x86" is for 32 bits Windows when you execute vcvarsall.bat.
|
||||
|
||||
```cmd
|
||||
mkdir debug && cd debug
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" < amd64 | x86 >
|
||||
|
@ -145,7 +251,7 @@ cmake .. -G "NMake Makefiles"
|
|||
nmake
|
||||
```
|
||||
|
||||
If you use Visual Studio 2019 or 2017:
|
||||
If you use the Visual Studio 2019 or 2017:
|
||||
|
||||
please open a command window by executing "cmd.exe".
|
||||
Please specify "x64" for 64 bits Windows or specify "x86" is for 32 bits Windows when you execute vcvarsall.bat.
|
||||
|
@ -158,15 +264,14 @@ nmake
|
|||
```
|
||||
|
||||
Or, you can simply open a command window by clicking Windows Start -> "Visual Studio < 2019 | 2017 >" folder -> "x64 Native Tools Command Prompt for VS < 2019 | 2017 >" or "x86 Native Tools Command Prompt for VS < 2019 | 2017 >" depends what architecture your Windows is, then execute commands as follows:
|
||||
|
||||
```cmd
|
||||
mkdir debug && cd debug
|
||||
cmake .. -G "NMake Makefiles"
|
||||
nmake
|
||||
```
|
||||
|
||||
If you use Visual Studio 2022, the only change is the default path of `vcvarsall.bat`, which is `C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat`.
|
||||
|
||||
### On Mac OS X platform
|
||||
### On macOS platform
|
||||
|
||||
Please install XCode command line tools and cmake. Verified with XCode 11.4+ on Catalina and Big Sur.
|
||||
|
||||
|
@ -177,7 +282,10 @@ cmake .. && cmake --build .
|
|||
|
||||
# Installing
|
||||
|
||||
After building successfully, TDengine can be installed by: (On Windows platform, the following command should be `nmake install`)
|
||||
## On Linux platform
|
||||
|
||||
After building successfully, TDengine can be installed by
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
@ -186,68 +294,129 @@ Users can find more information about directories installed on the system in the
|
|||
Users can also choose to [install from packages](https://www.taosdata.com/en/getting-started/#Install-from-Package) for it.
|
||||
|
||||
To start the service after installation, in a terminal, use:
|
||||
|
||||
```bash
|
||||
sudo systemctl start taosd
|
||||
```
|
||||
|
||||
Then users can use the [TDengine shell](https://www.taosdata.com/en/getting-started/#TDengine-Shell) to connect the TDengine server. In a terminal, use:
|
||||
|
||||
```bash
|
||||
taos
|
||||
```
|
||||
|
||||
If TDengine shell connects the server successfully, welcome messages and version info are printed. Otherwise, an error message is shown.
|
||||
|
||||
### Install TDengine by apt-get
|
||||
|
||||
If you use Debian or Ubuntu system, you can use 'apt-get' command to install TDengine from official repository. Please use following commands to setup:
|
||||
|
||||
```
|
||||
wget -qO - http://repos.taosdata.com/tdengine.key | sudo apt-key add -
|
||||
echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-stable stable main" | sudo tee /etc/apt/sources.list.d/tdengine-stable.list
|
||||
[Optional] echo "deb [arch=amd64] http://repos.taosdata.com/tdengine-beta beta main" | sudo tee /etc/apt/sources.list.d/tdengine-beta.list
|
||||
sudo apt-get update
|
||||
apt-cache policy tdengine
|
||||
sudo apt-get install tdengine
|
||||
```
|
||||
|
||||
## On Windows platform
|
||||
|
||||
After building successfully, TDengine can be installed by:
|
||||
|
||||
```cmd
|
||||
nmake install
|
||||
```
|
||||
|
||||
## On macOS platform
|
||||
|
||||
After building successfully, TDengine can be installed by:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
To start the service after installation, config `.plist` file first, in a terminal, use:
|
||||
|
||||
```bash
|
||||
sudo cp ../packaging/macOS/com.taosdata.tdengine.plist /Library/LaunchDaemons
|
||||
```
|
||||
|
||||
To start the service, in a terminal, use:
|
||||
|
||||
```bash
|
||||
sudo launchctl load /Library/LaunchDaemons/com.taosdata.tdengine.plist
|
||||
```
|
||||
|
||||
To stop the service, in a terminal, use:
|
||||
|
||||
```bash
|
||||
sudo launchctl unload /Library/LaunchDaemons/com.taosdata.tdengine.plist
|
||||
```
|
||||
|
||||
## Quick Run
|
||||
|
||||
If you don't want to run TDengine as a service, you can run it in current shell. For example, to quickly start a TDengine server after building, run the command below in terminal: (We take Linux as an example, command on Windows will be `taosd.exe`)
|
||||
|
||||
```bash
|
||||
./build/bin/taosd -c test/cfg
|
||||
```
|
||||
|
||||
In another terminal, use the TDengine shell to connect the server:
|
||||
|
||||
```bash
|
||||
./build/bin/taos -c test/cfg
|
||||
```
|
||||
|
||||
option "-c test/cfg" specifies the system configuration file directory.
|
||||
option "-c test/cfg" specifies the system configuration file directory.
|
||||
|
||||
# Try TDengine
|
||||
|
||||
It is easy to run SQL commands from TDengine shell which is the same as other SQL databases.
|
||||
|
||||
```sql
|
||||
create database db;
|
||||
use db;
|
||||
create table t (ts timestamp, a int);
|
||||
insert into t values ('2019-07-15 00:00:00', 1);
|
||||
insert into t values ('2019-07-15 01:00:00', 2);
|
||||
select * from t;
|
||||
drop database db;
|
||||
CREATE DATABASE demo;
|
||||
USE demo;
|
||||
CREATE TABLE t (ts TIMESTAMP, speed INT);
|
||||
INSERT INTO t VALUES('2019-07-15 00:00:00', 10);
|
||||
INSERT INTO t VALUES('2019-07-15 01:00:00', 20);
|
||||
SELECT * FROM t;
|
||||
ts | speed |
|
||||
===================================
|
||||
19-07-15 00:00:00.000| 10|
|
||||
19-07-15 01:00:00.000| 20|
|
||||
Query OK, 2 row(s) in set (0.001700s)
|
||||
```
|
||||
|
||||
# Developing with TDengine
|
||||
### Official Connectors
|
||||
|
||||
## Official Connectors
|
||||
|
||||
TDengine provides abundant developing tools for users to develop on TDengine. Follow the links below to find your desired connectors and relevant documentation.
|
||||
|
||||
- [Java](https://www.taosdata.com/en/documentation/connector/#Java-Connector)
|
||||
- [C/C++](https://www.taosdata.com/en/documentation/connector/#C/C++-Connector)
|
||||
- [Python](https://www.taosdata.com/en/documentation/connector/#Python-Connector)
|
||||
- [Go](https://www.taosdata.com/en/documentation/connector/#Go-Connector)
|
||||
- [RESTful API](https://www.taosdata.com/en/documentation/connector/#RESTful-Connector)
|
||||
- [Node.js](https://www.taosdata.com/en/documentation/connector/#Node.js-Connector)
|
||||
- [Java](https://www.taosdata.com/en/documentation/connector/java)
|
||||
- [C/C++](https://www.taosdata.com/en/documentation/connector#c-cpp)
|
||||
- [Python](https://www.taosdata.com/en/documentation/connector#python)
|
||||
- [Go](https://www.taosdata.com/en/documentation/connector#go)
|
||||
- [RESTful API](https://www.taosdata.com/en/documentation/connector#restful)
|
||||
- [Node.js](https://www.taosdata.com/en/documentation/connector#nodejs)
|
||||
- [Rust](https://www.taosdata.com/en/documentation/connector/rust)
|
||||
|
||||
### Third Party Connectors
|
||||
## Third Party Connectors
|
||||
|
||||
The TDengine community has also kindly built some of their own connectors! Follow the links below to find the source code for them.
|
||||
|
||||
- [Rust Connector](https://github.com/taosdata/TDengine/tree/master/tests/examples/rust)
|
||||
- [Rust Bindings](https://github.com/songtianyi/tdengine-rust-bindings/tree/master/examples)
|
||||
- [.Net Core Connector](https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos)
|
||||
- [Lua Connector](https://github.com/taosdata/TDengine/tree/develop/tests/examples/lua)
|
||||
|
||||
# How to run the test cases and how to add a new test case?
|
||||
TDengine's test framework and all test cases are fully open source.
|
||||
Please refer to [this document](tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md) for how to run test and develop new test case.
|
||||
# How to run the test cases and how to add a new test case
|
||||
|
||||
TDengine's test framework and all test cases are fully open source.
|
||||
Please refer to [this document](https://github.com/taosdata/TDengine/blob/develop/tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md) for how to run test and develop new test case.
|
||||
|
||||
# TDengine Roadmap
|
||||
|
||||
- Support event-driven stream computing
|
||||
- Support user defined functions
|
||||
- Support MQTT connection
|
||||
|
|
|
@ -18,6 +18,14 @@ if (NOT DEFINED TD_GRANT)
|
|||
SET(TD_GRANT FALSE)
|
||||
endif()
|
||||
|
||||
IF ("${WEBSOCKET}" MATCHES "true")
|
||||
SET(TD_WEBSOCKET TRUE)
|
||||
MESSAGE("Enable websocket")
|
||||
ADD_DEFINITIONS(-DWEBSOCKET)
|
||||
ELSE ()
|
||||
SET(TD_WEBSOCKET FALSE)
|
||||
ENDIF ()
|
||||
|
||||
IF ("${BUILD_HTTP}" STREQUAL "")
|
||||
IF (TD_LINUX)
|
||||
IF (TD_ARM_32)
|
||||
|
@ -97,10 +105,10 @@ ELSE ()
|
|||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
|
||||
ENDIF ()
|
||||
|
||||
IF (${SANITIZER} MATCHES "true")
|
||||
IF (${BUILD_SANITIZER})
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -fsanitize=address -fsanitize=undefined -fsanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=shift-base -fno-sanitize=alignment -g3 -Wformat=0")
|
||||
MESSAGE(STATUS "Will compile with Address Sanitizer!")
|
||||
MESSAGE(STATUS "Will compile with Address Sanitizer!")
|
||||
ELSE ()
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=0")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=0")
|
||||
|
|
|
@ -51,6 +51,13 @@ IF(${TD_WINDOWS})
|
|||
"If build unit tests using googletest"
|
||||
ON
|
||||
)
|
||||
ELSEIF (TD_DARWIN_64)
|
||||
add_definitions(-DCOMPILER_SUPPORTS_CXX13)
|
||||
option(
|
||||
BUILD_TEST
|
||||
"If build unit tests using googletest"
|
||||
ON
|
||||
)
|
||||
ELSE ()
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13)
|
||||
|
@ -70,6 +77,12 @@ ELSE ()
|
|||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
option(
|
||||
BUILD_SANITIZER
|
||||
"If build addr2line"
|
||||
OFF
|
||||
)
|
||||
|
||||
option(
|
||||
BUILD_ADDR2LINE
|
||||
"If build addr2line"
|
||||
|
|
|
@ -379,11 +379,11 @@ We still use the hypothetical environment from Chapter 4. There are three measur
|
|||
|
||||
### Storage resource estimation
|
||||
|
||||
Assuming that the number of sensor devices that generate data and need to be stored is `n`, the frequency of data generation is `t` per second, and the length of each record is `L` bytes, the scale of data generated per day is `n * t * L` bytes. Assuming the compression ratio is `C`, the daily data size is `(n * t * L)/C` bytes. The storage resources are estimated to accommodate the data scale for 1.5 years. In the production environment, the compression ratio C of TDengine is generally between 5 and 7.
|
||||
Assuming that the number of sensor devices that generate data and need to be stored is `n`, the frequency of data generation is `t` per second, and the length of each record is `L` bytes, the scale of data generated per day is `86400 * n * t * L` bytes. Assuming the compression ratio is `C`, the daily data size is `(86400 * n * t * L)/C` bytes. The storage resources are estimated to accommodate the data scale for 1.5 years. In the production environment, the compression ratio C of TDengine is generally between 5 and 7.
|
||||
With additional 20% redundancy, you can calculate the required storage resources:
|
||||
|
||||
```matlab
|
||||
(n * t * L) * (365 * 1.5) * (1+20%)/C
|
||||
(86400 * n * t * L) * (365 * 1.5) * (1+20%)/C
|
||||
````
|
||||
Substituting in the above formula, the raw data generated every year is 11.8TB without considering the label information. Note that tag information is associated with each timeline in TDengine, not every record. The amount of data to be recorded is somewhat reduced relative to the generated data, and label data can be ignored as a whole. Assuming a compression ratio of 5, the size of the retained data ends up being 2.56 TB.
|
||||
|
||||
|
|
|
@ -367,10 +367,10 @@ WHERE ts>=1510560000 AND ts<=1515000009
|
|||
|
||||
### 存储资源估算
|
||||
|
||||
假设产生数据并需要存储的传感器设备数量为 `n`,数据生成的频率为`t`条/秒,每条记录的长度为 `L` bytes,则每天产生的数据规模为 `n×t×L` bytes。假设压缩比为 C,则每日产生数据规模为 `(n×t×L)/C` bytes。存储资源预估为能够容纳 1.5 年的数据规模,生产环境下 TDengine 的压缩比 C 一般在 5 ~ 7 之间,同时为最后结果增加 20% 的冗余,可计算得到需要存储资源:
|
||||
假设产生数据并需要存储的传感器设备数量为 `n`,数据生成的频率为`t`条/秒,每条记录的长度为 `L` bytes,则每天产生的数据规模为 `86400×n×t×L` bytes。假设压缩比为 C,则每日产生数据规模为 `(86400×n×t×L)/C` bytes。存储资源预估为能够容纳 1.5 年的数据规模,生产环境下 TDengine 的压缩比 C 一般在 5 ~ 7 之间,同时为最后结果增加 20% 的冗余,可计算得到需要存储资源:
|
||||
|
||||
```matlab
|
||||
(n×t×L)×(365×1.5)×(1+20%)/C
|
||||
(86400×n×t×L)×(365×1.5)×(1+20%)/C
|
||||
```
|
||||
|
||||
结合以上的计算公式,将参数带入计算公式,在不考虑标签信息的情况下,每年产生的原始数据规模是 11.8TB。需要注意的是,由于标签信息在 TDengine 中关联到每个时间线,并不是每条记录。所以需要记录的数据量规模相对于产生的数据有一定的降低,而这部分标签数据整体上可以忽略不记。假设压缩比为 5,则保留的数据规模最终为 2.56 TB。
|
||||
|
|
|
@ -28,15 +28,23 @@ static void msg_process(TAOS_RES* msg) {
|
|||
printf("db: %s\n", tmq_get_db_name(msg));
|
||||
printf("vg: %d\n", tmq_get_vgroup_id(msg));
|
||||
if (tmq_get_res_type(msg) == TMQ_RES_TABLE_META) {
|
||||
void* meta;
|
||||
int32_t metaLen;
|
||||
tmq_get_raw_meta(msg, &meta, &metaLen);
|
||||
tmq_raw_data *raw = tmq_get_raw_meta(msg);
|
||||
if(raw){
|
||||
TAOS* pConn = taos_connect("192.168.1.86", "root", "taosdata", "abc1", 0);
|
||||
if (pConn == NULL) {
|
||||
return;
|
||||
}
|
||||
int32_t ret = taos_write_raw_meta(pConn, raw);
|
||||
printf("write raw data: %s\n", tmq_err2str(ret));
|
||||
free(raw);
|
||||
taos_close(pConn);
|
||||
}
|
||||
char* result = tmq_get_json_meta(msg);
|
||||
if(result){
|
||||
printf("meta result: %s\n", result);
|
||||
free(result);
|
||||
}
|
||||
printf("meta, len is %d\n", metaLen);
|
||||
printf("meta:%p\n", raw);
|
||||
return;
|
||||
}
|
||||
while (1) {
|
||||
|
@ -241,7 +249,7 @@ int32_t create_topic() {
|
|||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create topic topic_ctb_column with meta as database abc1");
|
||||
// pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from st1");
|
||||
/*pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from st1");*/
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes));
|
||||
return -1;
|
||||
|
@ -302,7 +310,7 @@ tmq_t* build_consumer() {
|
|||
tmq_conf_set(conf, "msg.with.table.name", "true");
|
||||
tmq_conf_set(conf, "enable.auto.commit", "true");
|
||||
|
||||
tmq_conf_set(conf, "experimental.snapshot.enable", "false");
|
||||
/*tmq_conf_set(conf, "experimental.snapshot.enable", "true");*/
|
||||
|
||||
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
||||
tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
|
||||
|
|
|
@ -260,15 +260,16 @@ enum tmq_res_t {
|
|||
};
|
||||
|
||||
typedef enum tmq_res_t tmq_res_t;
|
||||
typedef struct tmq_raw_data tmq_raw_data;
|
||||
|
||||
DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res);
|
||||
DLL_EXPORT int32_t tmq_get_raw_meta(TAOS_RES *res, void **raw_meta, int32_t *raw_meta_len);
|
||||
DLL_EXPORT int32_t taos_write_raw_meta(TAOS *res, void *raw_meta, int32_t raw_meta_len);
|
||||
DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed.
|
||||
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
|
||||
DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res);
|
||||
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
||||
DLL_EXPORT const char *tmq_get_table_name(TAOS_RES *res);
|
||||
DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res);
|
||||
DLL_EXPORT tmq_raw_data *tmq_get_raw_meta(TAOS_RES *res);
|
||||
DLL_EXPORT int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data *raw_meta);
|
||||
DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed.
|
||||
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
|
||||
DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res);
|
||||
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
||||
DLL_EXPORT const char *tmq_get_table_name(TAOS_RES *res);
|
||||
|
||||
/* ------------------------------ TMQ END -------------------------------- */
|
||||
|
||||
|
|
|
@ -32,6 +32,18 @@ enum {
|
|||
TMQ_CONF__RESET_OFFSET__LATEST = -1,
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
#define IS_META_MSG(x) ( \
|
||||
x == TDMT_VND_CREATE_STB \
|
||||
|| x == TDMT_VND_ALTER_STB \
|
||||
|| x == TDMT_VND_DROP_STB \
|
||||
|| x == TDMT_VND_CREATE_TABLE \
|
||||
|| x == TDMT_VND_ALTER_TABLE \
|
||||
|| x == TDMT_VND_DROP_TABLE \
|
||||
|| x == TDMT_VND_DROP_TTL_TABLE \
|
||||
)
|
||||
// clang-format on
|
||||
|
||||
enum {
|
||||
TMQ_MSG_TYPE__DUMMY = 0,
|
||||
TMQ_MSG_TYPE__POLL_RSP,
|
||||
|
@ -43,7 +55,8 @@ enum {
|
|||
enum {
|
||||
STREAM_INPUT__DATA_SUBMIT = 1,
|
||||
STREAM_INPUT__DATA_BLOCK,
|
||||
STREAM_INPUT__DATA_SCAN,
|
||||
// STREAM_INPUT__TABLE_SCAN,
|
||||
STREAM_INPUT__TQ_SCAN,
|
||||
STREAM_INPUT__DATA_RETRIEVE,
|
||||
STREAM_INPUT__TRIGGER,
|
||||
STREAM_INPUT__CHECKPOINT,
|
||||
|
@ -76,8 +89,6 @@ typedef struct {
|
|||
#pragma pack(push, 1)
|
||||
typedef struct SColumnDataAgg {
|
||||
int16_t colId;
|
||||
int16_t minIndex;
|
||||
int16_t maxIndex;
|
||||
int16_t numOfNull;
|
||||
int64_t sum;
|
||||
int64_t max;
|
||||
|
@ -105,6 +116,21 @@ typedef struct SSDataBlock {
|
|||
SDataBlockInfo info;
|
||||
} SSDataBlock;
|
||||
|
||||
enum {
|
||||
FETCH_TYPE__DATA = 1,
|
||||
FETCH_TYPE__META,
|
||||
FETCH_TYPE__NONE,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int8_t fetchType;
|
||||
STqOffsetVal offset;
|
||||
union {
|
||||
SSDataBlock data;
|
||||
void* meta;
|
||||
};
|
||||
} SFetchRet;
|
||||
|
||||
typedef struct SVarColAttr {
|
||||
int32_t* offset; // start position for each entry in the list
|
||||
uint32_t length; // used buffer size that contain the valid data
|
||||
|
@ -129,8 +155,8 @@ typedef struct SQueryTableDataCond {
|
|||
int32_t numOfCols;
|
||||
SColumnInfo* colList;
|
||||
int32_t type; // data block load type:
|
||||
int32_t numOfTWindows;
|
||||
STimeWindow* twindows;
|
||||
// int32_t numOfTWindows;
|
||||
STimeWindow twindows;
|
||||
int64_t startVersion;
|
||||
int64_t endVersion;
|
||||
} SQueryTableDataCond;
|
||||
|
|
|
@ -231,7 +231,7 @@ SSDataBlock* createDataBlock();
|
|||
int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData);
|
||||
|
||||
SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId);
|
||||
SColumnInfoData* bdGetColumnInfoData(SSDataBlock* pBlock, int32_t index);
|
||||
SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index);
|
||||
|
||||
void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols, int8_t needCompress);
|
||||
const char* blockDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t numOfRows, const char* pData);
|
||||
|
|
|
@ -55,11 +55,11 @@ extern int32_t tMsgDict[];
|
|||
|
||||
#define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8)
|
||||
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
|
||||
#define TMSG_INFO(TYPE) \
|
||||
((TYPE) >= 0 && \
|
||||
((TYPE) < TDMT_DND_MAX_MSG | (TYPE) < TDMT_MND_MAX_MSG | (TYPE) < TDMT_VND_MAX_MSG | (TYPE) < TDMT_SCH_MAX_MSG | \
|
||||
(TYPE) < TDMT_STREAM_MAX_MSG | (TYPE) < TDMT_MON_MAX_MSG | (TYPE) < TDMT_SYNC_MAX_MSG)) \
|
||||
? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \
|
||||
#define TMSG_INFO(TYPE) \
|
||||
((TYPE) >= 0 && ((TYPE) < TDMT_DND_MAX_MSG || (TYPE) < TDMT_MND_MAX_MSG || (TYPE) < TDMT_VND_MAX_MSG || \
|
||||
(TYPE) < TDMT_SCH_MAX_MSG || (TYPE) < TDMT_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || \
|
||||
(TYPE) < TDMT_SYNC_MAX_MSG)) \
|
||||
? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \
|
||||
: 0
|
||||
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
|
||||
|
||||
|
@ -169,6 +169,9 @@ typedef enum _mgmt_table {
|
|||
#define TD_CHILD_TABLE TSDB_CHILD_TABLE
|
||||
#define TD_NORMAL_TABLE TSDB_NORMAL_TABLE
|
||||
|
||||
#define TD_REQ_FROM_APP 0
|
||||
#define TD_REQ_FROM_TAOX 1
|
||||
|
||||
typedef struct {
|
||||
int32_t vgId;
|
||||
char* dbFName;
|
||||
|
@ -432,25 +435,30 @@ static FORCE_INLINE int32_t tDecodeSSchemaWrapperEx(SDecoder* pDecoder, SSchemaW
|
|||
STSchema* tdGetSTSChemaFromSSChema(SSchema** pSchema, int32_t nCols);
|
||||
|
||||
typedef struct {
|
||||
char name[TSDB_TABLE_FNAME_LEN];
|
||||
int8_t igExists;
|
||||
int64_t delay1;
|
||||
int64_t delay2;
|
||||
int64_t watermark1;
|
||||
int64_t watermark2;
|
||||
int32_t ttl;
|
||||
int32_t numOfColumns;
|
||||
int32_t numOfTags;
|
||||
int32_t numOfFuncs;
|
||||
int32_t commentLen;
|
||||
int32_t ast1Len;
|
||||
int32_t ast2Len;
|
||||
SArray* pColumns; // array of SField
|
||||
SArray* pTags; // array of SField
|
||||
SArray* pFuncs;
|
||||
char* pComment;
|
||||
char* pAst1;
|
||||
char* pAst2;
|
||||
char name[TSDB_TABLE_FNAME_LEN];
|
||||
int8_t igExists;
|
||||
int8_t source; // 1-taosX or 0-taosClient
|
||||
int8_t reserved[6];
|
||||
tb_uid_t suid;
|
||||
int64_t delay1;
|
||||
int64_t delay2;
|
||||
int64_t watermark1;
|
||||
int64_t watermark2;
|
||||
int32_t ttl;
|
||||
int32_t colVer;
|
||||
int32_t tagVer;
|
||||
int32_t numOfColumns;
|
||||
int32_t numOfTags;
|
||||
int32_t numOfFuncs;
|
||||
int32_t commentLen;
|
||||
int32_t ast1Len;
|
||||
int32_t ast2Len;
|
||||
SArray* pColumns; // array of SField
|
||||
SArray* pTags; // array of SField
|
||||
SArray* pFuncs;
|
||||
char* pComment;
|
||||
char* pAst1;
|
||||
char* pAst2;
|
||||
} SMCreateStbReq;
|
||||
|
||||
int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq);
|
||||
|
@ -458,8 +466,11 @@ int32_t tDeserializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pR
|
|||
void tFreeSMCreateStbReq(SMCreateStbReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
char name[TSDB_TABLE_FNAME_LEN];
|
||||
int8_t igNotExists;
|
||||
char name[TSDB_TABLE_FNAME_LEN];
|
||||
int8_t igNotExists;
|
||||
int8_t source; // 1-taosX or 0-taosClient
|
||||
int8_t reserved[6];
|
||||
tb_uid_t suid;
|
||||
} SMDropStbReq;
|
||||
|
||||
int32_t tSerializeSMDropStbReq(void* buf, int32_t bufLen, SMDropStbReq* pReq);
|
||||
|
@ -468,8 +479,6 @@ int32_t tDeserializeSMDropStbReq(void* buf, int32_t bufLen, SMDropStbReq* pReq);
|
|||
typedef struct {
|
||||
char name[TSDB_TABLE_FNAME_LEN];
|
||||
int8_t alterType;
|
||||
int32_t tagVer;
|
||||
int32_t colVer;
|
||||
int32_t numOfFields;
|
||||
SArray* pFields;
|
||||
int32_t ttl;
|
||||
|
@ -665,6 +674,7 @@ typedef struct {
|
|||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
int32_t sversion;
|
||||
int32_t tversion;
|
||||
int64_t affectedRows;
|
||||
} SQueryTableRsp;
|
||||
|
||||
int32_t tSerializeSQueryTableRsp(void* buf, int32_t bufLen, SQueryTableRsp* pRsp);
|
||||
|
@ -805,6 +815,13 @@ typedef struct {
|
|||
int32_t tSerializeSDbCfgReq(void* buf, int32_t bufLen, SDbCfgReq* pReq);
|
||||
int32_t tDeserializeSDbCfgReq(void* buf, int32_t bufLen, SDbCfgReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
char db[TSDB_DB_FNAME_LEN];
|
||||
} STrimDbReq;
|
||||
|
||||
int32_t tSerializeSTrimDbReq(void* buf, int32_t bufLen, STrimDbReq* pReq);
|
||||
int32_t tDeserializeSTrimDbReq(void* buf, int32_t bufLen, STrimDbReq* pReq);
|
||||
|
||||
typedef struct {
|
||||
int32_t numOfVgroups;
|
||||
int32_t numOfStables;
|
||||
|
@ -1510,6 +1527,7 @@ typedef struct SSubQueryMsg {
|
|||
int32_t execId;
|
||||
int8_t taskType;
|
||||
int8_t explain;
|
||||
int8_t needFetch;
|
||||
uint32_t sqlLen; // the query sql,
|
||||
uint32_t phyLen;
|
||||
char msg[];
|
||||
|
@ -2826,8 +2844,8 @@ typedef struct {
|
|||
|
||||
static FORCE_INLINE int32_t tEncodeSMqMetaRsp(void** buf, const SMqMetaRsp* pRsp) {
|
||||
int32_t tlen = 0;
|
||||
tlen += taosEncodeFixedI64(buf, pRsp->reqOffset);
|
||||
tlen += taosEncodeFixedI64(buf, pRsp->rspOffset);
|
||||
// tlen += taosEncodeFixedI64(buf, pRsp->reqOffset);
|
||||
// tlen += taosEncodeFixedI64(buf, pRsp->rspOffset);
|
||||
tlen += taosEncodeFixedI16(buf, pRsp->resMsgType);
|
||||
tlen += taosEncodeFixedI32(buf, pRsp->metaRspLen);
|
||||
tlen += taosEncodeBinary(buf, pRsp->metaRsp, pRsp->metaRspLen);
|
||||
|
@ -2835,8 +2853,8 @@ static FORCE_INLINE int32_t tEncodeSMqMetaRsp(void** buf, const SMqMetaRsp* pRsp
|
|||
}
|
||||
|
||||
static FORCE_INLINE void* tDecodeSMqMetaRsp(const void* buf, SMqMetaRsp* pRsp) {
|
||||
buf = taosDecodeFixedI64(buf, &pRsp->reqOffset);
|
||||
buf = taosDecodeFixedI64(buf, &pRsp->rspOffset);
|
||||
// buf = taosDecodeFixedI64(buf, &pRsp->reqOffset);
|
||||
// buf = taosDecodeFixedI64(buf, &pRsp->rspOffset);
|
||||
buf = taosDecodeFixedI16(buf, &pRsp->resMsgType);
|
||||
buf = taosDecodeFixedI32(buf, &pRsp->metaRspLen);
|
||||
buf = taosDecodeBinary(buf, &pRsp->metaRsp, pRsp->metaRspLen);
|
||||
|
|
|
@ -116,6 +116,7 @@ enum {
|
|||
TD_DEF_MSG_TYPE(TDMT_MND_ALTER_DB, "alter-db", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_SYNC_DB, "sync-db", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_COMPACT_DB, "compact-db", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_TRIM_DB, "trim-db", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_GET_DB_CFG, "get-db-cfg", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_VGROUP_LIST, "vgroup-list", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_CREATE_FUNC, "create-func", NULL, NULL)
|
||||
|
@ -210,6 +211,7 @@ enum {
|
|||
TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_CONTINUE, "query-continue", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_HEARTBEAT, "query-heartbeat", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_FETCH, "fetch", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_MERGE_FETCH, "merge-fetch", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_CANCEL_TASK, "cancel-task", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "drop-task", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL)
|
||||
|
|
|
@ -37,6 +37,8 @@ typedef struct SName {
|
|||
char tname[TSDB_TABLE_NAME_LEN];
|
||||
} SName;
|
||||
|
||||
SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName);
|
||||
|
||||
int32_t tNameExtractFullName(const SName* name, char* dst);
|
||||
|
||||
int32_t tNameLen(const SName* name);
|
||||
|
|
|
@ -74,200 +74,202 @@
|
|||
#define TK_DATABASE 56
|
||||
#define TK_USE 57
|
||||
#define TK_FLUSH 58
|
||||
#define TK_IF 59
|
||||
#define TK_NOT 60
|
||||
#define TK_EXISTS 61
|
||||
#define TK_BUFFER 62
|
||||
#define TK_CACHELAST 63
|
||||
#define TK_COMP 64
|
||||
#define TK_DURATION 65
|
||||
#define TK_NK_VARIABLE 66
|
||||
#define TK_FSYNC 67
|
||||
#define TK_MAXROWS 68
|
||||
#define TK_MINROWS 69
|
||||
#define TK_KEEP 70
|
||||
#define TK_PAGES 71
|
||||
#define TK_PAGESIZE 72
|
||||
#define TK_PRECISION 73
|
||||
#define TK_REPLICA 74
|
||||
#define TK_STRICT 75
|
||||
#define TK_WAL 76
|
||||
#define TK_VGROUPS 77
|
||||
#define TK_SINGLE_STABLE 78
|
||||
#define TK_RETENTIONS 79
|
||||
#define TK_SCHEMALESS 80
|
||||
#define TK_NK_COLON 81
|
||||
#define TK_TABLE 82
|
||||
#define TK_NK_LP 83
|
||||
#define TK_NK_RP 84
|
||||
#define TK_STABLE 85
|
||||
#define TK_ADD 86
|
||||
#define TK_COLUMN 87
|
||||
#define TK_MODIFY 88
|
||||
#define TK_RENAME 89
|
||||
#define TK_TAG 90
|
||||
#define TK_SET 91
|
||||
#define TK_NK_EQ 92
|
||||
#define TK_USING 93
|
||||
#define TK_TAGS 94
|
||||
#define TK_COMMENT 95
|
||||
#define TK_BOOL 96
|
||||
#define TK_TINYINT 97
|
||||
#define TK_SMALLINT 98
|
||||
#define TK_INT 99
|
||||
#define TK_INTEGER 100
|
||||
#define TK_BIGINT 101
|
||||
#define TK_FLOAT 102
|
||||
#define TK_DOUBLE 103
|
||||
#define TK_BINARY 104
|
||||
#define TK_TIMESTAMP 105
|
||||
#define TK_NCHAR 106
|
||||
#define TK_UNSIGNED 107
|
||||
#define TK_JSON 108
|
||||
#define TK_VARCHAR 109
|
||||
#define TK_MEDIUMBLOB 110
|
||||
#define TK_BLOB 111
|
||||
#define TK_VARBINARY 112
|
||||
#define TK_DECIMAL 113
|
||||
#define TK_MAX_DELAY 114
|
||||
#define TK_WATERMARK 115
|
||||
#define TK_ROLLUP 116
|
||||
#define TK_TTL 117
|
||||
#define TK_SMA 118
|
||||
#define TK_FIRST 119
|
||||
#define TK_LAST 120
|
||||
#define TK_SHOW 121
|
||||
#define TK_DATABASES 122
|
||||
#define TK_TABLES 123
|
||||
#define TK_STABLES 124
|
||||
#define TK_MNODES 125
|
||||
#define TK_MODULES 126
|
||||
#define TK_QNODES 127
|
||||
#define TK_FUNCTIONS 128
|
||||
#define TK_INDEXES 129
|
||||
#define TK_ACCOUNTS 130
|
||||
#define TK_APPS 131
|
||||
#define TK_CONNECTIONS 132
|
||||
#define TK_LICENCE 133
|
||||
#define TK_GRANTS 134
|
||||
#define TK_QUERIES 135
|
||||
#define TK_SCORES 136
|
||||
#define TK_TOPICS 137
|
||||
#define TK_VARIABLES 138
|
||||
#define TK_BNODES 139
|
||||
#define TK_SNODES 140
|
||||
#define TK_CLUSTER 141
|
||||
#define TK_TRANSACTIONS 142
|
||||
#define TK_DISTRIBUTED 143
|
||||
#define TK_CONSUMERS 144
|
||||
#define TK_SUBSCRIPTIONS 145
|
||||
#define TK_LIKE 146
|
||||
#define TK_INDEX 147
|
||||
#define TK_FUNCTION 148
|
||||
#define TK_INTERVAL 149
|
||||
#define TK_TOPIC 150
|
||||
#define TK_AS 151
|
||||
#define TK_WITH 152
|
||||
#define TK_META 153
|
||||
#define TK_CONSUMER 154
|
||||
#define TK_GROUP 155
|
||||
#define TK_DESC 156
|
||||
#define TK_DESCRIBE 157
|
||||
#define TK_RESET 158
|
||||
#define TK_QUERY 159
|
||||
#define TK_CACHE 160
|
||||
#define TK_EXPLAIN 161
|
||||
#define TK_ANALYZE 162
|
||||
#define TK_VERBOSE 163
|
||||
#define TK_NK_BOOL 164
|
||||
#define TK_RATIO 165
|
||||
#define TK_NK_FLOAT 166
|
||||
#define TK_COMPACT 167
|
||||
#define TK_VNODES 168
|
||||
#define TK_IN 169
|
||||
#define TK_OUTPUTTYPE 170
|
||||
#define TK_AGGREGATE 171
|
||||
#define TK_BUFSIZE 172
|
||||
#define TK_STREAM 173
|
||||
#define TK_INTO 174
|
||||
#define TK_TRIGGER 175
|
||||
#define TK_AT_ONCE 176
|
||||
#define TK_WINDOW_CLOSE 177
|
||||
#define TK_IGNORE 178
|
||||
#define TK_EXPIRED 179
|
||||
#define TK_KILL 180
|
||||
#define TK_CONNECTION 181
|
||||
#define TK_TRANSACTION 182
|
||||
#define TK_BALANCE 183
|
||||
#define TK_VGROUP 184
|
||||
#define TK_MERGE 185
|
||||
#define TK_REDISTRIBUTE 186
|
||||
#define TK_SPLIT 187
|
||||
#define TK_SYNCDB 188
|
||||
#define TK_DELETE 189
|
||||
#define TK_INSERT 190
|
||||
#define TK_NULL 191
|
||||
#define TK_NK_QUESTION 192
|
||||
#define TK_NK_ARROW 193
|
||||
#define TK_ROWTS 194
|
||||
#define TK_TBNAME 195
|
||||
#define TK_QSTARTTS 196
|
||||
#define TK_QENDTS 197
|
||||
#define TK_WSTARTTS 198
|
||||
#define TK_WENDTS 199
|
||||
#define TK_WDURATION 200
|
||||
#define TK_CAST 201
|
||||
#define TK_NOW 202
|
||||
#define TK_TODAY 203
|
||||
#define TK_TIMEZONE 204
|
||||
#define TK_CLIENT_VERSION 205
|
||||
#define TK_SERVER_VERSION 206
|
||||
#define TK_SERVER_STATUS 207
|
||||
#define TK_CURRENT_USER 208
|
||||
#define TK_COUNT 209
|
||||
#define TK_LAST_ROW 210
|
||||
#define TK_BETWEEN 211
|
||||
#define TK_IS 212
|
||||
#define TK_NK_LT 213
|
||||
#define TK_NK_GT 214
|
||||
#define TK_NK_LE 215
|
||||
#define TK_NK_GE 216
|
||||
#define TK_NK_NE 217
|
||||
#define TK_MATCH 218
|
||||
#define TK_NMATCH 219
|
||||
#define TK_CONTAINS 220
|
||||
#define TK_JOIN 221
|
||||
#define TK_INNER 222
|
||||
#define TK_SELECT 223
|
||||
#define TK_DISTINCT 224
|
||||
#define TK_WHERE 225
|
||||
#define TK_PARTITION 226
|
||||
#define TK_BY 227
|
||||
#define TK_SESSION 228
|
||||
#define TK_STATE_WINDOW 229
|
||||
#define TK_SLIDING 230
|
||||
#define TK_FILL 231
|
||||
#define TK_VALUE 232
|
||||
#define TK_NONE 233
|
||||
#define TK_PREV 234
|
||||
#define TK_LINEAR 235
|
||||
#define TK_NEXT 236
|
||||
#define TK_HAVING 237
|
||||
#define TK_RANGE 238
|
||||
#define TK_EVERY 239
|
||||
#define TK_ORDER 240
|
||||
#define TK_SLIMIT 241
|
||||
#define TK_SOFFSET 242
|
||||
#define TK_LIMIT 243
|
||||
#define TK_OFFSET 244
|
||||
#define TK_ASC 245
|
||||
#define TK_NULLS 246
|
||||
#define TK_ID 247
|
||||
#define TK_NK_BITNOT 248
|
||||
#define TK_VALUES 249
|
||||
#define TK_IMPORT 250
|
||||
#define TK_NK_SEMI 251
|
||||
#define TK_FILE 252
|
||||
#define TK_TRIM 59
|
||||
#define TK_IF 60
|
||||
#define TK_NOT 61
|
||||
#define TK_EXISTS 62
|
||||
#define TK_BUFFER 63
|
||||
#define TK_CACHELAST 64
|
||||
#define TK_CACHELASTSIZE 65
|
||||
#define TK_COMP 66
|
||||
#define TK_DURATION 67
|
||||
#define TK_NK_VARIABLE 68
|
||||
#define TK_FSYNC 69
|
||||
#define TK_MAXROWS 70
|
||||
#define TK_MINROWS 71
|
||||
#define TK_KEEP 72
|
||||
#define TK_PAGES 73
|
||||
#define TK_PAGESIZE 74
|
||||
#define TK_PRECISION 75
|
||||
#define TK_REPLICA 76
|
||||
#define TK_STRICT 77
|
||||
#define TK_WAL 78
|
||||
#define TK_VGROUPS 79
|
||||
#define TK_SINGLE_STABLE 80
|
||||
#define TK_RETENTIONS 81
|
||||
#define TK_SCHEMALESS 82
|
||||
#define TK_NK_COLON 83
|
||||
#define TK_TABLE 84
|
||||
#define TK_NK_LP 85
|
||||
#define TK_NK_RP 86
|
||||
#define TK_STABLE 87
|
||||
#define TK_ADD 88
|
||||
#define TK_COLUMN 89
|
||||
#define TK_MODIFY 90
|
||||
#define TK_RENAME 91
|
||||
#define TK_TAG 92
|
||||
#define TK_SET 93
|
||||
#define TK_NK_EQ 94
|
||||
#define TK_USING 95
|
||||
#define TK_TAGS 96
|
||||
#define TK_COMMENT 97
|
||||
#define TK_BOOL 98
|
||||
#define TK_TINYINT 99
|
||||
#define TK_SMALLINT 100
|
||||
#define TK_INT 101
|
||||
#define TK_INTEGER 102
|
||||
#define TK_BIGINT 103
|
||||
#define TK_FLOAT 104
|
||||
#define TK_DOUBLE 105
|
||||
#define TK_BINARY 106
|
||||
#define TK_TIMESTAMP 107
|
||||
#define TK_NCHAR 108
|
||||
#define TK_UNSIGNED 109
|
||||
#define TK_JSON 110
|
||||
#define TK_VARCHAR 111
|
||||
#define TK_MEDIUMBLOB 112
|
||||
#define TK_BLOB 113
|
||||
#define TK_VARBINARY 114
|
||||
#define TK_DECIMAL 115
|
||||
#define TK_MAX_DELAY 116
|
||||
#define TK_WATERMARK 117
|
||||
#define TK_ROLLUP 118
|
||||
#define TK_TTL 119
|
||||
#define TK_SMA 120
|
||||
#define TK_FIRST 121
|
||||
#define TK_LAST 122
|
||||
#define TK_SHOW 123
|
||||
#define TK_DATABASES 124
|
||||
#define TK_TABLES 125
|
||||
#define TK_STABLES 126
|
||||
#define TK_MNODES 127
|
||||
#define TK_MODULES 128
|
||||
#define TK_QNODES 129
|
||||
#define TK_FUNCTIONS 130
|
||||
#define TK_INDEXES 131
|
||||
#define TK_ACCOUNTS 132
|
||||
#define TK_APPS 133
|
||||
#define TK_CONNECTIONS 134
|
||||
#define TK_LICENCE 135
|
||||
#define TK_GRANTS 136
|
||||
#define TK_QUERIES 137
|
||||
#define TK_SCORES 138
|
||||
#define TK_TOPICS 139
|
||||
#define TK_VARIABLES 140
|
||||
#define TK_BNODES 141
|
||||
#define TK_SNODES 142
|
||||
#define TK_CLUSTER 143
|
||||
#define TK_TRANSACTIONS 144
|
||||
#define TK_DISTRIBUTED 145
|
||||
#define TK_CONSUMERS 146
|
||||
#define TK_SUBSCRIPTIONS 147
|
||||
#define TK_LIKE 148
|
||||
#define TK_INDEX 149
|
||||
#define TK_FUNCTION 150
|
||||
#define TK_INTERVAL 151
|
||||
#define TK_TOPIC 152
|
||||
#define TK_AS 153
|
||||
#define TK_WITH 154
|
||||
#define TK_META 155
|
||||
#define TK_CONSUMER 156
|
||||
#define TK_GROUP 157
|
||||
#define TK_DESC 158
|
||||
#define TK_DESCRIBE 159
|
||||
#define TK_RESET 160
|
||||
#define TK_QUERY 161
|
||||
#define TK_CACHE 162
|
||||
#define TK_EXPLAIN 163
|
||||
#define TK_ANALYZE 164
|
||||
#define TK_VERBOSE 165
|
||||
#define TK_NK_BOOL 166
|
||||
#define TK_RATIO 167
|
||||
#define TK_NK_FLOAT 168
|
||||
#define TK_COMPACT 169
|
||||
#define TK_VNODES 170
|
||||
#define TK_IN 171
|
||||
#define TK_OUTPUTTYPE 172
|
||||
#define TK_AGGREGATE 173
|
||||
#define TK_BUFSIZE 174
|
||||
#define TK_STREAM 175
|
||||
#define TK_INTO 176
|
||||
#define TK_TRIGGER 177
|
||||
#define TK_AT_ONCE 178
|
||||
#define TK_WINDOW_CLOSE 179
|
||||
#define TK_IGNORE 180
|
||||
#define TK_EXPIRED 181
|
||||
#define TK_KILL 182
|
||||
#define TK_CONNECTION 183
|
||||
#define TK_TRANSACTION 184
|
||||
#define TK_BALANCE 185
|
||||
#define TK_VGROUP 186
|
||||
#define TK_MERGE 187
|
||||
#define TK_REDISTRIBUTE 188
|
||||
#define TK_SPLIT 189
|
||||
#define TK_SYNCDB 190
|
||||
#define TK_DELETE 191
|
||||
#define TK_INSERT 192
|
||||
#define TK_NULL 193
|
||||
#define TK_NK_QUESTION 194
|
||||
#define TK_NK_ARROW 195
|
||||
#define TK_ROWTS 196
|
||||
#define TK_TBNAME 197
|
||||
#define TK_QSTARTTS 198
|
||||
#define TK_QENDTS 199
|
||||
#define TK_WSTARTTS 200
|
||||
#define TK_WENDTS 201
|
||||
#define TK_WDURATION 202
|
||||
#define TK_CAST 203
|
||||
#define TK_NOW 204
|
||||
#define TK_TODAY 205
|
||||
#define TK_TIMEZONE 206
|
||||
#define TK_CLIENT_VERSION 207
|
||||
#define TK_SERVER_VERSION 208
|
||||
#define TK_SERVER_STATUS 209
|
||||
#define TK_CURRENT_USER 210
|
||||
#define TK_COUNT 211
|
||||
#define TK_LAST_ROW 212
|
||||
#define TK_BETWEEN 213
|
||||
#define TK_IS 214
|
||||
#define TK_NK_LT 215
|
||||
#define TK_NK_GT 216
|
||||
#define TK_NK_LE 217
|
||||
#define TK_NK_GE 218
|
||||
#define TK_NK_NE 219
|
||||
#define TK_MATCH 220
|
||||
#define TK_NMATCH 221
|
||||
#define TK_CONTAINS 222
|
||||
#define TK_JOIN 223
|
||||
#define TK_INNER 224
|
||||
#define TK_SELECT 225
|
||||
#define TK_DISTINCT 226
|
||||
#define TK_WHERE 227
|
||||
#define TK_PARTITION 228
|
||||
#define TK_BY 229
|
||||
#define TK_SESSION 230
|
||||
#define TK_STATE_WINDOW 231
|
||||
#define TK_SLIDING 232
|
||||
#define TK_FILL 233
|
||||
#define TK_VALUE 234
|
||||
#define TK_NONE 235
|
||||
#define TK_PREV 236
|
||||
#define TK_LINEAR 237
|
||||
#define TK_NEXT 238
|
||||
#define TK_HAVING 239
|
||||
#define TK_RANGE 240
|
||||
#define TK_EVERY 241
|
||||
#define TK_ORDER 242
|
||||
#define TK_SLIMIT 243
|
||||
#define TK_SOFFSET 244
|
||||
#define TK_LIMIT 245
|
||||
#define TK_OFFSET 246
|
||||
#define TK_ASC 247
|
||||
#define TK_NULLS 248
|
||||
#define TK_ID 249
|
||||
#define TK_NK_BITNOT 250
|
||||
#define TK_VALUES 251
|
||||
#define TK_IMPORT 252
|
||||
#define TK_NK_SEMI 253
|
||||
#define TK_FILE 254
|
||||
|
||||
#define TK_NK_SPACE 300
|
||||
#define TK_NK_COMMENT 301
|
||||
|
|
|
@ -45,6 +45,10 @@ typedef struct SDeleterParam {
|
|||
SArray* pUidList;
|
||||
} SDeleterParam;
|
||||
|
||||
typedef struct SInserterParam {
|
||||
SReadHandle* readHandle;
|
||||
} SInserterParam;
|
||||
|
||||
typedef struct SDataSinkStat {
|
||||
uint64_t cachedSize;
|
||||
} SDataSinkStat;
|
||||
|
@ -96,7 +100,7 @@ void dsEndPut(DataSinkHandle handle, uint64_t useconds);
|
|||
* @param handle
|
||||
* @param pLen data length
|
||||
*/
|
||||
void dsGetDataLength(DataSinkHandle handle, int32_t* pLen, bool* pQueryEnd);
|
||||
void dsGetDataLength(DataSinkHandle handle, int64_t* pLen, bool* pQueryEnd);
|
||||
|
||||
/**
|
||||
* Get data, the caller needs to allocate data memory.
|
||||
|
|
|
@ -30,15 +30,16 @@ struct SRpcMsg;
|
|||
struct SSubplan;
|
||||
|
||||
typedef struct SReadHandle {
|
||||
void* reader;
|
||||
void* tqReader;
|
||||
void* meta;
|
||||
void* config;
|
||||
void* vnode;
|
||||
void* mnd;
|
||||
SMsgCb* pMsgCb;
|
||||
|
||||
// int8_t initTsdbReader;
|
||||
bool tqReader;
|
||||
int64_t version;
|
||||
bool initMetaReader;
|
||||
bool initTableReader;
|
||||
bool initTqReader;
|
||||
} SReadHandle;
|
||||
|
||||
typedef enum {
|
||||
|
@ -52,7 +53,7 @@ typedef enum {
|
|||
* @param streamReadHandle
|
||||
* @return
|
||||
*/
|
||||
qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle);
|
||||
qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers);
|
||||
|
||||
/**
|
||||
* Switch the stream scan to snapshot mode
|
||||
|
@ -109,7 +110,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
|
|||
* @param tversion
|
||||
* @return
|
||||
*/
|
||||
int32_t qGetQueriedTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion,
|
||||
int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion,
|
||||
int32_t* tversion);
|
||||
|
||||
/**
|
||||
|
@ -157,7 +158,7 @@ int64_t qGetQueriedTableUid(qTaskInfo_t tinfo);
|
|||
*/
|
||||
int32_t qGetQualifiedTableIdList(void* pTableList, const char* tagCond, int32_t tagCondLen, SArray* pTableIdList);
|
||||
|
||||
void qProcessFetchRsp(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
|
||||
void qProcessRspMsg(void* parent, struct SRpcMsg* pMsg, struct SEpSet* pEpSet);
|
||||
|
||||
int32_t qGetExplainExecInfo(qTaskInfo_t tinfo, int32_t* resNum, SExplainExecInfo** pRes);
|
||||
|
||||
|
@ -174,7 +175,16 @@ int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t le
|
|||
*/
|
||||
int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts);
|
||||
|
||||
int32_t qStreamPrepareScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts);
|
||||
int32_t qStreamPrepareTsdbScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts);
|
||||
|
||||
int32_t qStreamPrepareScan(qTaskInfo_t tinfo, const STqOffsetVal* pOffset);
|
||||
|
||||
int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
|
||||
|
||||
void* qStreamExtractMetaMsg(qTaskInfo_t tinfo);
|
||||
|
||||
void* qExtractReaderFromStreamScanner(void* scanner);
|
||||
int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -172,7 +172,13 @@ typedef struct tExprNode {
|
|||
|
||||
void tExprTreeDestroy(tExprNode *pNode, void (*fp)(void *));
|
||||
|
||||
typedef enum {
|
||||
SHOULD_FREE_COLDATA = 0x1, // the newly created column data needs to be destroyed.
|
||||
DELEGATED_MGMT_COLDATA = 0x2, // input column data should not be released.
|
||||
} ECOLDATA_MGMT_TYPE_E;
|
||||
|
||||
struct SScalarParam {
|
||||
ECOLDATA_MGMT_TYPE_E type;
|
||||
SColumnInfoData *columnData;
|
||||
SHashObj *pHashFilter;
|
||||
int32_t hashValueType;
|
||||
|
|
|
@ -127,7 +127,7 @@ int indexSearch(SIndex* index, SIndexMultiTermQuery* query, SArray* result);
|
|||
* @parma opt (input, rebuild index opts)
|
||||
* @return error code
|
||||
*/
|
||||
int indexRebuild(SIndex* index, SIndexOpts* opt);
|
||||
// int indexRebuild(SIndex* index, SIndexOpts* opt);
|
||||
|
||||
/*
|
||||
* open index
|
||||
|
@ -185,6 +185,25 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn operType, uint8_t c
|
|||
int32_t nColName, const char* colVal, int32_t nColVal);
|
||||
void indexTermDestroy(SIndexTerm* p);
|
||||
|
||||
/*
|
||||
* rebuild index
|
||||
*/
|
||||
void indexRebuild(SIndexJson* idx, void* iter);
|
||||
|
||||
/*
|
||||
* check index json status
|
||||
**/
|
||||
bool indexIsRebuild(SIndex* idx);
|
||||
/*
|
||||
* rebuild index json
|
||||
*/
|
||||
void indexJsonRebuild(SIndexJson* idx, void* iter);
|
||||
|
||||
/*
|
||||
* check index json status
|
||||
**/
|
||||
bool indexJsonIsRebuild(SIndexJson* idx);
|
||||
|
||||
/*
|
||||
* init index env
|
||||
*
|
||||
|
@ -203,7 +222,7 @@ typedef enum { SFLT_NOT_INDEX, SFLT_COARSE_INDEX, SFLT_ACCURATE_INDEX } SIdxFltS
|
|||
|
||||
SIdxFltStatus idxGetFltStatus(SNode* pFilterNode);
|
||||
|
||||
int32_t doFilterTag(const SNode* pFilterNode, SIndexMetaArg* metaArg, SArray* result);
|
||||
int32_t doFilterTag(SNode* pFilterNode, SIndexMetaArg* metaArg, SArray* result, SIdxFltStatus* status);
|
||||
/*
|
||||
* destory index env
|
||||
*
|
||||
|
|
|
@ -51,7 +51,8 @@ extern "C" {
|
|||
typedef struct SDatabaseOptions {
|
||||
ENodeType type;
|
||||
int32_t buffer;
|
||||
int8_t cachelast;
|
||||
int8_t cacheLast;
|
||||
int32_t cacheLastSize;
|
||||
int8_t compressionLevel;
|
||||
int32_t daysPerFile;
|
||||
SValueNode* pDaysPerFile;
|
||||
|
@ -102,6 +103,11 @@ typedef struct SFlushDatabaseStmt {
|
|||
char dbName[TSDB_DB_NAME_LEN];
|
||||
} SFlushDatabaseStmt;
|
||||
|
||||
typedef struct STrimDatabaseStmt {
|
||||
ENodeType type;
|
||||
char dbName[TSDB_DB_NAME_LEN];
|
||||
} STrimDatabaseStmt;
|
||||
|
||||
typedef struct STableOptions {
|
||||
ENodeType type;
|
||||
bool commentNull;
|
||||
|
|
|
@ -112,6 +112,7 @@ typedef enum ENodeType {
|
|||
QUERY_NODE_DROP_DATABASE_STMT,
|
||||
QUERY_NODE_ALTER_DATABASE_STMT,
|
||||
QUERY_NODE_FLUSH_DATABASE_STMT,
|
||||
QUERY_NODE_TRIM_DATABASE_STMT,
|
||||
QUERY_NODE_CREATE_TABLE_STMT,
|
||||
QUERY_NODE_CREATE_SUBTABLE_CLAUSE,
|
||||
QUERY_NODE_CREATE_MULTI_TABLE_STMT,
|
||||
|
|
|
@ -353,6 +353,7 @@ typedef struct SDownstreamSourceNode {
|
|||
uint64_t taskId;
|
||||
uint64_t schedId;
|
||||
int32_t execId;
|
||||
int32_t fetchMsgType;
|
||||
} SDownstreamSourceNode;
|
||||
|
||||
typedef struct SExchangePhysiNode {
|
||||
|
|
|
@ -250,6 +250,7 @@ typedef struct SSelectStmt {
|
|||
SLimitNode* pSlimit;
|
||||
char stmtName[TSDB_TABLE_NAME_LEN];
|
||||
uint8_t precision;
|
||||
int32_t selectFuncNum;
|
||||
bool isEmptyResult;
|
||||
bool isTimeLineResult;
|
||||
bool hasAggFuncs;
|
||||
|
@ -257,6 +258,7 @@ typedef struct SSelectStmt {
|
|||
bool hasIndefiniteRowsFunc;
|
||||
bool hasSelectFunc;
|
||||
bool hasSelectValFunc;
|
||||
bool hasOtherVectorFunc;
|
||||
bool hasUniqueFunc;
|
||||
bool hasTailFunc;
|
||||
bool hasInterpFunc;
|
||||
|
|
|
@ -96,6 +96,9 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
|
|||
char* tableName, char* msgBuf, int16_t msgBufLen);
|
||||
int32_t smlBuildOutput(void* handle, SHashObj* pVgHash);
|
||||
|
||||
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
|
||||
SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap);
|
||||
SArray* serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -67,7 +67,7 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in
|
|||
|
||||
int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts);
|
||||
|
||||
int32_t qWorkerProcessFetchRsp(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts);
|
||||
int32_t qWorkerProcessRspMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts);
|
||||
|
||||
int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
|
||||
typedef struct SFilterInfo SFilterInfo;
|
||||
|
||||
int32_t scalarGetOperatorResultType(SDataType left, SDataType right, EOperatorType op, SDataType* pRes);
|
||||
int32_t scalarGetOperatorResultType(SOperatorNode* pOp);
|
||||
|
||||
/*
|
||||
pNode will be freed in API;
|
||||
|
@ -42,7 +42,7 @@ int32_t scalarGetOperatorParamNum(EOperatorType type);
|
|||
int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type);
|
||||
|
||||
int32_t vectorGetConvertType(int32_t type1, int32_t type2);
|
||||
int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut);
|
||||
int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut, int32_t* overflow);
|
||||
|
||||
/* Math functions */
|
||||
int32_t absFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
|
||||
|
|
|
@ -223,7 +223,7 @@ typedef struct {
|
|||
SEpSet epSet;
|
||||
} SStreamChildEpInfo;
|
||||
|
||||
struct SStreamTask {
|
||||
typedef struct SStreamTask {
|
||||
int64_t streamId;
|
||||
int32_t taskId;
|
||||
int8_t isDataScan;
|
||||
|
@ -277,7 +277,7 @@ struct SStreamTask {
|
|||
|
||||
// msg handle
|
||||
SMsgCb* pMsgCb;
|
||||
};
|
||||
} SStreamTask;
|
||||
|
||||
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo);
|
||||
int32_t tDecodeStreamEpInfo(SDecoder* pDecoder, SStreamChildEpInfo* pInfo);
|
||||
|
@ -288,6 +288,7 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask);
|
|||
void tFreeSStreamTask(SStreamTask* pTask);
|
||||
|
||||
static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem* pItem) {
|
||||
#if 0
|
||||
while (1) {
|
||||
int8_t inputStatus =
|
||||
atomic_val_compare_exchange_8(&pTask->inputStatus, TASK_INPUT_STATUS__NORMAL, TASK_INPUT_STATUS__PROCESSING);
|
||||
|
@ -296,6 +297,7 @@ static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem
|
|||
}
|
||||
ASSERT(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pItem->type == STREAM_INPUT__DATA_SUBMIT) {
|
||||
SStreamDataSubmit* pSubmitClone = streamSubmitRefClone((SStreamDataSubmit*)pItem);
|
||||
|
@ -316,8 +318,10 @@ static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem
|
|||
atomic_val_compare_exchange_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__IN_ACTIVE, TASK_TRIGGER_STATUS__ACTIVE);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO: back pressure
|
||||
atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__NORMAL);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,9 +163,6 @@ typedef struct SSyncLogStore {
|
|||
// return commit index of log
|
||||
SyncIndex (*getCommitIndex)(struct SSyncLogStore* pLogStore);
|
||||
|
||||
// refactor, log[0 .. n] ==> log[m .. n]
|
||||
// int32_t (*syncLogSetBeginIndex)(struct SSyncLogStore* pLogStore, SyncIndex beginIndex);
|
||||
|
||||
SyncIndex (*syncLogBeginIndex)(struct SSyncLogStore* pLogStore);
|
||||
SyncIndex (*syncLogEndIndex)(struct SSyncLogStore* pLogStore);
|
||||
bool (*syncLogIsEmpty)(struct SSyncLogStore* pLogStore);
|
||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
|
||||
#define TAOS_CONN_SERVER 0
|
||||
#define TAOS_CONN_CLIENT 1
|
||||
#define IsReq(pMsg) (pMsg->msgType & 1U)
|
||||
#define IsReq(pMsg) (pMsg->msgType & 1U)
|
||||
|
||||
extern int32_t tsRpcHeadSize;
|
||||
|
||||
|
|
|
@ -24,42 +24,14 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define wFatal(...) \
|
||||
{ \
|
||||
if (wDebugFlag & DEBUG_FATAL) { \
|
||||
taosPrintLog("WAL FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define wError(...) \
|
||||
{ \
|
||||
if (wDebugFlag & DEBUG_ERROR) { \
|
||||
taosPrintLog("WAL ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define wWarn(...) \
|
||||
{ \
|
||||
if (wDebugFlag & DEBUG_WARN) { \
|
||||
taosPrintLog("WAL WARN ", DEBUG_WARN, 255, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define wInfo(...) \
|
||||
{ \
|
||||
if (wDebugFlag & DEBUG_INFO) { \
|
||||
taosPrintLog("WAL ", DEBUG_INFO, 255, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define wDebug(...) \
|
||||
{ \
|
||||
if (wDebugFlag & DEBUG_DEBUG) { \
|
||||
taosPrintLog("WAL ", DEBUG_DEBUG, wDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define wTrace(...) \
|
||||
{ \
|
||||
if (wDebugFlag & DEBUG_TRACE) { \
|
||||
taosPrintLog("WAL ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
// clang-format off
|
||||
#define wFatal(...) { if (wDebugFlag & DEBUG_FATAL) { taosPrintLog("WAL FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
||||
#define wError(...) { if (wDebugFlag & DEBUG_ERROR) { taosPrintLog("WAL ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }}
|
||||
#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN ", DEBUG_WARN, 255, __VA_ARGS__); }}
|
||||
#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL ", DEBUG_INFO, 255, __VA_ARGS__); }}
|
||||
#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL ", DEBUG_DEBUG, wDebugFlag, __VA_ARGS__); }}
|
||||
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", DEBUG_TRACE, wDebugFlag, __VA_ARGS__); }}
|
||||
// clang-format on
|
||||
|
||||
#define WAL_PROTO_VER 0
|
||||
#define WAL_NOSUFFIX_LEN 20
|
||||
|
@ -88,7 +60,7 @@ typedef struct {
|
|||
EWalType level; // wal level
|
||||
} SWalCfg;
|
||||
|
||||
typedef struct SWalVer {
|
||||
typedef struct {
|
||||
int64_t firstVer;
|
||||
int64_t verInSnapshotting;
|
||||
int64_t snapshotVer;
|
||||
|
@ -149,17 +121,24 @@ typedef struct SWal {
|
|||
SWalCkHead writeHead;
|
||||
} SWal; // WAL HANDLE
|
||||
|
||||
typedef struct SWalReadHandle {
|
||||
SWal *pWal;
|
||||
TdFilePtr pReadLogTFile;
|
||||
TdFilePtr pReadIdxTFile;
|
||||
int64_t curFileFirstVer;
|
||||
int64_t curVersion;
|
||||
int64_t capacity;
|
||||
int64_t status; // if cursor valid
|
||||
TdThreadMutex mutex;
|
||||
SWalCkHead *pHead;
|
||||
} SWalReadHandle;
|
||||
typedef struct {
|
||||
int8_t scanUncommited;
|
||||
int8_t scanMeta;
|
||||
int8_t enableRef;
|
||||
} SWalFilterCond;
|
||||
|
||||
typedef struct {
|
||||
SWal *pWal;
|
||||
TdFilePtr pLogFile;
|
||||
TdFilePtr pIdxFile;
|
||||
int64_t curFileFirstVer;
|
||||
int64_t curVersion;
|
||||
int64_t capacity;
|
||||
int8_t curInvalid;
|
||||
TdThreadMutex mutex;
|
||||
SWalFilterCond cond;
|
||||
SWalCkHead *pHead;
|
||||
} SWalReader;
|
||||
|
||||
// module initialization
|
||||
int32_t walInit();
|
||||
|
@ -178,7 +157,6 @@ void walFsync(SWal *, bool force);
|
|||
|
||||
// apis for lifecycle management
|
||||
int32_t walCommit(SWal *, int64_t ver);
|
||||
// truncate after
|
||||
int32_t walRollback(SWal *, int64_t ver);
|
||||
// notify that previous logs can be pruned safely
|
||||
int32_t walBeginSnapshot(SWal *, int64_t ver);
|
||||
|
@ -187,15 +165,17 @@ int32_t walRestoreFromSnapshot(SWal *, int64_t ver);
|
|||
// int32_t walDataCorrupted(SWal*);
|
||||
|
||||
// read
|
||||
SWalReadHandle *walOpenReadHandle(SWal *);
|
||||
void walCloseReadHandle(SWalReadHandle *);
|
||||
int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver);
|
||||
SWalReader *walOpenReader(SWal *, SWalFilterCond *pCond);
|
||||
void walCloseReader(SWalReader *pRead);
|
||||
int32_t walReadVer(SWalReader *pRead, int64_t ver);
|
||||
int32_t walReadSeekVer(SWalReader *pRead, int64_t ver);
|
||||
int32_t walNextValidMsg(SWalReader *pRead);
|
||||
|
||||
// only for tq usage
|
||||
void walSetReaderCapacity(SWalReadHandle *pRead, int32_t capacity);
|
||||
int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalCkHead *pHead);
|
||||
int32_t walFetchBody(SWalReadHandle *pRead, SWalCkHead **ppHead);
|
||||
int32_t walSkipFetchBody(SWalReadHandle *pRead, const SWalCkHead *pHead);
|
||||
void walSetReaderCapacity(SWalReader *pRead, int32_t capacity);
|
||||
int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead);
|
||||
int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead);
|
||||
int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead);
|
||||
|
||||
typedef struct {
|
||||
int64_t refId;
|
||||
|
@ -207,10 +187,11 @@ void walCloseRef(SWalRef *);
|
|||
int32_t walRefVer(SWalRef *, int64_t ver);
|
||||
int32_t walUnrefVer(SWal *);
|
||||
|
||||
// help function for raft
|
||||
bool walLogExist(SWal *, int64_t ver);
|
||||
bool walIsEmpty(SWal *);
|
||||
|
||||
// lifecycle check
|
||||
bool walIsEmpty(SWal *);
|
||||
int64_t walGetFirstVer(SWal *);
|
||||
int64_t walGetSnapshotVer(SWal *);
|
||||
int64_t walGetLastVer(SWal *);
|
||||
|
|
|
@ -247,9 +247,11 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_MND_COLUMN_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03AE)
|
||||
#define TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03AF)
|
||||
#define TSDB_CODE_MND_SINGLE_STB_MODE_DB TAOS_DEF_ERROR_CODE(0, 0x03B0)
|
||||
#define TSDB_CODE_MND_INVALID_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x03B1)
|
||||
#define TSDB_CODE_MND_STABLE_UID_NOT_MATCH TAOS_DEF_ERROR_CODE(0, 0x03B2)
|
||||
|
||||
// mnode-infoSchema
|
||||
#define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x03BA)
|
||||
#define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x03BA)
|
||||
|
||||
// mnode-func
|
||||
#define TSDB_CODE_MND_FUNC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03C0)
|
||||
|
@ -582,6 +584,7 @@ int32_t* taosGetErrno();
|
|||
#define TSDB_CODE_PAR_INVALID_INTERP_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x265D)
|
||||
#define TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN TAOS_DEF_ERROR_CODE(0, 0x265E)
|
||||
#define TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE TAOS_DEF_ERROR_CODE(0, 0x265F)
|
||||
#define TSDB_CODE_PAR_INVALID_SMA_INDEX TAOS_DEF_ERROR_CODE(0, 0x265C)
|
||||
|
||||
//planner
|
||||
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
|
||||
|
|
|
@ -477,22 +477,6 @@ static FORCE_INLINE void* tDecoderMalloc(SDecoder* pCoder, int32_t size) {
|
|||
return n; \
|
||||
} while (0)
|
||||
|
||||
#define tGetV(p, v) \
|
||||
do { \
|
||||
int32_t n = 0; \
|
||||
if (v) *v = 0; \
|
||||
for (;;) { \
|
||||
if (p[n] <= 0x7f) { \
|
||||
if (v) (*v) |= (p[n] << (7 * n)); \
|
||||
n++; \
|
||||
break; \
|
||||
} \
|
||||
if (v) (*v) |= ((p[n] & 0x7f) << (7 * n)); \
|
||||
n++; \
|
||||
} \
|
||||
return n; \
|
||||
} while (0)
|
||||
|
||||
// PUT
|
||||
static FORCE_INLINE int32_t tPutU8(uint8_t* p, uint8_t v) {
|
||||
if (p) ((uint8_t*)p)[0] = v;
|
||||
|
@ -607,7 +591,22 @@ static FORCE_INLINE int32_t tGetI64(uint8_t* p, int64_t* v) {
|
|||
return sizeof(int64_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetU16v(uint8_t* p, uint16_t* v) { tGetV(p, v); }
|
||||
static FORCE_INLINE int32_t tGetU16v(uint8_t* p, uint16_t* v) {
|
||||
int32_t n = 0;
|
||||
|
||||
if (v) *v = 0;
|
||||
for (;;) {
|
||||
if (p[n] <= 0x7f) {
|
||||
if (v) (*v) |= (((uint16_t)p[n]) << (7 * n));
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
if (v) (*v) |= (((uint16_t)(p[n] & 0x7f)) << (7 * n));
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI16v(uint8_t* p, int16_t* v) {
|
||||
int32_t n;
|
||||
|
@ -619,7 +618,22 @@ static FORCE_INLINE int32_t tGetI16v(uint8_t* p, int16_t* v) {
|
|||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetU32v(uint8_t* p, uint32_t* v) { tGetV(p, v); }
|
||||
static FORCE_INLINE int32_t tGetU32v(uint8_t* p, uint32_t* v) {
|
||||
int32_t n = 0;
|
||||
|
||||
if (v) *v = 0;
|
||||
for (;;) {
|
||||
if (p[n] <= 0x7f) {
|
||||
if (v) (*v) |= (((uint32_t)p[n]) << (7 * n));
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
if (v) (*v) |= (((uint32_t)(p[n] & 0x7f)) << (7 * n));
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI32v(uint8_t* p, int32_t* v) {
|
||||
int32_t n;
|
||||
|
@ -631,7 +645,22 @@ static FORCE_INLINE int32_t tGetI32v(uint8_t* p, int32_t* v) {
|
|||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetU64v(uint8_t* p, uint64_t* v) { tGetV(p, v); }
|
||||
static FORCE_INLINE int32_t tGetU64v(uint8_t* p, uint64_t* v) {
|
||||
int32_t n = 0;
|
||||
|
||||
if (v) *v = 0;
|
||||
for (;;) {
|
||||
if (p[n] <= 0x7f) {
|
||||
if (v) (*v) |= (((uint64_t)p[n]) << (7 * n));
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
if (v) (*v) |= (((uint64_t)(p[n] & 0x7f)) << (7 * n));
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI64v(uint8_t* p, int64_t* v) {
|
||||
int32_t n;
|
||||
|
|
|
@ -69,13 +69,14 @@ typedef void (*_ref_fn_t)(const void *pObj);
|
|||
#define T_REF_VAL_GET(x) (x)->_ref.val
|
||||
|
||||
// single writer multiple reader lock
|
||||
typedef volatile int32_t SRWLatch;
|
||||
typedef volatile int64_t SRWLatch;
|
||||
|
||||
void taosInitRWLatch(SRWLatch *pLatch);
|
||||
void taosWLockLatch(SRWLatch *pLatch);
|
||||
void taosWUnLockLatch(SRWLatch *pLatch);
|
||||
void taosRLockLatch(SRWLatch *pLatch);
|
||||
void taosRUnLockLatch(SRWLatch *pLatch);
|
||||
void taosInitRWLatch(SRWLatch *pLatch);
|
||||
void taosInitReentrantRWLatch(SRWLatch *pLatch);
|
||||
void taosWLockLatch(SRWLatch *pLatch);
|
||||
void taosWUnLockLatch(SRWLatch *pLatch);
|
||||
void taosRLockLatch(SRWLatch *pLatch);
|
||||
void taosRUnLockLatch(SRWLatch *pLatch);
|
||||
int32_t taosWTryLockLatch(SRWLatch *pLatch);
|
||||
|
||||
// copy on read
|
||||
|
|
|
@ -60,7 +60,7 @@ extern int32_t tsdbDebugFlag;
|
|||
extern int32_t tqDebugFlag;
|
||||
extern int32_t fsDebugFlag;
|
||||
extern int32_t metaDebugFlag;
|
||||
extern int32_t fnDebugFlag;
|
||||
extern int32_t udfDebugFlag;
|
||||
extern int32_t smaDebugFlag;
|
||||
extern int32_t idxDebugFlag;
|
||||
|
||||
|
@ -94,7 +94,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
|
|||
#define pError(...) { taosPrintLog("APP ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }
|
||||
#define pPrint(...) { taosPrintLog("APP ", DEBUG_INFO, 255, __VA_ARGS__); }
|
||||
// clang-format on
|
||||
|
||||
#define BUF_PAGE_DEBUG
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -45,6 +45,7 @@ void taosIp2String(uint32_t ip, char *str);
|
|||
void taosIpPort2String(uint32_t ip, uint16_t port, char *str);
|
||||
|
||||
void *tmemmem(const char *haystack, int hlen, const char *needle, int nlen);
|
||||
char *strDupUnquo(const char *src);
|
||||
|
||||
static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *target) {
|
||||
T_MD5_CTX context;
|
||||
|
|
|
@ -37,4 +37,5 @@ if [ -f "${install_main_dir}/taosadapter.service" ]; then
|
|||
fi
|
||||
|
||||
# there can not libtaos.so*, otherwise ln -s error
|
||||
${csudo}rm -f ${install_main_dir}/driver/libtaos* || :
|
||||
${csudo}rm -f ${install_main_dir}/driver/libtaos.* || :
|
||||
${csudo}rm -f ${install_main_dir}/driver/libtaosws.* || :
|
||||
|
|
|
@ -29,8 +29,12 @@ else
|
|||
${csudo}rm -f ${bin_link_dir}/taosdemo || :
|
||||
${csudo}rm -f ${cfg_link_dir}/* || :
|
||||
${csudo}rm -f ${inc_link_dir}/taos.h || :
|
||||
${csudo}rm -f ${inc_link_dir}/taosdef.h || :
|
||||
${csudo}rm -f ${inc_link_dir}/taoserror.h || :
|
||||
${csudo}rm -f ${inc_link_dir}/taosudf.h || :
|
||||
${csudo}rm -f ${inc_link_dir}/taosws.h || :
|
||||
${csudo}rm -f ${lib_link_dir}/libtaos.* || :
|
||||
${csudo}rm -f ${lib_link_dir}/libtaosws.* || :
|
||||
|
||||
${csudo}rm -f ${log_link_dir} || :
|
||||
${csudo}rm -f ${data_link_dir} || :
|
||||
|
|
|
@ -30,6 +30,7 @@ mkdir -p ${pkg_dir}
|
|||
cd ${pkg_dir}
|
||||
|
||||
libfile="libtaos.so.${tdengine_ver}"
|
||||
wslibfile="libtaosws.so"
|
||||
|
||||
# create install dir
|
||||
install_home_path="/usr/local/taos"
|
||||
|
@ -67,10 +68,12 @@ fi
|
|||
|
||||
cp ${compile_dir}/build/bin/taos ${pkg_dir}${install_home_path}/bin
|
||||
cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_path}/driver
|
||||
cp ${compile_dir}/build/lib/${wslibfile} ${pkg_dir}${install_home_path}/driver ||:
|
||||
cp ${compile_dir}/../include/client/taos.h ${pkg_dir}${install_home_path}/include
|
||||
cp ${compile_dir}/../include/common/taosdef.h ${pkg_dir}${install_home_path}/include
|
||||
cp ${compile_dir}/../include/util/taoserror.h ${pkg_dir}${install_home_path}/include
|
||||
cp ${compile_dir}/../include/libs/function/taosudf.h ${pkg_dir}${install_home_path}/include
|
||||
cp ${compile_dir}/../src/inc/taosws.h ${pkg_dir}${install_home_path}/include ||:
|
||||
cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples
|
||||
#cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector
|
||||
#cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector
|
||||
|
|
|
@ -42,6 +42,7 @@ echo version: %{_version}
|
|||
echo buildroot: %{buildroot}
|
||||
|
||||
libfile="libtaos.so.%{_version}"
|
||||
wslibfile="libtaosws.so"
|
||||
|
||||
# create install path, and cp file
|
||||
mkdir -p %{buildroot}%{homepath}/bin
|
||||
|
@ -74,10 +75,12 @@ if [ -f %{_compiledir}/build/bin/taosadapter ]; then
|
|||
cp %{_compiledir}/build/bin/taosadapter %{buildroot}%{homepath}/bin ||:
|
||||
fi
|
||||
cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver
|
||||
cp %{_compiledir}/build/lib/${wslibfile} %{buildroot}%{homepath}/driver ||:
|
||||
cp %{_compiledir}/../include/client/taos.h %{buildroot}%{homepath}/include
|
||||
cp %{_compiledir}/../include/common/taosdef.h %{buildroot}%{homepath}/include
|
||||
cp %{_compiledir}/../include/util/taoserror.h %{buildroot}%{homepath}/include
|
||||
cp %{_compiledir}/../include/libs/function/taosudf.h %{buildroot}%{homepath}/include
|
||||
cp %{_compiledir}/../src/inc/taosws.h %{buildroot}%{homepath}/include ||:
|
||||
#cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector
|
||||
#cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector
|
||||
#cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector
|
||||
|
|
|
@ -30,6 +30,7 @@ configDir="/etc/taos"
|
|||
installDir="/usr/local/taos"
|
||||
adapterName="taosadapter"
|
||||
benchmarkName="taosBenchmark"
|
||||
tmqName="tmq_sim"
|
||||
dumpName="taosdump"
|
||||
demoName="taosdemo"
|
||||
|
||||
|
@ -205,6 +206,7 @@ function install_bin() {
|
|||
[ -x ${install_main_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || :
|
||||
[ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${demoName} || :
|
||||
[ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || :
|
||||
[ -x ${install_main_dir}/bin/${tmqName} ] && ${csudo}ln -s ${install_main_dir}/bin/${tmqName} ${bin_link_dir}/${tmqName} || :
|
||||
[ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || :
|
||||
[ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || :
|
||||
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || :
|
||||
|
@ -227,9 +229,13 @@ function install_lib() {
|
|||
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
|
||||
${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
||||
|
||||
${csudo}ln -s ${lib_link_dir}/libtaosws.so ${lib_link_dir}/libtaosws.so || :
|
||||
|
||||
if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then
|
||||
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
|
||||
${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
|
||||
|
||||
${csudo}ln -s ${lib64_link_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || :
|
||||
fi
|
||||
|
||||
${csudo}ldconfig
|
||||
|
@ -313,11 +319,16 @@ function install_jemalloc() {
|
|||
|
||||
function install_header() {
|
||||
${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || :
|
||||
|
||||
${csudo}rm -f ${inc_link_dir}/taosws.h || :
|
||||
|
||||
${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
|
||||
${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
|
||||
${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
|
||||
${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
|
||||
${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h
|
||||
|
||||
${csudo}ln -s ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h || :
|
||||
}
|
||||
|
||||
function add_newHostname_to_hosts() {
|
||||
|
|
|
@ -294,21 +294,34 @@ function install_avro() {
|
|||
function install_lib() {
|
||||
# Remove links
|
||||
${csudo}rm -f ${lib_link_dir}/libtaos.* || :
|
||||
${csudo}rm -f ${lib_link_dir}/libtaosws.* || :
|
||||
if [ "$osType" != "Darwin" ]; then
|
||||
${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
|
||||
${csudo}rm -f ${lib64_link_dir}/libtaosws.* || :
|
||||
fi
|
||||
|
||||
if [ "$osType" != "Darwin" ]; then
|
||||
${csudo}cp ${binary_dir}/build/lib/libtaos.so.${verNumber} \
|
||||
${install_main_dir}/driver &&
|
||||
${csudo}chmod 777 ${install_main_dir}/driver/*
|
||||
${csudo}chmod 777 ${install_main_dir}/driver/libtaos.so.${verNumber}
|
||||
|
||||
${csudo}ln -sf ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
|
||||
${csudo}ln -sf ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
||||
|
||||
if [ -d "${lib64_link_dir}" ]; then
|
||||
${csudo}ln -sf ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1
|
||||
${csudo}ln -sf ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so
|
||||
${csudo}ln -sf ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1
|
||||
${csudo}ln -sf ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so
|
||||
fi
|
||||
|
||||
if [ -f ${binary_dir}/build/lib/libtaosws.so ]; then
|
||||
${csudo}cp ${binary_dir}/build/lib/libtaosws.so \
|
||||
${install_main_dir}/driver &&
|
||||
${csudo}chmod 777 ${install_main_dir}/driver/libtaosws.so ||:
|
||||
|
||||
${csudo}ln -sf ${install_main_dir}/driver/libtaosws.so ${lib_link_dir}/libtaosws.so || :
|
||||
|
||||
if [ -d "${lib64_link_dir}" ]; then
|
||||
${csudo}ln -sf ${lib64_link_dir}/libtaosws.so ${lib64_link_dir}/libtaosws.so || :
|
||||
fi
|
||||
fi
|
||||
else
|
||||
${csudo}cp -Rf ${binary_dir}/build/lib/libtaos.${verNumber}.dylib \
|
||||
|
@ -337,8 +350,8 @@ function install_lib() {
|
|||
fi
|
||||
|
||||
install_jemalloc
|
||||
install_avro lib
|
||||
install_avro lib64
|
||||
#install_avro lib
|
||||
#install_avro lib64
|
||||
|
||||
if [ "$osType" != "Darwin" ]; then
|
||||
${csudo}ldconfig
|
||||
|
@ -349,18 +362,26 @@ function install_header() {
|
|||
|
||||
if [ "$osType" != "Darwin" ]; then
|
||||
${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || :
|
||||
${csudo}rm -f ${inc_link_dir}/taosws.h ||:
|
||||
${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \
|
||||
${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
|
||||
|
||||
if [ -f ${binary_dir}/build/include/taosws.h ]; then
|
||||
${csudo}cp -f ${binary_dir}/build/include/taosws.h ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/taosws.h ||:
|
||||
${csudo}ln -s ${install_main_dir}/include/taosws.h ${inc_link_dir}/taosws.h ||:
|
||||
fi
|
||||
|
||||
${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
|
||||
${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
|
||||
${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
|
||||
${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h
|
||||
|
||||
else
|
||||
${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \
|
||||
${install_main_dir}/include ||
|
||||
${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \
|
||||
${install_main_2_dir}/include &&
|
||||
${csudo}chmod 644 ${install_main_dir}/include/* ||
|
||||
${csudo}chmod 644 ${install_main_dir}/include/* ||:
|
||||
${csudo}chmod 644 ${install_main_2_dir}/include/*
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ if [ "$pagMode" == "lite" ]; then
|
|||
strip ${build_dir}/bin/${serverName}
|
||||
strip ${build_dir}/bin/${clientName}
|
||||
# lite version doesn't include taosadapter, which will lead to no restful interface
|
||||
bin_files="${build_dir}/bin/${serverName} ${build_dir}/bin/${clientName} ${script_dir}/remove.sh ${script_dir}/startPre.sh ${build_dir}/bin/taosBenchmark"
|
||||
bin_files="${build_dir}/bin/${serverName} ${build_dir}/bin/${clientName} ${script_dir}/remove.sh ${script_dir}/startPre.sh ${build_dir}/bin/taosBenchmark ${build_dir}/bin/tmq_sim"
|
||||
taostools_bin_files=""
|
||||
else
|
||||
|
||||
|
@ -78,6 +78,7 @@ else
|
|||
|
||||
taostools_bin_files=" ${build_dir}/bin/taosdump \
|
||||
${build_dir}/bin/taosBenchmark \
|
||||
${build_dir}/bin/tmq_sim \
|
||||
${build_dir}/bin/TDinsight.sh \
|
||||
$tdinsight_caches"
|
||||
|
||||
|
@ -92,8 +93,11 @@ else
|
|||
fi
|
||||
|
||||
lib_files="${build_dir}/lib/libtaos.so.${version}"
|
||||
wslib_files="${build_dir}/lib/libtaosws.so."
|
||||
header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h"
|
||||
|
||||
wsheader_files="${code_dir}/inc/taosws.h"
|
||||
|
||||
if [ "$dbName" != "taos" ]; then
|
||||
cfg_dir="${top_dir}/../enterprise/packaging/cfg"
|
||||
else
|
||||
|
@ -109,6 +113,9 @@ init_file_rpm=${script_dir}/../rpm/taosd
|
|||
# make directories.
|
||||
mkdir -p ${install_dir}
|
||||
mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc
|
||||
|
||||
${wsheader_files} ${install_dir}/inc || :
|
||||
|
||||
mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/${configFile} ${install_dir}/cfg/${configFile}
|
||||
|
||||
if [ -f "${compile_dir}/test/cfg/taosadapter.toml" ]; then
|
||||
|
@ -283,6 +290,7 @@ fi
|
|||
|
||||
# Copy driver
|
||||
mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo "${versionComp}" >${install_dir}/driver/vercomp.txt
|
||||
cp ${wslib_files} ${install_dir}/driver || :
|
||||
|
||||
# Copy connector
|
||||
if [ "$verMode" == "cluster" ]; then
|
||||
|
|
|
@ -102,7 +102,10 @@ function clean_local_bin() {
|
|||
function clean_lib() {
|
||||
# Remove link
|
||||
${csudo}rm -f ${lib_link_dir}/libtaos.* || :
|
||||
${csudo}rm -f ${lib_link_dir}/libtaosws.* || :
|
||||
|
||||
${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
|
||||
${csudo}rm -f ${lib64_link_dir}/libtaosws.* || :
|
||||
#${csudo}rm -rf ${v15_java_app_dir} || :
|
||||
}
|
||||
|
||||
|
@ -111,6 +114,8 @@ function clean_header() {
|
|||
${csudo}rm -f ${inc_link_dir}/taos.h || :
|
||||
${csudo}rm -f ${inc_link_dir}/taosdef.h || :
|
||||
${csudo}rm -f ${inc_link_dir}/taoserror.h || :
|
||||
|
||||
${csudo}rm -f ${inc_link_dir}/taosws.h || :
|
||||
}
|
||||
|
||||
function clean_config() {
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
aux_source_directory(src CLIENT_SRC)
|
||||
|
||||
if(TD_WINDOWS)
|
||||
add_library(taos SHARED ${CLIENT_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/taos.rc.in)
|
||||
else()
|
||||
add_library(taos SHARED ${CLIENT_SRC})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
INCLUDE_DIRECTORIES(jni)
|
||||
|
||||
target_include_directories(
|
||||
taos
|
||||
PUBLIC "${TD_SOURCE_DIR}/include/client"
|
||||
|
@ -14,13 +18,19 @@ target_link_libraries(
|
|||
INTERFACE api
|
||||
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
|
||||
)
|
||||
|
||||
if(TD_WINDOWS)
|
||||
set_target_properties(taos
|
||||
PROPERTIES
|
||||
LINK_FLAGS
|
||||
set_target_properties(taos
|
||||
PROPERTIES
|
||||
LINK_FLAGS
|
||||
/DEF:${CMAKE_CURRENT_SOURCE_DIR}/src/taos.def
|
||||
)
|
||||
endif ()
|
||||
INCLUDE_DIRECTORIES(jni/windows)
|
||||
INCLUDE_DIRECTORIES(jni/windows/win32)
|
||||
INCLUDE_DIRECTORIES(jni/windows/win32/bridge)
|
||||
else()
|
||||
INCLUDE_DIRECTORIES(jni/linux)
|
||||
endif()
|
||||
|
||||
set_target_properties(
|
||||
taos
|
||||
|
|
|
@ -222,8 +222,8 @@ typedef struct SRequestObj {
|
|||
SArray* tableList;
|
||||
SQueryExecMetric metric;
|
||||
SRequestSendRecvBody body;
|
||||
bool stableQuery;
|
||||
bool validateOnly;
|
||||
bool stableQuery; // todo refactor
|
||||
bool validateOnly; // todo refactor
|
||||
|
||||
bool killed;
|
||||
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
|
||||
|
@ -247,9 +247,9 @@ void doFreeReqResultInfo(SReqResultInfo* pResInfo);
|
|||
int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq);
|
||||
void syncCatalogFn(SMetaData* pResult, void* param, int32_t code);
|
||||
|
||||
SRequestObj* execQuery(STscObj* pTscObj, const char* sql, int sqlLen, bool validateOnly);
|
||||
SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly);
|
||||
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly);
|
||||
void taosAsyncQueryImpl(TAOS* taos, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
|
||||
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly);
|
||||
|
||||
static FORCE_INLINE SReqResultInfo* tmqGetCurResInfo(TAOS_RES* res) {
|
||||
SMqRspObj* msg = (SMqRspObj*)res;
|
||||
|
@ -297,7 +297,7 @@ int32_t releaseTscObj(int64_t rid);
|
|||
|
||||
uint64_t generateRequestId();
|
||||
|
||||
void* createRequest(STscObj* pObj, int32_t type);
|
||||
void* createRequest(uint64_t connId, int32_t type);
|
||||
void destroyRequest(SRequestObj* pRequest);
|
||||
SRequestObj* acquireRequest(int64_t rid);
|
||||
int32_t releaseRequest(int64_t rid);
|
||||
|
@ -318,13 +318,13 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet);
|
|||
STscObj* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db,
|
||||
uint16_t port, int connType);
|
||||
|
||||
SRequestObj* launchQuery(STscObj* pTscObj, const char* sql, int sqlLen, bool validateOnly);
|
||||
SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly);
|
||||
|
||||
int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtCallback* pStmtCb);
|
||||
|
||||
int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList);
|
||||
|
||||
int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj** pRequest);
|
||||
int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, bool validateSql, SRequestObj** pRequest);
|
||||
|
||||
void taos_close_internal(void* taos);
|
||||
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
/* Header for class com_taosdata_jdbc_TSDBJNIConnector */
|
||||
|
||||
#ifndef _Included_com_taosdata_jdbc_TSDBJNIConnector
|
||||
#define _Included_com_taosdata_jdbc_TSDBJNIConnector
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef com_taosdata_jdbc_TSDBJNIConnector_INVALID_CONNECTION_POINTER_VALUE
|
||||
#define com_taosdata_jdbc_TSDBJNIConnector_INVALID_CONNECTION_POINTER_VALUE 0LL
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: initImp
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_initImp(JNIEnv *, jclass, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: setOptions
|
||||
* Signature: (ILjava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv *, jclass, jint, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: setConfigImp
|
||||
* Signature: (Ljava/lang/String;)Lcom/taosdata/jdbc/TSDBException;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setConfigImp(JNIEnv *, jclass, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getTsCharset
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getResultTimePrecisionImp
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TDDBJNIConnector_getResultTimePrecisionImp(JNIEnv *, jobject, jlong,
|
||||
jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: connectImp
|
||||
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEnv *, jobject, jstring, jint, jstring,
|
||||
jstring, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: executeQueryImp
|
||||
* Signature: ([BJ)I
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeQueryImp(JNIEnv *, jobject, jbyteArray, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getErrCodeImp
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getErrCodeImp(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getErrMsgImp
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getErrMsgImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getResultSetImp
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getResultSetImp(JNIEnv *env, jobject jobj, jlong con,
|
||||
jlong tres);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: isUpdateQueryImp
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_isUpdateQueryImp(JNIEnv *env, jobject jobj, jlong con,
|
||||
jlong tres);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: freeResultSetImp
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_freeResultSetImp(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getAffectedRowsImp
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getAffectedRowsImp(JNIEnv *env, jobject jobj, jlong con,
|
||||
jlong res);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: getSchemaMetaDataImp
|
||||
* Signature: (JJLjava/util/List;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getSchemaMetaDataImp(JNIEnv *, jobject, jlong, jlong,
|
||||
jobject);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: fetchRowImp
|
||||
* Signature: (JJLcom/taosdata/jdbc/TSDBResultSetRowData;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEnv *, jobject, jlong, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: fetchBlockImp
|
||||
* Signature: (JJLcom/taosdata/jdbc/TSDBResultSetBlockData;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchBlockImp(JNIEnv *, jobject, jlong, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: closeConnectionImp
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_closeConnectionImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: subscribeImp
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JI)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_subscribeImp(JNIEnv *, jobject, jlong, jboolean,
|
||||
jstring, jstring, jint);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: consumeImp
|
||||
* Signature: (J)Lcom/taosdata/jdbc/TSDBResultSetRowData;
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_consumeImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: unsubscribeImp
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_unsubscribeImp(JNIEnv *, jobject, jlong, jboolean);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: validateCreateTableSqlImp
|
||||
* Signature: (J[B)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTableSqlImp(JNIEnv *, jobject, jlong,
|
||||
jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: prepareStmtImp
|
||||
* Signature: ([BJ)I
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_prepareStmtImp(JNIEnv *, jobject, jbyteArray, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: setBindTableNameImp
|
||||
* Signature: (JLjava/lang/String;J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setBindTableNameImp(JNIEnv *, jobject, jlong, jstring,
|
||||
jlong);
|
||||
|
||||
/**
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: setTableNameTagsImp
|
||||
* Signature: (JLjava/lang/String;I[B[B[B[BJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsImp(JNIEnv *, jobject, jlong, jstring,
|
||||
jint, jbyteArray, jbyteArray,
|
||||
jbyteArray, jbyteArray, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: bindColDataImp
|
||||
* Signature: (J[B[B[BIIIIJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_bindColDataImp(JNIEnv *, jobject, jlong, jbyteArray,
|
||||
jbyteArray, jbyteArray, jint, jint, jint,
|
||||
jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: stmt_add_batch
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_addBatchImp(JNIEnv *env, jobject jobj, jlong stmt,
|
||||
jlong con);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: executeBatchImp
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeBatchImp(JNIEnv *env, jobject jobj, jlong stmt,
|
||||
jlong con);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: closeStmt
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_closeStmt(JNIEnv *env, jobject jobj, jlong stmt,
|
||||
jlong con);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: stmt_errstr
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_stmtErrorMsgImp(JNIEnv *env, jobject jobj, jlong stmt,
|
||||
jlong con);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: insertLinesImp
|
||||
* Signature: ([Ljava/lang/String;JII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(JNIEnv *, jobject, jobjectArray, jlong,
|
||||
jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_TSDBJNIConnector
|
||||
* Method: schemalessInsertImp
|
||||
* Signature: (J[B[B[BIIIIJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_schemalessInsertImp(JNIEnv *, jobject, jobjectArray,
|
||||
jlong, jint, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
/* Header for class com_taosdata_jdbc_tmq_TMQConnector */
|
||||
|
||||
#ifndef _Included_com_taosdata_jdbc_tmq_TMQConnector
|
||||
#define _Included_com_taosdata_jdbc_tmq_TMQConnector
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqConfNewImp
|
||||
* Signature: (Lcom/taosdata/jdbc/tmq/TAOSConsumer;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfNewImp(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqConfSetImp
|
||||
* Signature: (JLjava/lang/String;Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfSetImp(JNIEnv *, jobject, jlong, jstring,
|
||||
jstring);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqConfDestroyImp
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfDestroyImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqConsumerNewImp
|
||||
* Signature: (JLcom/taosdata/jdbc/tmq/TMQConnector;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerNewImp(JNIEnv *, jobject, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqTopicNewImp
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicNewImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqTopicAppendImp
|
||||
* Signature: (JLjava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicAppendImp(JNIEnv *, jobject, jlong, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqTopicDestroyImp
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicDestroyImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqSubscribeImp
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscribeImp(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqSubscriptionImp
|
||||
* Signature: (JLcom/taosdata/jdbc/tmq/TMQConnector;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscriptionImp(JNIEnv *, jobject, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqCommitSync
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqCommitAsync
|
||||
* Signature: (JJLcom/taosdata/jdbc/tmq/TAOSConsumer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JNIEnv *, jobject, jlong, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqUnsubscribeImp
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqUnsubscribeImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqConsumerCloseImp
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerCloseImp(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: getErrMsgImp
|
||||
* Signature: (I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_getErrMsgImp(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqConsumerPoll
|
||||
* Signature: (JJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerPoll(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqGetTopicName
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicName(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqGetDbName
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetDbName(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqGetVgroupId
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetVgroupId(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: tmqGetTableName
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTableName(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_taosdata_jdbc_tmq_TMQConnector
|
||||
* Method: fetchBlockImp
|
||||
* Signature: (JJLcom/taosdata/jdbc/TSDBResultSetBlockData;ILjava/util/List;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_fetchRawBlockImp(JNIEnv *, jobject, jlong, jlong,
|
||||
jobject, jint, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include "taoserror.h"
|
||||
#include "tdef.h"
|
||||
#include "tlog.h"
|
||||
#include "ttypes.h"
|
||||
|
||||
#ifndef TDENGINE_JNICOMMON_H
|
||||
#define TDENGINE_JNICOMMON_H
|
||||
|
||||
#define jniFatal(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_FATAL) { \
|
||||
taosPrintLog("JNI FATAL ", DEBUG_FATAL, jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniError(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_ERROR) { \
|
||||
taosPrintLog("JNI ERROR ", DEBUG_ERROR, jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniWarn(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_WARN) { \
|
||||
taosPrintLog("JNI WARN ", DEBUG_WARN, jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniInfo(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_INFO) { \
|
||||
taosPrintLog("JNI ", DEBUG_INFO, jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniDebug(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_DEBUG) { \
|
||||
taosPrintLog("JNI ", DEBUG_DEBUG, jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
#define jniTrace(...) \
|
||||
{ \
|
||||
if (jniDebugFlag & DEBUG_TRACE) { \
|
||||
taosPrintLog("JNI ", DEBUG_TRACE, jniDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
}
|
||||
|
||||
extern jclass g_arrayListClass;
|
||||
extern jmethodID g_arrayListConstructFp;
|
||||
extern jmethodID g_arrayListAddFp;
|
||||
|
||||
extern jclass g_metadataClass;
|
||||
extern jmethodID g_metadataConstructFp;
|
||||
extern jfieldID g_metadataColtypeField;
|
||||
extern jfieldID g_metadataColnameField;
|
||||
extern jfieldID g_metadataColsizeField;
|
||||
extern jfieldID g_metadataColindexField;
|
||||
|
||||
extern jclass g_rowdataClass;
|
||||
extern jmethodID g_rowdataConstructor;
|
||||
extern jmethodID g_rowdataClearFp;
|
||||
extern jmethodID g_rowdataSetBooleanFp;
|
||||
extern jmethodID g_rowdataSetByteFp;
|
||||
extern jmethodID g_rowdataSetShortFp;
|
||||
extern jmethodID g_rowdataSetIntFp;
|
||||
extern jmethodID g_rowdataSetLongFp;
|
||||
extern jmethodID g_rowdataSetFloatFp;
|
||||
extern jmethodID g_rowdataSetDoubleFp;
|
||||
extern jmethodID g_rowdataSetStringFp;
|
||||
extern jmethodID g_rowdataSetTimestampFp;
|
||||
extern jmethodID g_rowdataSetByteArrayFp;
|
||||
|
||||
extern jmethodID g_blockdataSetByteArrayFp;
|
||||
extern jmethodID g_blockdataSetNumOfRowsFp;
|
||||
extern jmethodID g_blockdataSetNumOfColsFp;
|
||||
|
||||
extern jclass g_tmqClass;
|
||||
extern jmethodID g_createConsumerErrorCallback;
|
||||
extern jmethodID g_topicListCallback;
|
||||
|
||||
extern jclass g_consumerClass;
|
||||
extern jmethodID g_commitCallback;
|
||||
|
||||
jstring jniFromNCharToByteArray(JNIEnv *, char *, int32_t);
|
||||
|
||||
#define JNI_SUCCESS 0
|
||||
#define JNI_TDENGINE_ERROR -1
|
||||
#define JNI_CONNECTION_NULL -2
|
||||
#define JNI_RESULT_SET_NULL -3
|
||||
#define JNI_NUM_OF_FIELDS_0 -4
|
||||
#define JNI_SQL_NULL -5
|
||||
#define JNI_FETCH_END -6
|
||||
#define JNI_OUT_OF_MEMORY -7
|
||||
|
||||
#define TMQ_CONF_NULL -100;
|
||||
#define TMQ_CONF_KEY_NULL -101;
|
||||
#define TMQ_CONF_VALUE_NULL -102;
|
||||
#define TMQ_TOPIC_NULL -110;
|
||||
#define TMQ_TOPIC_NAME_NULL -111;
|
||||
#define TMQ_CONSUMER_NULL -120;
|
||||
#define TMQ_CONSUMER_CREATE_ERROR -121;
|
||||
|
||||
extern JavaVM *g_vm;
|
||||
|
||||
void jniGetGlobalMethod(JNIEnv *env);
|
||||
|
||||
int32_t check_for_params(jobject jobj, jlong conn, jlong res);
|
||||
|
||||
#endif // TDENGINE_JNICOMMON_H
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// AWTCocoaComponent.h
|
||||
//
|
||||
// Copyright (c) 2003 Apple Computer Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <JavaVM/jni.h>
|
||||
|
||||
// This is implemented by a com.apple.eawt.CocoaComponent. It receives messages
|
||||
// from java safely on the AppKit thread. See the com.apple.eawt.CocoaComponent
|
||||
// java documentation for more information.
|
||||
@protocol AWTCocoaComponent
|
||||
-(void)awtMessage:(jint)messageID message:(jobject)message env:(JNIEnv*)env DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
@end
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* @(#)JDWP.h 1.33 05/11/17
|
||||
*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef JDWP_JDWP_H
|
||||
#define JDWP_JDWP_H
|
||||
|
||||
#include "JDWPCommands.h"
|
||||
|
||||
/*
|
||||
* JDWPCommands.h is the javah'ed version of all the constants defined
|
||||
* com.sun.tools.jdi.JDWP and all its nested classes. Since the names are
|
||||
* very long, the macros below are provided for convenience.
|
||||
*/
|
||||
|
||||
#define JDWP_COMMAND_SET(name) JDWP_ ## name
|
||||
#define JDWP_COMMAND(set, name) JDWP_ ## set ## _ ## name
|
||||
#define JDWP_REQUEST_MODIFIER(name) \
|
||||
JDWP_EventRequest_Set_Out_modifiers_Modifier_ ## name
|
||||
#define JDWP_EVENT(name) \
|
||||
JDWP_EventKind_ ## name
|
||||
#define JDWP_THREAD_STATUS(name) \
|
||||
JDWP_ThreadStatus_ ## name
|
||||
#define JDWP_SUSPEND_STATUS(name) \
|
||||
JDWP_SuspendStatus_SUSPEND_STATUS_ ## name
|
||||
#define JDWP_CLASS_STATUS(name) \
|
||||
JDWP_ClassStatus_ ## name
|
||||
#define JDWP_TYPE_TAG(name) \
|
||||
JDWP_TypeTag_ ## name
|
||||
#define JDWP_TAG(name) \
|
||||
JDWP_Tag_ ## name
|
||||
#define JDWP_STEP_DEPTH(name) \
|
||||
JDWP_StepDepth_ ## name
|
||||
#define JDWP_STEP_SIZE(name) \
|
||||
JDWP_StepSize_ ## name
|
||||
#define JDWP_SUSPEND_POLICY(name) \
|
||||
JDWP_SuspendPolicy_ ## name
|
||||
#define JDWP_INVOKE_OPTIONS(name) \
|
||||
JDWP_InvokeOptions_INVOKE_ ## name
|
||||
#define JDWP_ERROR(name) \
|
||||
JDWP_Error_ ## name
|
||||
#define JDWP_HIGHEST_COMMAND_SET 17
|
||||
#define JDWP_REQUEST_NONE -1
|
||||
|
||||
/* This typedef helps keep the event and error types straight. */
|
||||
typedef unsigned short jdwpError;
|
||||
typedef unsigned char jdwpEvent;
|
||||
typedef jint jdwpThreadStatus;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,257 @@
|
|||
#define JDWP_VirtualMachine 1
|
||||
#define JDWP_VirtualMachine_Version 1
|
||||
#define JDWP_VirtualMachine_ClassesBySignature 2
|
||||
#define JDWP_VirtualMachine_AllClasses 3
|
||||
#define JDWP_VirtualMachine_AllThreads 4
|
||||
#define JDWP_VirtualMachine_TopLevelThreadGroups 5
|
||||
#define JDWP_VirtualMachine_Dispose 6
|
||||
#define JDWP_VirtualMachine_IDSizes 7
|
||||
#define JDWP_VirtualMachine_Suspend 8
|
||||
#define JDWP_VirtualMachine_Resume 9
|
||||
#define JDWP_VirtualMachine_Exit 10
|
||||
#define JDWP_VirtualMachine_CreateString 11
|
||||
#define JDWP_VirtualMachine_Capabilities 12
|
||||
#define JDWP_VirtualMachine_ClassPaths 13
|
||||
#define JDWP_VirtualMachine_DisposeObjects 14
|
||||
#define JDWP_VirtualMachine_HoldEvents 15
|
||||
#define JDWP_VirtualMachine_ReleaseEvents 16
|
||||
#define JDWP_VirtualMachine_CapabilitiesNew 17
|
||||
#define JDWP_VirtualMachine_RedefineClasses 18
|
||||
#define JDWP_VirtualMachine_SetDefaultStratum 19
|
||||
#define JDWP_VirtualMachine_AllClassesWithGeneric 20
|
||||
#define JDWP_VirtualMachine_InstanceCounts 21
|
||||
#define JDWP_ReferenceType 2
|
||||
#define JDWP_ReferenceType_Signature 1
|
||||
#define JDWP_ReferenceType_ClassLoader 2
|
||||
#define JDWP_ReferenceType_Modifiers 3
|
||||
#define JDWP_ReferenceType_Fields 4
|
||||
#define JDWP_ReferenceType_Methods 5
|
||||
#define JDWP_ReferenceType_GetValues 6
|
||||
#define JDWP_ReferenceType_SourceFile 7
|
||||
#define JDWP_ReferenceType_NestedTypes 8
|
||||
#define JDWP_ReferenceType_Status 9
|
||||
#define JDWP_ReferenceType_Interfaces 10
|
||||
#define JDWP_ReferenceType_ClassObject 11
|
||||
#define JDWP_ReferenceType_SourceDebugExtension 12
|
||||
#define JDWP_ReferenceType_SignatureWithGeneric 13
|
||||
#define JDWP_ReferenceType_FieldsWithGeneric 14
|
||||
#define JDWP_ReferenceType_MethodsWithGeneric 15
|
||||
#define JDWP_ReferenceType_Instances 16
|
||||
#define JDWP_ReferenceType_ClassFileVersion 17
|
||||
#define JDWP_ReferenceType_ConstantPool 18
|
||||
#define JDWP_ClassType 3
|
||||
#define JDWP_ClassType_Superclass 1
|
||||
#define JDWP_ClassType_SetValues 2
|
||||
#define JDWP_ClassType_InvokeMethod 3
|
||||
#define JDWP_ClassType_NewInstance 4
|
||||
#define JDWP_ArrayType 4
|
||||
#define JDWP_ArrayType_NewInstance 1
|
||||
#define JDWP_InterfaceType 5
|
||||
#define JDWP_Method 6
|
||||
#define JDWP_Method_LineTable 1
|
||||
#define JDWP_Method_VariableTable 2
|
||||
#define JDWP_Method_Bytecodes 3
|
||||
#define JDWP_Method_IsObsolete 4
|
||||
#define JDWP_Method_VariableTableWithGeneric 5
|
||||
#define JDWP_Field 8
|
||||
#define JDWP_ObjectReference 9
|
||||
#define JDWP_ObjectReference_ReferenceType 1
|
||||
#define JDWP_ObjectReference_GetValues 2
|
||||
#define JDWP_ObjectReference_SetValues 3
|
||||
#define JDWP_ObjectReference_MonitorInfo 5
|
||||
#define JDWP_ObjectReference_InvokeMethod 6
|
||||
#define JDWP_ObjectReference_DisableCollection 7
|
||||
#define JDWP_ObjectReference_EnableCollection 8
|
||||
#define JDWP_ObjectReference_IsCollected 9
|
||||
#define JDWP_ObjectReference_ReferringObjects 10
|
||||
#define JDWP_StringReference 10
|
||||
#define JDWP_StringReference_Value 1
|
||||
#define JDWP_ThreadReference 11
|
||||
#define JDWP_ThreadReference_Name 1
|
||||
#define JDWP_ThreadReference_Suspend 2
|
||||
#define JDWP_ThreadReference_Resume 3
|
||||
#define JDWP_ThreadReference_Status 4
|
||||
#define JDWP_ThreadReference_ThreadGroup 5
|
||||
#define JDWP_ThreadReference_Frames 6
|
||||
#define JDWP_ThreadReference_FrameCount 7
|
||||
#define JDWP_ThreadReference_OwnedMonitors 8
|
||||
#define JDWP_ThreadReference_CurrentContendedMonitor 9
|
||||
#define JDWP_ThreadReference_Stop 10
|
||||
#define JDWP_ThreadReference_Interrupt 11
|
||||
#define JDWP_ThreadReference_SuspendCount 12
|
||||
#define JDWP_ThreadReference_OwnedMonitorsStackDepthInfo 13
|
||||
#define JDWP_ThreadReference_ForceEarlyReturn 14
|
||||
#define JDWP_ThreadGroupReference 12
|
||||
#define JDWP_ThreadGroupReference_Name 1
|
||||
#define JDWP_ThreadGroupReference_Parent 2
|
||||
#define JDWP_ThreadGroupReference_Children 3
|
||||
#define JDWP_ArrayReference 13
|
||||
#define JDWP_ArrayReference_Length 1
|
||||
#define JDWP_ArrayReference_GetValues 2
|
||||
#define JDWP_ArrayReference_SetValues 3
|
||||
#define JDWP_ClassLoaderReference 14
|
||||
#define JDWP_ClassLoaderReference_VisibleClasses 1
|
||||
#define JDWP_EventRequest 15
|
||||
#define JDWP_EventRequest_Set 1
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_Count 1
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_Conditional 2
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ThreadOnly 3
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassOnly 4
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassMatch 5
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ClassExclude 6
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly 7
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_ExceptionOnly 8
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_FieldOnly 9
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_Step 10
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_InstanceOnly 11
|
||||
#define JDWP_EventRequest_Set_Out_modifiers_Modifier_SourceNameMatch 12
|
||||
#define JDWP_EventRequest_Clear 2
|
||||
#define JDWP_EventRequest_ClearAllBreakpoints 3
|
||||
#define JDWP_StackFrame 16
|
||||
#define JDWP_StackFrame_GetValues 1
|
||||
#define JDWP_StackFrame_SetValues 2
|
||||
#define JDWP_StackFrame_ThisObject 3
|
||||
#define JDWP_StackFrame_PopFrames 4
|
||||
#define JDWP_ClassObjectReference 17
|
||||
#define JDWP_ClassObjectReference_ReflectedType 1
|
||||
#define JDWP_Event 64
|
||||
#define JDWP_Event_Composite 100
|
||||
#define JDWP_Event_Composite_Event_events_Events_VMStart JDWP.EventKind.VM_START
|
||||
#define JDWP_Event_Composite_Event_events_Events_SingleStep JDWP.EventKind.SINGLE_STEP
|
||||
#define JDWP_Event_Composite_Event_events_Events_Breakpoint JDWP.EventKind.BREAKPOINT
|
||||
#define JDWP_Event_Composite_Event_events_Events_MethodEntry JDWP.EventKind.METHOD_ENTRY
|
||||
#define JDWP_Event_Composite_Event_events_Events_MethodExit JDWP.EventKind.METHOD_EXIT
|
||||
#define JDWP_Event_Composite_Event_events_Events_MethodExitWithReturnValue JDWP.EventKind.METHOD_EXIT_WITH_RETURN_VALUE
|
||||
#define JDWP_Event_Composite_Event_events_Events_MonitorContendedEnter JDWP.EventKind.MONITOR_CONTENDED_ENTER
|
||||
#define JDWP_Event_Composite_Event_events_Events_MonitorContendedEntered JDWP.EventKind.MONITOR_CONTENDED_ENTERED
|
||||
#define JDWP_Event_Composite_Event_events_Events_MonitorWait JDWP.EventKind.MONITOR_WAIT
|
||||
#define JDWP_Event_Composite_Event_events_Events_MonitorWaited JDWP.EventKind.MONITOR_WAITED
|
||||
#define JDWP_Event_Composite_Event_events_Events_Exception JDWP.EventKind.EXCEPTION
|
||||
#define JDWP_Event_Composite_Event_events_Events_ThreadStart JDWP.EventKind.THREAD_START
|
||||
#define JDWP_Event_Composite_Event_events_Events_ThreadDeath JDWP.EventKind.THREAD_DEATH
|
||||
#define JDWP_Event_Composite_Event_events_Events_ClassPrepare JDWP.EventKind.CLASS_PREPARE
|
||||
#define JDWP_Event_Composite_Event_events_Events_ClassUnload JDWP.EventKind.CLASS_UNLOAD
|
||||
#define JDWP_Event_Composite_Event_events_Events_FieldAccess JDWP.EventKind.FIELD_ACCESS
|
||||
#define JDWP_Event_Composite_Event_events_Events_FieldModification JDWP.EventKind.FIELD_MODIFICATION
|
||||
#define JDWP_Event_Composite_Event_events_Events_VMDeath JDWP.EventKind.VM_DEATH
|
||||
#define JDWP_Error_NONE 0
|
||||
#define JDWP_Error_INVALID_THREAD 10
|
||||
#define JDWP_Error_INVALID_THREAD_GROUP 11
|
||||
#define JDWP_Error_INVALID_PRIORITY 12
|
||||
#define JDWP_Error_THREAD_NOT_SUSPENDED 13
|
||||
#define JDWP_Error_THREAD_SUSPENDED 14
|
||||
#define JDWP_Error_THREAD_NOT_ALIVE 15
|
||||
#define JDWP_Error_INVALID_OBJECT 20
|
||||
#define JDWP_Error_INVALID_CLASS 21
|
||||
#define JDWP_Error_CLASS_NOT_PREPARED 22
|
||||
#define JDWP_Error_INVALID_METHODID 23
|
||||
#define JDWP_Error_INVALID_LOCATION 24
|
||||
#define JDWP_Error_INVALID_FIELDID 25
|
||||
#define JDWP_Error_INVALID_FRAMEID 30
|
||||
#define JDWP_Error_NO_MORE_FRAMES 31
|
||||
#define JDWP_Error_OPAQUE_FRAME 32
|
||||
#define JDWP_Error_NOT_CURRENT_FRAME 33
|
||||
#define JDWP_Error_TYPE_MISMATCH 34
|
||||
#define JDWP_Error_INVALID_SLOT 35
|
||||
#define JDWP_Error_DUPLICATE 40
|
||||
#define JDWP_Error_NOT_FOUND 41
|
||||
#define JDWP_Error_INVALID_MONITOR 50
|
||||
#define JDWP_Error_NOT_MONITOR_OWNER 51
|
||||
#define JDWP_Error_INTERRUPT 52
|
||||
#define JDWP_Error_INVALID_CLASS_FORMAT 60
|
||||
#define JDWP_Error_CIRCULAR_CLASS_DEFINITION 61
|
||||
#define JDWP_Error_FAILS_VERIFICATION 62
|
||||
#define JDWP_Error_ADD_METHOD_NOT_IMPLEMENTED 63
|
||||
#define JDWP_Error_SCHEMA_CHANGE_NOT_IMPLEMENTED 64
|
||||
#define JDWP_Error_INVALID_TYPESTATE 65
|
||||
#define JDWP_Error_HIERARCHY_CHANGE_NOT_IMPLEMENTED 66
|
||||
#define JDWP_Error_DELETE_METHOD_NOT_IMPLEMENTED 67
|
||||
#define JDWP_Error_UNSUPPORTED_VERSION 68
|
||||
#define JDWP_Error_NAMES_DONT_MATCH 69
|
||||
#define JDWP_Error_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED 70
|
||||
#define JDWP_Error_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED 71
|
||||
#define JDWP_Error_NOT_IMPLEMENTED 99
|
||||
#define JDWP_Error_NULL_POINTER 100
|
||||
#define JDWP_Error_ABSENT_INFORMATION 101
|
||||
#define JDWP_Error_INVALID_EVENT_TYPE 102
|
||||
#define JDWP_Error_ILLEGAL_ARGUMENT 103
|
||||
#define JDWP_Error_OUT_OF_MEMORY 110
|
||||
#define JDWP_Error_ACCESS_DENIED 111
|
||||
#define JDWP_Error_VM_DEAD 112
|
||||
#define JDWP_Error_INTERNAL 113
|
||||
#define JDWP_Error_UNATTACHED_THREAD 115
|
||||
#define JDWP_Error_INVALID_TAG 500
|
||||
#define JDWP_Error_ALREADY_INVOKING 502
|
||||
#define JDWP_Error_INVALID_INDEX 503
|
||||
#define JDWP_Error_INVALID_LENGTH 504
|
||||
#define JDWP_Error_INVALID_STRING 506
|
||||
#define JDWP_Error_INVALID_CLASS_LOADER 507
|
||||
#define JDWP_Error_INVALID_ARRAY 508
|
||||
#define JDWP_Error_TRANSPORT_LOAD 509
|
||||
#define JDWP_Error_TRANSPORT_INIT 510
|
||||
#define JDWP_Error_NATIVE_METHOD 511
|
||||
#define JDWP_Error_INVALID_COUNT 512
|
||||
#define JDWP_EventKind_SINGLE_STEP 1
|
||||
#define JDWP_EventKind_BREAKPOINT 2
|
||||
#define JDWP_EventKind_FRAME_POP 3
|
||||
#define JDWP_EventKind_EXCEPTION 4
|
||||
#define JDWP_EventKind_USER_DEFINED 5
|
||||
#define JDWP_EventKind_THREAD_START 6
|
||||
#define JDWP_EventKind_THREAD_DEATH 7
|
||||
#define JDWP_EventKind_THREAD_END 7
|
||||
#define JDWP_EventKind_CLASS_PREPARE 8
|
||||
#define JDWP_EventKind_CLASS_UNLOAD 9
|
||||
#define JDWP_EventKind_CLASS_LOAD 10
|
||||
#define JDWP_EventKind_FIELD_ACCESS 20
|
||||
#define JDWP_EventKind_FIELD_MODIFICATION 21
|
||||
#define JDWP_EventKind_EXCEPTION_CATCH 30
|
||||
#define JDWP_EventKind_METHOD_ENTRY 40
|
||||
#define JDWP_EventKind_METHOD_EXIT 41
|
||||
#define JDWP_EventKind_METHOD_EXIT_WITH_RETURN_VALUE 42
|
||||
#define JDWP_EventKind_MONITOR_CONTENDED_ENTER 43
|
||||
#define JDWP_EventKind_MONITOR_CONTENDED_ENTERED 44
|
||||
#define JDWP_EventKind_MONITOR_WAIT 45
|
||||
#define JDWP_EventKind_MONITOR_WAITED 46
|
||||
#define JDWP_EventKind_VM_START 90
|
||||
#define JDWP_EventKind_VM_INIT 90
|
||||
#define JDWP_EventKind_VM_DEATH 99
|
||||
#define JDWP_EventKind_VM_DISCONNECTED 100
|
||||
#define JDWP_ThreadStatus_ZOMBIE 0
|
||||
#define JDWP_ThreadStatus_RUNNING 1
|
||||
#define JDWP_ThreadStatus_SLEEPING 2
|
||||
#define JDWP_ThreadStatus_MONITOR 3
|
||||
#define JDWP_ThreadStatus_WAIT 4
|
||||
#define JDWP_SuspendStatus_SUSPEND_STATUS_SUSPENDED 0x1
|
||||
#define JDWP_ClassStatus_VERIFIED 1
|
||||
#define JDWP_ClassStatus_PREPARED 2
|
||||
#define JDWP_ClassStatus_INITIALIZED 4
|
||||
#define JDWP_ClassStatus_ERROR 8
|
||||
#define JDWP_TypeTag_CLASS 1
|
||||
#define JDWP_TypeTag_INTERFACE 2
|
||||
#define JDWP_TypeTag_ARRAY 3
|
||||
#define JDWP_Tag_ARRAY 91
|
||||
#define JDWP_Tag_BYTE 66
|
||||
#define JDWP_Tag_CHAR 67
|
||||
#define JDWP_Tag_OBJECT 76
|
||||
#define JDWP_Tag_FLOAT 70
|
||||
#define JDWP_Tag_DOUBLE 68
|
||||
#define JDWP_Tag_INT 73
|
||||
#define JDWP_Tag_LONG 74
|
||||
#define JDWP_Tag_SHORT 83
|
||||
#define JDWP_Tag_VOID 86
|
||||
#define JDWP_Tag_BOOLEAN 90
|
||||
#define JDWP_Tag_STRING 115
|
||||
#define JDWP_Tag_THREAD 116
|
||||
#define JDWP_Tag_THREAD_GROUP 103
|
||||
#define JDWP_Tag_CLASS_LOADER 108
|
||||
#define JDWP_Tag_CLASS_OBJECT 99
|
||||
#define JDWP_StepDepth_INTO 0
|
||||
#define JDWP_StepDepth_OVER 1
|
||||
#define JDWP_StepDepth_OUT 2
|
||||
#define JDWP_StepSize_MIN 0
|
||||
#define JDWP_StepSize_LINE 1
|
||||
#define JDWP_SuspendPolicy_NONE 0
|
||||
#define JDWP_SuspendPolicy_EVENT_THREAD 1
|
||||
#define JDWP_SuspendPolicy_ALL 2
|
||||
#define JDWP_InvokeOptions_INVOKE_SINGLE_THREADED 0x01
|
||||
#define JDWP_InvokeOptions_INVOKE_NONVIRTUAL 0x02
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* JavaVM.h
|
||||
*
|
||||
* Copyright (C) 1997-2001, Apple Computer, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <JavaVM/NSJavaVirtualMachine.h>
|
||||
#import <JavaVM/NSJavaConfiguration.h>
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* NSJavaConfiguration.h
|
||||
*
|
||||
* Copyright (c) 1997-2001, Apple Computer, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* LaurentR- April, 2000
|
||||
* - added:
|
||||
* NSDefaultJavaLibraryKey
|
||||
* NSDefaultJavaDebugLibraryKey
|
||||
* NSDefaultObjCJavaLibraryKey
|
||||
* NSDefaultObjCJavaDebugLibraryKey
|
||||
* NSJavaVMArgumentsKey
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// The configuration dictionary contains a set of vendor-specific key/value
|
||||
// pairs and a set of default key/value pairs. If no vendor is specified,
|
||||
// NSJavaConfiguration uses the NSDefaultJavaVendorKey key to determine which
|
||||
// vendor-specific dictionary should be searched before the top-level dictionary// is searched. eg.:
|
||||
/*
|
||||
{
|
||||
Vendor = sun;
|
||||
default = {
|
||||
DefaultClasspath = "/NextLibrary/Java";
|
||||
};
|
||||
next = {
|
||||
Compiler = "/usr/bin/javac";
|
||||
VM = "/usr/bin/java";
|
||||
};
|
||||
sun = {
|
||||
Compiler = "/NextLibrary/JDK/bin/javac";
|
||||
VM = "/NextLibrary/JDK/bin/java";
|
||||
};
|
||||
}
|
||||
*/
|
||||
// In this case, if no vendor is specified, the `sun' mappings will be searched
|
||||
// first. The value for `VM' would be "/NextLibrary/JDK/bin/java" and the value
|
||||
// for `DefaultClasspath' would be "/NextLibrary/Java".
|
||||
//
|
||||
// This search patter is applied to three dictionaries, in order:
|
||||
// - the JavaConfiguration dictionary in the defaults for the application
|
||||
// - the dictionary in the "JavaConfiguration" domain of the user defaults
|
||||
// - the configuration file (/NextLibrary/Java/JavaConfig.plist).
|
||||
// This permits per-application, per-user and per-system specifications.
|
||||
|
||||
|
||||
extern NSString *NSDefaultJavaVendorKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
extern NSString *NSDefaultJavaVMKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
extern NSString *NSDefaultJavaCompilerKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
extern NSString *NSDefaultJavaClassPathKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
extern NSString *NSDefaultJavaLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
extern NSString *NSDefaultJavaDebugLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
extern NSString *NSDefaultObjCJavaLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
extern NSString *NSDefaultObjCJavaDebugLibraryKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
extern NSString *NSJavaVMArgumentsKey DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
|
||||
@interface NSJavaConfiguration : NSObject
|
||||
{
|
||||
NSString *_vendorName;
|
||||
}
|
||||
|
||||
+ (NSJavaConfiguration *) defaultConfiguration DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
+ (NSJavaConfiguration *) configurationForVendor:(NSString *)vendorName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
+ (NSArray *) vendorNames DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
- init DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
- initWithVendor:(NSString *)vendorName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
- (NSString *) vendorName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
- valueForKey:(NSString *)keyName DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
- valueForKey:(NSString *)keyName expandEnvironmentVariables:(BOOL)flag DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* NSJavaVirtualMachine.h
|
||||
*
|
||||
* Copyright (c) 1997-2001, Apple Computer, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSJavaVirtualMachine : NSObject
|
||||
{
|
||||
@private
|
||||
void *_vmdata;
|
||||
}
|
||||
|
||||
|
||||
// Returns the default virtual machine - if necessary, calls alloc + init
|
||||
|
||||
+ (id) defaultVirtualMachine DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
// Returns a class path. First checks NSProcessInfo for an environment variable
|
||||
// called CLASSPATH and if that doesn't exist, uses NSJavaConfiguration to find
|
||||
// the default class path.
|
||||
|
||||
+ (NSString *) defaultClassPath DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
// Note that any NSThreads spawned after this method returns will automatically
|
||||
// be attached to the virtual machine. Likewise, it is not necessary to attach
|
||||
// the thread that is actually creating the virtual machine. If you spawn a
|
||||
// thread before creating the virtual machine, or if you use the cthread/pthread
|
||||
// or any other non-NSThread api for creating a thread, you must explicitly
|
||||
// attach those threads before messaging any Java object from that thread.
|
||||
// This is most easily done by using the -attachCurrentThread method.
|
||||
// Use -detachCurrentThread to detach explicitly attached threads when done.
|
||||
|
||||
- initWithClassPath:(NSString *)classPath DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
- (void) attachCurrentThread DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
- (void) detachCurrentThread DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
- (Class)findClass:(NSString *)className DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
- (Class)defineClass:(NSData *)javaClassData withName:(NSString *)className DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface NSObject (InstantiatingJavaObjects)
|
||||
|
||||
// Instantiating java objects for when no -init/constructor mapping works.
|
||||
// The class these methods are invoked on *must* be a class returned by the
|
||||
// -findClass: method (or NSClassFromString() function), otherwise
|
||||
// NSInvalidJavaClassException is raised. The signature is specified using the
|
||||
// rather counter-intuitive format defined by the Java Virtual Machine
|
||||
// specification. Try looking in JavaVM/vm-interface.h for help.
|
||||
|
||||
+ (id) newWithSignature:(NSString *)signature, ... DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
+ (id) newWithSignature:(NSString *)signature arguments:(va_list)args DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
@end
|
||||
|
||||
extern NSString *NSInvalidJavaClassException DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
|
|
@ -0,0 +1,278 @@
|
|||
/*
|
||||
* @(#)jawt.h 1.11 05/11/17
|
||||
*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JAWT_H_
|
||||
#define _JAVASOFT_JAWT_H_
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* AWT native interface (new in JDK 1.3)
|
||||
*
|
||||
* The AWT native interface allows a native C or C++ application a means
|
||||
* by which to access native structures in AWT. This is to facilitate moving
|
||||
* legacy C and C++ applications to Java and to target the needs of the
|
||||
* community who, at present, wish to do their own native rendering to canvases
|
||||
* for performance reasons. Standard extensions such as Java3D also require a
|
||||
* means to access the underlying native data structures of AWT.
|
||||
*
|
||||
* There may be future extensions to this API depending on demand.
|
||||
*
|
||||
* A VM does not have to implement this API in order to pass the JCK.
|
||||
* It is recommended, however, that this API is implemented on VMs that support
|
||||
* standard extensions, such as Java3D.
|
||||
*
|
||||
* Since this is a native API, any program which uses it cannot be considered
|
||||
* 100% pure java.
|
||||
*/
|
||||
|
||||
/*
|
||||
* AWT Native Drawing Surface (JAWT_DrawingSurface).
|
||||
*
|
||||
* For each platform, there is a native drawing surface structure. This
|
||||
* platform-specific structure can be found in jawt_md.h. It is recommended
|
||||
* that additional platforms follow the same model. It is also recommended
|
||||
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
|
||||
*
|
||||
*******************
|
||||
* EXAMPLE OF USAGE:
|
||||
*******************
|
||||
*
|
||||
* In Win32, a programmer wishes to access the HWND of a canvas to perform
|
||||
* native rendering into it. The programmer has declared the paint() method
|
||||
* for their canvas subclass to be native:
|
||||
*
|
||||
*
|
||||
* MyCanvas.java:
|
||||
*
|
||||
* import java.awt.*;
|
||||
*
|
||||
* public class MyCanvas extends Canvas {
|
||||
*
|
||||
* static {
|
||||
* System.loadLibrary("mylib");
|
||||
* }
|
||||
*
|
||||
* public native void paint(Graphics g);
|
||||
* }
|
||||
*
|
||||
*
|
||||
* myfile.c:
|
||||
*
|
||||
* #include "jawt_md.h"
|
||||
* #include <assert.h>
|
||||
*
|
||||
* JNIEXPORT void JNICALL
|
||||
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
|
||||
* {
|
||||
* JAWT awt;
|
||||
* JAWT_DrawingSurface* ds;
|
||||
* JAWT_DrawingSurfaceInfo* dsi;
|
||||
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
|
||||
* jboolean result;
|
||||
* jint lock;
|
||||
*
|
||||
* // Get the AWT
|
||||
* awt.version = JAWT_VERSION_1_3;
|
||||
* result = JAWT_GetAWT(env, &awt);
|
||||
* assert(result != JNI_FALSE);
|
||||
*
|
||||
* // Get the drawing surface
|
||||
* ds = awt.GetDrawingSurface(env, canvas);
|
||||
* assert(ds != NULL);
|
||||
*
|
||||
* // Lock the drawing surface
|
||||
* lock = ds->Lock(ds);
|
||||
* assert((lock & JAWT_LOCK_ERROR) == 0);
|
||||
*
|
||||
* // Get the drawing surface info
|
||||
* dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||
*
|
||||
* // Get the platform-specific drawing info
|
||||
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
|
||||
*
|
||||
* //////////////////////////////
|
||||
* // !!! DO PAINTING HERE !!! //
|
||||
* //////////////////////////////
|
||||
*
|
||||
* // Free the drawing surface info
|
||||
* ds->FreeDrawingSurfaceInfo(dsi);
|
||||
*
|
||||
* // Unlock the drawing surface
|
||||
* ds->Unlock(ds);
|
||||
*
|
||||
* // Free the drawing surface
|
||||
* awt.FreeDrawingSurface(ds);
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* JAWT_Rectangle
|
||||
* Structure for a native rectangle.
|
||||
*/
|
||||
typedef struct jawt_Rectangle {
|
||||
jint x;
|
||||
jint y;
|
||||
jint width;
|
||||
jint height;
|
||||
} JAWT_Rectangle;
|
||||
|
||||
struct jawt_DrawingSurface;
|
||||
|
||||
/*
|
||||
* JAWT_DrawingSurfaceInfo
|
||||
* Structure for containing the underlying drawing information of a component.
|
||||
*/
|
||||
typedef struct jawt_DrawingSurfaceInfo {
|
||||
/*
|
||||
* Pointer to the platform-specific information. This can be safely
|
||||
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
|
||||
* JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details.
|
||||
*/
|
||||
void* platformInfo;
|
||||
/* Cached pointer to the underlying drawing surface */
|
||||
struct jawt_DrawingSurface* ds;
|
||||
/* Bounding rectangle of the drawing surface */
|
||||
JAWT_Rectangle bounds;
|
||||
/* Number of rectangles in the clip */
|
||||
jint clipSize;
|
||||
/* Clip rectangle array */
|
||||
JAWT_Rectangle* clip;
|
||||
} JAWT_DrawingSurfaceInfo;
|
||||
|
||||
#define JAWT_LOCK_ERROR 0x00000001
|
||||
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
|
||||
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
|
||||
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
|
||||
|
||||
/*
|
||||
* JAWT_DrawingSurface
|
||||
* Structure for containing the underlying drawing information of a component.
|
||||
* All operations on a JAWT_DrawingSurface MUST be performed from the same
|
||||
* thread as the call to GetDrawingSurface.
|
||||
*/
|
||||
typedef struct jawt_DrawingSurface {
|
||||
/*
|
||||
* Cached reference to the Java environment of the calling thread.
|
||||
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
|
||||
* FreeDrawingSurfaceInfo() are called from a different thread,
|
||||
* this data member should be set before calling those functions.
|
||||
*/
|
||||
JNIEnv* env;
|
||||
/* Cached reference to the target object */
|
||||
jobject target;
|
||||
/*
|
||||
* Lock the surface of the target component for native rendering.
|
||||
* When finished drawing, the surface must be unlocked with
|
||||
* Unlock(). This function returns a bitmask with one or more of the
|
||||
* following values:
|
||||
*
|
||||
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
|
||||
* be locked.
|
||||
*
|
||||
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
|
||||
*
|
||||
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
|
||||
*
|
||||
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
|
||||
*/
|
||||
jint (JNICALL *Lock)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
/*
|
||||
* Get the drawing surface info.
|
||||
* The value returned may be cached, but the values may change if
|
||||
* additional calls to Lock() or Unlock() are made.
|
||||
* Lock() must be called before this can return a valid value.
|
||||
* Returns NULL if an error has occurred.
|
||||
* When finished with the returned value, FreeDrawingSurfaceInfo must be
|
||||
* called.
|
||||
*/
|
||||
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
/*
|
||||
* Free the drawing surface info.
|
||||
*/
|
||||
void (JNICALL *FreeDrawingSurfaceInfo)
|
||||
(JAWT_DrawingSurfaceInfo* dsi);
|
||||
/*
|
||||
* Unlock the drawing surface of the target component for native rendering.
|
||||
*/
|
||||
void (JNICALL *Unlock)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
} JAWT_DrawingSurface;
|
||||
|
||||
/*
|
||||
* JAWT
|
||||
* Structure for containing native AWT functions.
|
||||
*/
|
||||
typedef struct jawt {
|
||||
/*
|
||||
* Version of this structure. This must always be set before
|
||||
* calling JAWT_GetAWT()
|
||||
*/
|
||||
jint version;
|
||||
/*
|
||||
* Return a drawing surface from a target jobject. This value
|
||||
* may be cached.
|
||||
* Returns NULL if an error has occurred.
|
||||
* Target must be a java.awt.Component (should be a Canvas
|
||||
* or Window for native rendering).
|
||||
* FreeDrawingSurface() must be called when finished with the
|
||||
* returned JAWT_DrawingSurface.
|
||||
*/
|
||||
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
|
||||
(JNIEnv* env, jobject target);
|
||||
/*
|
||||
* Free the drawing surface allocated in GetDrawingSurface.
|
||||
*/
|
||||
void (JNICALL *FreeDrawingSurface)
|
||||
(JAWT_DrawingSurface* ds);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Locks the entire AWT for synchronization purposes
|
||||
*/
|
||||
void (JNICALL *Lock)(JNIEnv* env);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Unlocks the entire AWT for synchronization purposes
|
||||
*/
|
||||
void (JNICALL *Unlock)(JNIEnv* env);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Returns a reference to a java.awt.Component from a native
|
||||
* platform handle. On Windows, this corresponds to an HWND;
|
||||
* on Solaris and Linux, this is a Drawable. For other platforms,
|
||||
* see the appropriate machine-dependent header file for a description.
|
||||
* The reference returned by this function is a local
|
||||
* reference that is only valid in this environment.
|
||||
* This function returns a NULL reference if no component could be
|
||||
* found with matching platform information.
|
||||
*/
|
||||
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
|
||||
|
||||
} JAWT;
|
||||
|
||||
/*
|
||||
* Get the AWT native structure. This function returns JNI_FALSE if
|
||||
* an error occurs.
|
||||
*/
|
||||
_JNI_IMPORT_OR_EXPORT_ __attribute__((deprecated))
|
||||
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
|
||||
|
||||
#define JAWT_VERSION_1_3 0x00010003
|
||||
#define JAWT_VERSION_1_4 0x00010004
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* !_JAVASOFT_JAWT_H_ */
|
|
@ -0,0 +1,66 @@
|
|||
//
|
||||
// jawt_md.h
|
||||
// Copyright (c) 2002-2010 Apple Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _JAVASOFT_JAWT_MD_H_
|
||||
#define _JAVASOFT_JAWT_MD_H_
|
||||
|
||||
#include "jawt.h"
|
||||
|
||||
#import <AppKit/NSView.h>
|
||||
#import <QuartzCore/CALayer.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* JAWT on Mac OS X has two rendering models; legacy NSView, and CALayer.
|
||||
*
|
||||
* The CALayer based model returns an object conforming to the JAWT_SurfaceLayers
|
||||
* protocol in it's JAWT_DrawingSurfaceInfo->platformInfo pointer. A CALayer
|
||||
* assigned to the "layer" property overlays the rectangle of the java.awt.Component.
|
||||
* The client CALayer traces the rect of the Java component as it is moved and resized.
|
||||
*
|
||||
* If there is a superlayer for the entire window, it is also accessible via
|
||||
* the "windowLayer" property. This layer is useful for embedding the Java
|
||||
* window in other layer graphs.
|
||||
*
|
||||
*
|
||||
* The legacy NSView model provides raw access to the NSView hierarchy which
|
||||
* mirrors the Java component hierarchy. The legacy NSView drawing model is deprecated,
|
||||
* and will not be available in future versions of Java for Mac OS X.
|
||||
*
|
||||
* Clients can opt-into the CALayer model by OR'ing the JAWT_MACOSX_USE_CALAYER into the requested JAWT version.
|
||||
*
|
||||
* JAWT awt;
|
||||
* awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
|
||||
* jboolean success = JAWT_GetAWT(env, &awt);
|
||||
*
|
||||
* Future versions of Java for Mac OS X will only support the CALayer model,
|
||||
* and will not return a JAWT_MacOSXDrawingSurfaceInfo struct.
|
||||
*/
|
||||
|
||||
#define JAWT_MACOSX_USE_CALAYER 0x80000000
|
||||
|
||||
// CALayer-based rendering
|
||||
@protocol JAWT_SurfaceLayers
|
||||
@property (readwrite, retain) CALayer *layer;
|
||||
@property (readonly) CALayer *windowLayer;
|
||||
@end
|
||||
|
||||
|
||||
// Legacy NSView-based rendering
|
||||
typedef struct JAWT_MacOSXDrawingSurfaceInfo {
|
||||
NSView *cocoaViewRef; // the view is guaranteed to be valid only for the duration of Component.paint method
|
||||
}
|
||||
JAWT_MacOSXDrawingSurfaceInfo;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_JAVASOFT_JAWT_MD_H_ */
|
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* @(#)jdwpTransport.h 1.8 05/11/17
|
||||
*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Java Debug Wire Protocol Transport Service Provider Interface.
|
||||
*/
|
||||
|
||||
#ifndef JDWPTRANSPORT_H
|
||||
#define JDWPTRANSPORT_H
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
enum {
|
||||
JDWPTRANSPORT_VERSION_1_0 = 0x00010000
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct jdwpTransportNativeInterface_;
|
||||
|
||||
struct _jdwpTransportEnv;
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef _jdwpTransportEnv jdwpTransportEnv;
|
||||
#else
|
||||
typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Errors. Universal errors with JVMTI/JVMDI equivalents keep the
|
||||
* values the same.
|
||||
*/
|
||||
typedef enum {
|
||||
JDWPTRANSPORT_ERROR_NONE = 0,
|
||||
JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
|
||||
JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
|
||||
JDWPTRANSPORT_ERROR_INTERNAL = 113,
|
||||
JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
|
||||
JDWPTRANSPORT_ERROR_IO_ERROR = 202,
|
||||
JDWPTRANSPORT_ERROR_TIMEOUT = 203,
|
||||
JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
|
||||
} jdwpTransportError;
|
||||
|
||||
|
||||
/*
|
||||
* Structure to define capabilities
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int can_timeout_attach :1;
|
||||
unsigned int can_timeout_accept :1;
|
||||
unsigned int can_timeout_handshake :1;
|
||||
unsigned int reserved3 :1;
|
||||
unsigned int reserved4 :1;
|
||||
unsigned int reserved5 :1;
|
||||
unsigned int reserved6 :1;
|
||||
unsigned int reserved7 :1;
|
||||
unsigned int reserved8 :1;
|
||||
unsigned int reserved9 :1;
|
||||
unsigned int reserved10 :1;
|
||||
unsigned int reserved11 :1;
|
||||
unsigned int reserved12 :1;
|
||||
unsigned int reserved13 :1;
|
||||
unsigned int reserved14 :1;
|
||||
unsigned int reserved15 :1;
|
||||
} JDWPTransportCapabilities;
|
||||
|
||||
|
||||
/*
|
||||
* Structures to define packet layout.
|
||||
*
|
||||
* See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
|
||||
*/
|
||||
|
||||
enum {
|
||||
JDWPTRANSPORT_FLAGS_NONE = 0x0,
|
||||
JDWPTRANSPORT_FLAGS_REPLY = 0x80
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
jint len;
|
||||
jint id;
|
||||
jbyte flags;
|
||||
jbyte cmdSet;
|
||||
jbyte cmd;
|
||||
jbyte *data;
|
||||
} jdwpCmdPacket;
|
||||
|
||||
typedef struct {
|
||||
jint len;
|
||||
jint id;
|
||||
jbyte flags;
|
||||
jshort errorCode;
|
||||
jbyte *data;
|
||||
} jdwpReplyPacket;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
jdwpCmdPacket cmd;
|
||||
jdwpReplyPacket reply;
|
||||
} type;
|
||||
} jdwpPacket;
|
||||
|
||||
/*
|
||||
* JDWP functions called by the transport.
|
||||
*/
|
||||
typedef struct jdwpTransportCallback {
|
||||
void *(*alloc)(jint numBytes); /* Call this for all allocations */
|
||||
void (*free)(void *buffer); /* Call this for all deallocations */
|
||||
} jdwpTransportCallback;
|
||||
|
||||
typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
|
||||
jdwpTransportCallback *callback,
|
||||
jint version,
|
||||
jdwpTransportEnv** env);
|
||||
|
||||
|
||||
|
||||
/* Function Interface */
|
||||
|
||||
struct jdwpTransportNativeInterface_ {
|
||||
/* 1 : RESERVED */
|
||||
void *reserved1;
|
||||
|
||||
/* 2 : Get Capabilities */
|
||||
jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
|
||||
JDWPTransportCapabilities *capabilities_ptr);
|
||||
|
||||
/* 3 : Attach */
|
||||
jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
|
||||
const char* address,
|
||||
jlong attach_timeout,
|
||||
jlong handshake_timeout);
|
||||
|
||||
/* 4: StartListening */
|
||||
jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
|
||||
const char* address,
|
||||
char** actual_address);
|
||||
|
||||
/* 5: StopListening */
|
||||
jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
|
||||
|
||||
/* 6: Accept */
|
||||
jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
|
||||
jlong accept_timeout,
|
||||
jlong handshake_timeout);
|
||||
|
||||
/* 7: IsOpen */
|
||||
jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
|
||||
|
||||
/* 8: Close */
|
||||
jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
|
||||
|
||||
/* 9: ReadPacket */
|
||||
jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
|
||||
jdwpPacket *pkt);
|
||||
|
||||
/* 10: Write Packet */
|
||||
jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
|
||||
const jdwpPacket* pkt);
|
||||
|
||||
/* 11: GetLastError */
|
||||
jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
|
||||
char** error);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Use inlined functions so that C++ code can use syntax such as
|
||||
* env->Attach("mymachine:5000", 10*1000, 0);
|
||||
*
|
||||
* rather than using C's :-
|
||||
*
|
||||
* (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
|
||||
*/
|
||||
struct _jdwpTransportEnv {
|
||||
const struct jdwpTransportNativeInterface_ *functions;
|
||||
#ifdef __cplusplus
|
||||
|
||||
jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
|
||||
return functions->GetCapabilities(this, capabilities_ptr);
|
||||
}
|
||||
|
||||
jdwpTransportError Attach(const char* address, jlong attach_timeout,
|
||||
jlong handshake_timeout) {
|
||||
return functions->Attach(this, address, attach_timeout, handshake_timeout);
|
||||
}
|
||||
|
||||
jdwpTransportError StartListening(const char* address,
|
||||
char** actual_address) {
|
||||
return functions->StartListening(this, address, actual_address);
|
||||
}
|
||||
|
||||
jdwpTransportError StopListening(void) {
|
||||
return functions->StopListening(this);
|
||||
}
|
||||
|
||||
jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
|
||||
return functions->Accept(this, accept_timeout, handshake_timeout);
|
||||
}
|
||||
|
||||
jboolean IsOpen(void) {
|
||||
return functions->IsOpen(this);
|
||||
}
|
||||
|
||||
jdwpTransportError Close(void) {
|
||||
return functions->Close(this);
|
||||
}
|
||||
|
||||
jdwpTransportError ReadPacket(jdwpPacket *pkt) {
|
||||
return functions->ReadPacket(this, pkt);
|
||||
}
|
||||
|
||||
jdwpTransportError WritePacket(const jdwpPacket* pkt) {
|
||||
return functions->WritePacket(this, pkt);
|
||||
}
|
||||
|
||||
jdwpTransportError GetLastError(char** error) {
|
||||
return functions->GetLastError(this, error);
|
||||
}
|
||||
|
||||
|
||||
#endif /* __cplusplus */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* JDWPTRANSPORT_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* @(#)jni_md.h 1.19 05/11/17
|
||||
*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JNI_MD_H_
|
||||
#define _JAVASOFT_JNI_MD_H_
|
||||
|
||||
#define JNIEXPORT __attribute__((visibility("default")))
|
||||
#define JNIIMPORT
|
||||
#define JNICALL
|
||||
|
||||
#if defined(__LP64__) && __LP64__ /* for -Wundef */
|
||||
typedef int jint;
|
||||
#else
|
||||
typedef long jint;
|
||||
#endif
|
||||
typedef long long jlong;
|
||||
typedef signed char jbyte;
|
||||
|
||||
#endif /* !_JAVASOFT_JNI_MD_H_ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,560 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CLASSFILE_CONSTANTS_H
|
||||
#define CLASSFILE_CONSTANTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Classfile version number for this information */
|
||||
#define JVM_CLASSFILE_MAJOR_VERSION 52
|
||||
#define JVM_CLASSFILE_MINOR_VERSION 0
|
||||
|
||||
/* Flags */
|
||||
|
||||
enum {
|
||||
JVM_ACC_PUBLIC = 0x0001,
|
||||
JVM_ACC_PRIVATE = 0x0002,
|
||||
JVM_ACC_PROTECTED = 0x0004,
|
||||
JVM_ACC_STATIC = 0x0008,
|
||||
JVM_ACC_FINAL = 0x0010,
|
||||
JVM_ACC_SYNCHRONIZED = 0x0020,
|
||||
JVM_ACC_SUPER = 0x0020,
|
||||
JVM_ACC_VOLATILE = 0x0040,
|
||||
JVM_ACC_BRIDGE = 0x0040,
|
||||
JVM_ACC_TRANSIENT = 0x0080,
|
||||
JVM_ACC_VARARGS = 0x0080,
|
||||
JVM_ACC_NATIVE = 0x0100,
|
||||
JVM_ACC_INTERFACE = 0x0200,
|
||||
JVM_ACC_ABSTRACT = 0x0400,
|
||||
JVM_ACC_STRICT = 0x0800,
|
||||
JVM_ACC_SYNTHETIC = 0x1000,
|
||||
JVM_ACC_ANNOTATION = 0x2000,
|
||||
JVM_ACC_ENUM = 0x4000
|
||||
};
|
||||
|
||||
/* Used in newarray instruction. */
|
||||
|
||||
enum {
|
||||
JVM_T_BOOLEAN = 4,
|
||||
JVM_T_CHAR = 5,
|
||||
JVM_T_FLOAT = 6,
|
||||
JVM_T_DOUBLE = 7,
|
||||
JVM_T_BYTE = 8,
|
||||
JVM_T_SHORT = 9,
|
||||
JVM_T_INT = 10,
|
||||
JVM_T_LONG = 11
|
||||
};
|
||||
|
||||
/* Constant Pool Entries */
|
||||
|
||||
enum {
|
||||
JVM_CONSTANT_Utf8 = 1,
|
||||
JVM_CONSTANT_Unicode = 2, /* unused */
|
||||
JVM_CONSTANT_Integer = 3,
|
||||
JVM_CONSTANT_Float = 4,
|
||||
JVM_CONSTANT_Long = 5,
|
||||
JVM_CONSTANT_Double = 6,
|
||||
JVM_CONSTANT_Class = 7,
|
||||
JVM_CONSTANT_String = 8,
|
||||
JVM_CONSTANT_Fieldref = 9,
|
||||
JVM_CONSTANT_Methodref = 10,
|
||||
JVM_CONSTANT_InterfaceMethodref = 11,
|
||||
JVM_CONSTANT_NameAndType = 12,
|
||||
JVM_CONSTANT_MethodHandle = 15, // JSR 292
|
||||
JVM_CONSTANT_MethodType = 16, // JSR 292
|
||||
JVM_CONSTANT_InvokeDynamic = 18
|
||||
};
|
||||
|
||||
/* JVM_CONSTANT_MethodHandle subtypes */
|
||||
enum {
|
||||
JVM_REF_getField = 1,
|
||||
JVM_REF_getStatic = 2,
|
||||
JVM_REF_putField = 3,
|
||||
JVM_REF_putStatic = 4,
|
||||
JVM_REF_invokeVirtual = 5,
|
||||
JVM_REF_invokeStatic = 6,
|
||||
JVM_REF_invokeSpecial = 7,
|
||||
JVM_REF_newInvokeSpecial = 8,
|
||||
JVM_REF_invokeInterface = 9
|
||||
};
|
||||
|
||||
/* StackMapTable type item numbers */
|
||||
|
||||
enum {
|
||||
JVM_ITEM_Top = 0,
|
||||
JVM_ITEM_Integer = 1,
|
||||
JVM_ITEM_Float = 2,
|
||||
JVM_ITEM_Double = 3,
|
||||
JVM_ITEM_Long = 4,
|
||||
JVM_ITEM_Null = 5,
|
||||
JVM_ITEM_UninitializedThis = 6,
|
||||
JVM_ITEM_Object = 7,
|
||||
JVM_ITEM_Uninitialized = 8
|
||||
};
|
||||
|
||||
/* Type signatures */
|
||||
|
||||
enum {
|
||||
JVM_SIGNATURE_ARRAY = '[',
|
||||
JVM_SIGNATURE_BYTE = 'B',
|
||||
JVM_SIGNATURE_CHAR = 'C',
|
||||
JVM_SIGNATURE_CLASS = 'L',
|
||||
JVM_SIGNATURE_ENDCLASS = ';',
|
||||
JVM_SIGNATURE_ENUM = 'E',
|
||||
JVM_SIGNATURE_FLOAT = 'F',
|
||||
JVM_SIGNATURE_DOUBLE = 'D',
|
||||
JVM_SIGNATURE_FUNC = '(',
|
||||
JVM_SIGNATURE_ENDFUNC = ')',
|
||||
JVM_SIGNATURE_INT = 'I',
|
||||
JVM_SIGNATURE_LONG = 'J',
|
||||
JVM_SIGNATURE_SHORT = 'S',
|
||||
JVM_SIGNATURE_VOID = 'V',
|
||||
JVM_SIGNATURE_BOOLEAN = 'Z'
|
||||
};
|
||||
|
||||
/* Opcodes */
|
||||
|
||||
enum {
|
||||
JVM_OPC_nop = 0,
|
||||
JVM_OPC_aconst_null = 1,
|
||||
JVM_OPC_iconst_m1 = 2,
|
||||
JVM_OPC_iconst_0 = 3,
|
||||
JVM_OPC_iconst_1 = 4,
|
||||
JVM_OPC_iconst_2 = 5,
|
||||
JVM_OPC_iconst_3 = 6,
|
||||
JVM_OPC_iconst_4 = 7,
|
||||
JVM_OPC_iconst_5 = 8,
|
||||
JVM_OPC_lconst_0 = 9,
|
||||
JVM_OPC_lconst_1 = 10,
|
||||
JVM_OPC_fconst_0 = 11,
|
||||
JVM_OPC_fconst_1 = 12,
|
||||
JVM_OPC_fconst_2 = 13,
|
||||
JVM_OPC_dconst_0 = 14,
|
||||
JVM_OPC_dconst_1 = 15,
|
||||
JVM_OPC_bipush = 16,
|
||||
JVM_OPC_sipush = 17,
|
||||
JVM_OPC_ldc = 18,
|
||||
JVM_OPC_ldc_w = 19,
|
||||
JVM_OPC_ldc2_w = 20,
|
||||
JVM_OPC_iload = 21,
|
||||
JVM_OPC_lload = 22,
|
||||
JVM_OPC_fload = 23,
|
||||
JVM_OPC_dload = 24,
|
||||
JVM_OPC_aload = 25,
|
||||
JVM_OPC_iload_0 = 26,
|
||||
JVM_OPC_iload_1 = 27,
|
||||
JVM_OPC_iload_2 = 28,
|
||||
JVM_OPC_iload_3 = 29,
|
||||
JVM_OPC_lload_0 = 30,
|
||||
JVM_OPC_lload_1 = 31,
|
||||
JVM_OPC_lload_2 = 32,
|
||||
JVM_OPC_lload_3 = 33,
|
||||
JVM_OPC_fload_0 = 34,
|
||||
JVM_OPC_fload_1 = 35,
|
||||
JVM_OPC_fload_2 = 36,
|
||||
JVM_OPC_fload_3 = 37,
|
||||
JVM_OPC_dload_0 = 38,
|
||||
JVM_OPC_dload_1 = 39,
|
||||
JVM_OPC_dload_2 = 40,
|
||||
JVM_OPC_dload_3 = 41,
|
||||
JVM_OPC_aload_0 = 42,
|
||||
JVM_OPC_aload_1 = 43,
|
||||
JVM_OPC_aload_2 = 44,
|
||||
JVM_OPC_aload_3 = 45,
|
||||
JVM_OPC_iaload = 46,
|
||||
JVM_OPC_laload = 47,
|
||||
JVM_OPC_faload = 48,
|
||||
JVM_OPC_daload = 49,
|
||||
JVM_OPC_aaload = 50,
|
||||
JVM_OPC_baload = 51,
|
||||
JVM_OPC_caload = 52,
|
||||
JVM_OPC_saload = 53,
|
||||
JVM_OPC_istore = 54,
|
||||
JVM_OPC_lstore = 55,
|
||||
JVM_OPC_fstore = 56,
|
||||
JVM_OPC_dstore = 57,
|
||||
JVM_OPC_astore = 58,
|
||||
JVM_OPC_istore_0 = 59,
|
||||
JVM_OPC_istore_1 = 60,
|
||||
JVM_OPC_istore_2 = 61,
|
||||
JVM_OPC_istore_3 = 62,
|
||||
JVM_OPC_lstore_0 = 63,
|
||||
JVM_OPC_lstore_1 = 64,
|
||||
JVM_OPC_lstore_2 = 65,
|
||||
JVM_OPC_lstore_3 = 66,
|
||||
JVM_OPC_fstore_0 = 67,
|
||||
JVM_OPC_fstore_1 = 68,
|
||||
JVM_OPC_fstore_2 = 69,
|
||||
JVM_OPC_fstore_3 = 70,
|
||||
JVM_OPC_dstore_0 = 71,
|
||||
JVM_OPC_dstore_1 = 72,
|
||||
JVM_OPC_dstore_2 = 73,
|
||||
JVM_OPC_dstore_3 = 74,
|
||||
JVM_OPC_astore_0 = 75,
|
||||
JVM_OPC_astore_1 = 76,
|
||||
JVM_OPC_astore_2 = 77,
|
||||
JVM_OPC_astore_3 = 78,
|
||||
JVM_OPC_iastore = 79,
|
||||
JVM_OPC_lastore = 80,
|
||||
JVM_OPC_fastore = 81,
|
||||
JVM_OPC_dastore = 82,
|
||||
JVM_OPC_aastore = 83,
|
||||
JVM_OPC_bastore = 84,
|
||||
JVM_OPC_castore = 85,
|
||||
JVM_OPC_sastore = 86,
|
||||
JVM_OPC_pop = 87,
|
||||
JVM_OPC_pop2 = 88,
|
||||
JVM_OPC_dup = 89,
|
||||
JVM_OPC_dup_x1 = 90,
|
||||
JVM_OPC_dup_x2 = 91,
|
||||
JVM_OPC_dup2 = 92,
|
||||
JVM_OPC_dup2_x1 = 93,
|
||||
JVM_OPC_dup2_x2 = 94,
|
||||
JVM_OPC_swap = 95,
|
||||
JVM_OPC_iadd = 96,
|
||||
JVM_OPC_ladd = 97,
|
||||
JVM_OPC_fadd = 98,
|
||||
JVM_OPC_dadd = 99,
|
||||
JVM_OPC_isub = 100,
|
||||
JVM_OPC_lsub = 101,
|
||||
JVM_OPC_fsub = 102,
|
||||
JVM_OPC_dsub = 103,
|
||||
JVM_OPC_imul = 104,
|
||||
JVM_OPC_lmul = 105,
|
||||
JVM_OPC_fmul = 106,
|
||||
JVM_OPC_dmul = 107,
|
||||
JVM_OPC_idiv = 108,
|
||||
JVM_OPC_ldiv = 109,
|
||||
JVM_OPC_fdiv = 110,
|
||||
JVM_OPC_ddiv = 111,
|
||||
JVM_OPC_irem = 112,
|
||||
JVM_OPC_lrem = 113,
|
||||
JVM_OPC_frem = 114,
|
||||
JVM_OPC_drem = 115,
|
||||
JVM_OPC_ineg = 116,
|
||||
JVM_OPC_lneg = 117,
|
||||
JVM_OPC_fneg = 118,
|
||||
JVM_OPC_dneg = 119,
|
||||
JVM_OPC_ishl = 120,
|
||||
JVM_OPC_lshl = 121,
|
||||
JVM_OPC_ishr = 122,
|
||||
JVM_OPC_lshr = 123,
|
||||
JVM_OPC_iushr = 124,
|
||||
JVM_OPC_lushr = 125,
|
||||
JVM_OPC_iand = 126,
|
||||
JVM_OPC_land = 127,
|
||||
JVM_OPC_ior = 128,
|
||||
JVM_OPC_lor = 129,
|
||||
JVM_OPC_ixor = 130,
|
||||
JVM_OPC_lxor = 131,
|
||||
JVM_OPC_iinc = 132,
|
||||
JVM_OPC_i2l = 133,
|
||||
JVM_OPC_i2f = 134,
|
||||
JVM_OPC_i2d = 135,
|
||||
JVM_OPC_l2i = 136,
|
||||
JVM_OPC_l2f = 137,
|
||||
JVM_OPC_l2d = 138,
|
||||
JVM_OPC_f2i = 139,
|
||||
JVM_OPC_f2l = 140,
|
||||
JVM_OPC_f2d = 141,
|
||||
JVM_OPC_d2i = 142,
|
||||
JVM_OPC_d2l = 143,
|
||||
JVM_OPC_d2f = 144,
|
||||
JVM_OPC_i2b = 145,
|
||||
JVM_OPC_i2c = 146,
|
||||
JVM_OPC_i2s = 147,
|
||||
JVM_OPC_lcmp = 148,
|
||||
JVM_OPC_fcmpl = 149,
|
||||
JVM_OPC_fcmpg = 150,
|
||||
JVM_OPC_dcmpl = 151,
|
||||
JVM_OPC_dcmpg = 152,
|
||||
JVM_OPC_ifeq = 153,
|
||||
JVM_OPC_ifne = 154,
|
||||
JVM_OPC_iflt = 155,
|
||||
JVM_OPC_ifge = 156,
|
||||
JVM_OPC_ifgt = 157,
|
||||
JVM_OPC_ifle = 158,
|
||||
JVM_OPC_if_icmpeq = 159,
|
||||
JVM_OPC_if_icmpne = 160,
|
||||
JVM_OPC_if_icmplt = 161,
|
||||
JVM_OPC_if_icmpge = 162,
|
||||
JVM_OPC_if_icmpgt = 163,
|
||||
JVM_OPC_if_icmple = 164,
|
||||
JVM_OPC_if_acmpeq = 165,
|
||||
JVM_OPC_if_acmpne = 166,
|
||||
JVM_OPC_goto = 167,
|
||||
JVM_OPC_jsr = 168,
|
||||
JVM_OPC_ret = 169,
|
||||
JVM_OPC_tableswitch = 170,
|
||||
JVM_OPC_lookupswitch = 171,
|
||||
JVM_OPC_ireturn = 172,
|
||||
JVM_OPC_lreturn = 173,
|
||||
JVM_OPC_freturn = 174,
|
||||
JVM_OPC_dreturn = 175,
|
||||
JVM_OPC_areturn = 176,
|
||||
JVM_OPC_return = 177,
|
||||
JVM_OPC_getstatic = 178,
|
||||
JVM_OPC_putstatic = 179,
|
||||
JVM_OPC_getfield = 180,
|
||||
JVM_OPC_putfield = 181,
|
||||
JVM_OPC_invokevirtual = 182,
|
||||
JVM_OPC_invokespecial = 183,
|
||||
JVM_OPC_invokestatic = 184,
|
||||
JVM_OPC_invokeinterface = 185,
|
||||
JVM_OPC_invokedynamic = 186,
|
||||
JVM_OPC_new = 187,
|
||||
JVM_OPC_newarray = 188,
|
||||
JVM_OPC_anewarray = 189,
|
||||
JVM_OPC_arraylength = 190,
|
||||
JVM_OPC_athrow = 191,
|
||||
JVM_OPC_checkcast = 192,
|
||||
JVM_OPC_instanceof = 193,
|
||||
JVM_OPC_monitorenter = 194,
|
||||
JVM_OPC_monitorexit = 195,
|
||||
JVM_OPC_wide = 196,
|
||||
JVM_OPC_multianewarray = 197,
|
||||
JVM_OPC_ifnull = 198,
|
||||
JVM_OPC_ifnonnull = 199,
|
||||
JVM_OPC_goto_w = 200,
|
||||
JVM_OPC_jsr_w = 201,
|
||||
JVM_OPC_MAX = 201
|
||||
};
|
||||
|
||||
/* Opcode length initializer, use with something like:
|
||||
* unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
|
||||
*/
|
||||
#define JVM_OPCODE_LENGTH_INITIALIZER { \
|
||||
1, /* nop */ \
|
||||
1, /* aconst_null */ \
|
||||
1, /* iconst_m1 */ \
|
||||
1, /* iconst_0 */ \
|
||||
1, /* iconst_1 */ \
|
||||
1, /* iconst_2 */ \
|
||||
1, /* iconst_3 */ \
|
||||
1, /* iconst_4 */ \
|
||||
1, /* iconst_5 */ \
|
||||
1, /* lconst_0 */ \
|
||||
1, /* lconst_1 */ \
|
||||
1, /* fconst_0 */ \
|
||||
1, /* fconst_1 */ \
|
||||
1, /* fconst_2 */ \
|
||||
1, /* dconst_0 */ \
|
||||
1, /* dconst_1 */ \
|
||||
2, /* bipush */ \
|
||||
3, /* sipush */ \
|
||||
2, /* ldc */ \
|
||||
3, /* ldc_w */ \
|
||||
3, /* ldc2_w */ \
|
||||
2, /* iload */ \
|
||||
2, /* lload */ \
|
||||
2, /* fload */ \
|
||||
2, /* dload */ \
|
||||
2, /* aload */ \
|
||||
1, /* iload_0 */ \
|
||||
1, /* iload_1 */ \
|
||||
1, /* iload_2 */ \
|
||||
1, /* iload_3 */ \
|
||||
1, /* lload_0 */ \
|
||||
1, /* lload_1 */ \
|
||||
1, /* lload_2 */ \
|
||||
1, /* lload_3 */ \
|
||||
1, /* fload_0 */ \
|
||||
1, /* fload_1 */ \
|
||||
1, /* fload_2 */ \
|
||||
1, /* fload_3 */ \
|
||||
1, /* dload_0 */ \
|
||||
1, /* dload_1 */ \
|
||||
1, /* dload_2 */ \
|
||||
1, /* dload_3 */ \
|
||||
1, /* aload_0 */ \
|
||||
1, /* aload_1 */ \
|
||||
1, /* aload_2 */ \
|
||||
1, /* aload_3 */ \
|
||||
1, /* iaload */ \
|
||||
1, /* laload */ \
|
||||
1, /* faload */ \
|
||||
1, /* daload */ \
|
||||
1, /* aaload */ \
|
||||
1, /* baload */ \
|
||||
1, /* caload */ \
|
||||
1, /* saload */ \
|
||||
2, /* istore */ \
|
||||
2, /* lstore */ \
|
||||
2, /* fstore */ \
|
||||
2, /* dstore */ \
|
||||
2, /* astore */ \
|
||||
1, /* istore_0 */ \
|
||||
1, /* istore_1 */ \
|
||||
1, /* istore_2 */ \
|
||||
1, /* istore_3 */ \
|
||||
1, /* lstore_0 */ \
|
||||
1, /* lstore_1 */ \
|
||||
1, /* lstore_2 */ \
|
||||
1, /* lstore_3 */ \
|
||||
1, /* fstore_0 */ \
|
||||
1, /* fstore_1 */ \
|
||||
1, /* fstore_2 */ \
|
||||
1, /* fstore_3 */ \
|
||||
1, /* dstore_0 */ \
|
||||
1, /* dstore_1 */ \
|
||||
1, /* dstore_2 */ \
|
||||
1, /* dstore_3 */ \
|
||||
1, /* astore_0 */ \
|
||||
1, /* astore_1 */ \
|
||||
1, /* astore_2 */ \
|
||||
1, /* astore_3 */ \
|
||||
1, /* iastore */ \
|
||||
1, /* lastore */ \
|
||||
1, /* fastore */ \
|
||||
1, /* dastore */ \
|
||||
1, /* aastore */ \
|
||||
1, /* bastore */ \
|
||||
1, /* castore */ \
|
||||
1, /* sastore */ \
|
||||
1, /* pop */ \
|
||||
1, /* pop2 */ \
|
||||
1, /* dup */ \
|
||||
1, /* dup_x1 */ \
|
||||
1, /* dup_x2 */ \
|
||||
1, /* dup2 */ \
|
||||
1, /* dup2_x1 */ \
|
||||
1, /* dup2_x2 */ \
|
||||
1, /* swap */ \
|
||||
1, /* iadd */ \
|
||||
1, /* ladd */ \
|
||||
1, /* fadd */ \
|
||||
1, /* dadd */ \
|
||||
1, /* isub */ \
|
||||
1, /* lsub */ \
|
||||
1, /* fsub */ \
|
||||
1, /* dsub */ \
|
||||
1, /* imul */ \
|
||||
1, /* lmul */ \
|
||||
1, /* fmul */ \
|
||||
1, /* dmul */ \
|
||||
1, /* idiv */ \
|
||||
1, /* ldiv */ \
|
||||
1, /* fdiv */ \
|
||||
1, /* ddiv */ \
|
||||
1, /* irem */ \
|
||||
1, /* lrem */ \
|
||||
1, /* frem */ \
|
||||
1, /* drem */ \
|
||||
1, /* ineg */ \
|
||||
1, /* lneg */ \
|
||||
1, /* fneg */ \
|
||||
1, /* dneg */ \
|
||||
1, /* ishl */ \
|
||||
1, /* lshl */ \
|
||||
1, /* ishr */ \
|
||||
1, /* lshr */ \
|
||||
1, /* iushr */ \
|
||||
1, /* lushr */ \
|
||||
1, /* iand */ \
|
||||
1, /* land */ \
|
||||
1, /* ior */ \
|
||||
1, /* lor */ \
|
||||
1, /* ixor */ \
|
||||
1, /* lxor */ \
|
||||
3, /* iinc */ \
|
||||
1, /* i2l */ \
|
||||
1, /* i2f */ \
|
||||
1, /* i2d */ \
|
||||
1, /* l2i */ \
|
||||
1, /* l2f */ \
|
||||
1, /* l2d */ \
|
||||
1, /* f2i */ \
|
||||
1, /* f2l */ \
|
||||
1, /* f2d */ \
|
||||
1, /* d2i */ \
|
||||
1, /* d2l */ \
|
||||
1, /* d2f */ \
|
||||
1, /* i2b */ \
|
||||
1, /* i2c */ \
|
||||
1, /* i2s */ \
|
||||
1, /* lcmp */ \
|
||||
1, /* fcmpl */ \
|
||||
1, /* fcmpg */ \
|
||||
1, /* dcmpl */ \
|
||||
1, /* dcmpg */ \
|
||||
3, /* ifeq */ \
|
||||
3, /* ifne */ \
|
||||
3, /* iflt */ \
|
||||
3, /* ifge */ \
|
||||
3, /* ifgt */ \
|
||||
3, /* ifle */ \
|
||||
3, /* if_icmpeq */ \
|
||||
3, /* if_icmpne */ \
|
||||
3, /* if_icmplt */ \
|
||||
3, /* if_icmpge */ \
|
||||
3, /* if_icmpgt */ \
|
||||
3, /* if_icmple */ \
|
||||
3, /* if_acmpeq */ \
|
||||
3, /* if_acmpne */ \
|
||||
3, /* goto */ \
|
||||
3, /* jsr */ \
|
||||
2, /* ret */ \
|
||||
99, /* tableswitch */ \
|
||||
99, /* lookupswitch */ \
|
||||
1, /* ireturn */ \
|
||||
1, /* lreturn */ \
|
||||
1, /* freturn */ \
|
||||
1, /* dreturn */ \
|
||||
1, /* areturn */ \
|
||||
1, /* return */ \
|
||||
3, /* getstatic */ \
|
||||
3, /* putstatic */ \
|
||||
3, /* getfield */ \
|
||||
3, /* putfield */ \
|
||||
3, /* invokevirtual */ \
|
||||
3, /* invokespecial */ \
|
||||
3, /* invokestatic */ \
|
||||
5, /* invokeinterface */ \
|
||||
5, /* invokedynamic */ \
|
||||
3, /* new */ \
|
||||
2, /* newarray */ \
|
||||
3, /* anewarray */ \
|
||||
1, /* arraylength */ \
|
||||
1, /* athrow */ \
|
||||
3, /* checkcast */ \
|
||||
3, /* instanceof */ \
|
||||
1, /* monitorenter */ \
|
||||
1, /* monitorexit */ \
|
||||
0, /* wide */ \
|
||||
4, /* multianewarray */ \
|
||||
3, /* ifnull */ \
|
||||
3, /* ifnonnull */ \
|
||||
5, /* goto_w */ \
|
||||
5 /* jsr_w */ \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* CLASSFILE_CONSTANTS */
|
|
@ -0,0 +1,299 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JAWT_H_
|
||||
#define _JAVASOFT_JAWT_H_
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* AWT native interface (new in JDK 1.3)
|
||||
*
|
||||
* The AWT native interface allows a native C or C++ application a means
|
||||
* by which to access native structures in AWT. This is to facilitate moving
|
||||
* legacy C and C++ applications to Java and to target the needs of the
|
||||
* community who, at present, wish to do their own native rendering to canvases
|
||||
* for performance reasons. Standard extensions such as Java3D also require a
|
||||
* means to access the underlying native data structures of AWT.
|
||||
*
|
||||
* There may be future extensions to this API depending on demand.
|
||||
*
|
||||
* A VM does not have to implement this API in order to pass the JCK.
|
||||
* It is recommended, however, that this API is implemented on VMs that support
|
||||
* standard extensions, such as Java3D.
|
||||
*
|
||||
* Since this is a native API, any program which uses it cannot be considered
|
||||
* 100% pure java.
|
||||
*/
|
||||
|
||||
/*
|
||||
* AWT Native Drawing Surface (JAWT_DrawingSurface).
|
||||
*
|
||||
* For each platform, there is a native drawing surface structure. This
|
||||
* platform-specific structure can be found in jawt_md.h. It is recommended
|
||||
* that additional platforms follow the same model. It is also recommended
|
||||
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
|
||||
*
|
||||
*******************
|
||||
* EXAMPLE OF USAGE:
|
||||
*******************
|
||||
*
|
||||
* In Win32, a programmer wishes to access the HWND of a canvas to perform
|
||||
* native rendering into it. The programmer has declared the paint() method
|
||||
* for their canvas subclass to be native:
|
||||
*
|
||||
*
|
||||
* MyCanvas.java:
|
||||
*
|
||||
* import java.awt.*;
|
||||
*
|
||||
* public class MyCanvas extends Canvas {
|
||||
*
|
||||
* static {
|
||||
* System.loadLibrary("mylib");
|
||||
* }
|
||||
*
|
||||
* public native void paint(Graphics g);
|
||||
* }
|
||||
*
|
||||
*
|
||||
* myfile.c:
|
||||
*
|
||||
* #include "jawt_md.h"
|
||||
* #include <assert.h>
|
||||
*
|
||||
* JNIEXPORT void JNICALL
|
||||
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
|
||||
* {
|
||||
* JAWT awt;
|
||||
* JAWT_DrawingSurface* ds;
|
||||
* JAWT_DrawingSurfaceInfo* dsi;
|
||||
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
|
||||
* jboolean result;
|
||||
* jint lock;
|
||||
*
|
||||
* // Get the AWT
|
||||
* awt.version = JAWT_VERSION_1_3;
|
||||
* result = JAWT_GetAWT(env, &awt);
|
||||
* assert(result != JNI_FALSE);
|
||||
*
|
||||
* // Get the drawing surface
|
||||
* ds = awt.GetDrawingSurface(env, canvas);
|
||||
* assert(ds != NULL);
|
||||
*
|
||||
* // Lock the drawing surface
|
||||
* lock = ds->Lock(ds);
|
||||
* assert((lock & JAWT_LOCK_ERROR) == 0);
|
||||
*
|
||||
* // Get the drawing surface info
|
||||
* dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||
*
|
||||
* // Get the platform-specific drawing info
|
||||
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
|
||||
*
|
||||
* //////////////////////////////
|
||||
* // !!! DO PAINTING HERE !!! //
|
||||
* //////////////////////////////
|
||||
*
|
||||
* // Free the drawing surface info
|
||||
* ds->FreeDrawingSurfaceInfo(dsi);
|
||||
*
|
||||
* // Unlock the drawing surface
|
||||
* ds->Unlock(ds);
|
||||
*
|
||||
* // Free the drawing surface
|
||||
* awt.FreeDrawingSurface(ds);
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* JAWT_Rectangle
|
||||
* Structure for a native rectangle.
|
||||
*/
|
||||
typedef struct jawt_Rectangle {
|
||||
jint x;
|
||||
jint y;
|
||||
jint width;
|
||||
jint height;
|
||||
} JAWT_Rectangle;
|
||||
|
||||
struct jawt_DrawingSurface;
|
||||
|
||||
/*
|
||||
* JAWT_DrawingSurfaceInfo
|
||||
* Structure for containing the underlying drawing information of a component.
|
||||
*/
|
||||
typedef struct jawt_DrawingSurfaceInfo {
|
||||
/*
|
||||
* Pointer to the platform-specific information. This can be safely
|
||||
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
|
||||
* JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a
|
||||
* pointer to a NSObject that conforms to the JAWT_SurfaceLayers
|
||||
* protocol. See jawt_md.h for details.
|
||||
*/
|
||||
void* platformInfo;
|
||||
/* Cached pointer to the underlying drawing surface */
|
||||
struct jawt_DrawingSurface* ds;
|
||||
/* Bounding rectangle of the drawing surface */
|
||||
JAWT_Rectangle bounds;
|
||||
/* Number of rectangles in the clip */
|
||||
jint clipSize;
|
||||
/* Clip rectangle array */
|
||||
JAWT_Rectangle* clip;
|
||||
} JAWT_DrawingSurfaceInfo;
|
||||
|
||||
#define JAWT_LOCK_ERROR 0x00000001
|
||||
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
|
||||
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
|
||||
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
|
||||
|
||||
/*
|
||||
* JAWT_DrawingSurface
|
||||
* Structure for containing the underlying drawing information of a component.
|
||||
* All operations on a JAWT_DrawingSurface MUST be performed from the same
|
||||
* thread as the call to GetDrawingSurface.
|
||||
*/
|
||||
typedef struct jawt_DrawingSurface {
|
||||
/*
|
||||
* Cached reference to the Java environment of the calling thread.
|
||||
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
|
||||
* FreeDrawingSurfaceInfo() are called from a different thread,
|
||||
* this data member should be set before calling those functions.
|
||||
*/
|
||||
JNIEnv* env;
|
||||
/* Cached reference to the target object */
|
||||
jobject target;
|
||||
/*
|
||||
* Lock the surface of the target component for native rendering.
|
||||
* When finished drawing, the surface must be unlocked with
|
||||
* Unlock(). This function returns a bitmask with one or more of the
|
||||
* following values:
|
||||
*
|
||||
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
|
||||
* be locked.
|
||||
*
|
||||
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
|
||||
*
|
||||
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
|
||||
*
|
||||
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
|
||||
*/
|
||||
jint (JNICALL *Lock)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
/*
|
||||
* Get the drawing surface info.
|
||||
* The value returned may be cached, but the values may change if
|
||||
* additional calls to Lock() or Unlock() are made.
|
||||
* Lock() must be called before this can return a valid value.
|
||||
* Returns NULL if an error has occurred.
|
||||
* When finished with the returned value, FreeDrawingSurfaceInfo must be
|
||||
* called.
|
||||
*/
|
||||
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
/*
|
||||
* Free the drawing surface info.
|
||||
*/
|
||||
void (JNICALL *FreeDrawingSurfaceInfo)
|
||||
(JAWT_DrawingSurfaceInfo* dsi);
|
||||
/*
|
||||
* Unlock the drawing surface of the target component for native rendering.
|
||||
*/
|
||||
void (JNICALL *Unlock)
|
||||
(struct jawt_DrawingSurface* ds);
|
||||
} JAWT_DrawingSurface;
|
||||
|
||||
/*
|
||||
* JAWT
|
||||
* Structure for containing native AWT functions.
|
||||
*/
|
||||
typedef struct jawt {
|
||||
/*
|
||||
* Version of this structure. This must always be set before
|
||||
* calling JAWT_GetAWT()
|
||||
*/
|
||||
jint version;
|
||||
/*
|
||||
* Return a drawing surface from a target jobject. This value
|
||||
* may be cached.
|
||||
* Returns NULL if an error has occurred.
|
||||
* Target must be a java.awt.Component (should be a Canvas
|
||||
* or Window for native rendering).
|
||||
* FreeDrawingSurface() must be called when finished with the
|
||||
* returned JAWT_DrawingSurface.
|
||||
*/
|
||||
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
|
||||
(JNIEnv* env, jobject target);
|
||||
/*
|
||||
* Free the drawing surface allocated in GetDrawingSurface.
|
||||
*/
|
||||
void (JNICALL *FreeDrawingSurface)
|
||||
(JAWT_DrawingSurface* ds);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Locks the entire AWT for synchronization purposes
|
||||
*/
|
||||
void (JNICALL *Lock)(JNIEnv* env);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Unlocks the entire AWT for synchronization purposes
|
||||
*/
|
||||
void (JNICALL *Unlock)(JNIEnv* env);
|
||||
/*
|
||||
* Since 1.4
|
||||
* Returns a reference to a java.awt.Component from a native
|
||||
* platform handle. On Windows, this corresponds to an HWND;
|
||||
* on Solaris and Linux, this is a Drawable. For other platforms,
|
||||
* see the appropriate machine-dependent header file for a description.
|
||||
* The reference returned by this function is a local
|
||||
* reference that is only valid in this environment.
|
||||
* This function returns a NULL reference if no component could be
|
||||
* found with matching platform information.
|
||||
*/
|
||||
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
|
||||
|
||||
} JAWT;
|
||||
|
||||
/*
|
||||
* Get the AWT native structure. This function returns JNI_FALSE if
|
||||
* an error occurs.
|
||||
*/
|
||||
_JNI_IMPORT_OR_EXPORT_
|
||||
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
|
||||
|
||||
#define JAWT_VERSION_1_3 0x00010003
|
||||
#define JAWT_VERSION_1_4 0x00010004
|
||||
#define JAWT_VERSION_1_7 0x00010007
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* !_JAVASOFT_JAWT_H_ */
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Java Debug Wire Protocol Transport Service Provider Interface.
|
||||
*/
|
||||
|
||||
#ifndef JDWPTRANSPORT_H
|
||||
#define JDWPTRANSPORT_H
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
enum {
|
||||
JDWPTRANSPORT_VERSION_1_0 = 0x00010000
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct jdwpTransportNativeInterface_;
|
||||
|
||||
struct _jdwpTransportEnv;
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef _jdwpTransportEnv jdwpTransportEnv;
|
||||
#else
|
||||
typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Errors. Universal errors with JVMTI/JVMDI equivalents keep the
|
||||
* values the same.
|
||||
*/
|
||||
typedef enum {
|
||||
JDWPTRANSPORT_ERROR_NONE = 0,
|
||||
JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
|
||||
JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
|
||||
JDWPTRANSPORT_ERROR_INTERNAL = 113,
|
||||
JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
|
||||
JDWPTRANSPORT_ERROR_IO_ERROR = 202,
|
||||
JDWPTRANSPORT_ERROR_TIMEOUT = 203,
|
||||
JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
|
||||
} jdwpTransportError;
|
||||
|
||||
|
||||
/*
|
||||
* Structure to define capabilities
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int can_timeout_attach :1;
|
||||
unsigned int can_timeout_accept :1;
|
||||
unsigned int can_timeout_handshake :1;
|
||||
unsigned int reserved3 :1;
|
||||
unsigned int reserved4 :1;
|
||||
unsigned int reserved5 :1;
|
||||
unsigned int reserved6 :1;
|
||||
unsigned int reserved7 :1;
|
||||
unsigned int reserved8 :1;
|
||||
unsigned int reserved9 :1;
|
||||
unsigned int reserved10 :1;
|
||||
unsigned int reserved11 :1;
|
||||
unsigned int reserved12 :1;
|
||||
unsigned int reserved13 :1;
|
||||
unsigned int reserved14 :1;
|
||||
unsigned int reserved15 :1;
|
||||
} JDWPTransportCapabilities;
|
||||
|
||||
|
||||
/*
|
||||
* Structures to define packet layout.
|
||||
*
|
||||
* See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
|
||||
*/
|
||||
|
||||
enum {
|
||||
/*
|
||||
* If additional flags are added that apply to jdwpCmdPacket,
|
||||
* then debugLoop.c: reader() will need to be updated to
|
||||
* accept more than JDWPTRANSPORT_FLAGS_NONE.
|
||||
*/
|
||||
JDWPTRANSPORT_FLAGS_NONE = 0x0,
|
||||
JDWPTRANSPORT_FLAGS_REPLY = 0x80
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
jint len;
|
||||
jint id;
|
||||
jbyte flags;
|
||||
jbyte cmdSet;
|
||||
jbyte cmd;
|
||||
jbyte *data;
|
||||
} jdwpCmdPacket;
|
||||
|
||||
typedef struct {
|
||||
jint len;
|
||||
jint id;
|
||||
jbyte flags;
|
||||
jshort errorCode;
|
||||
jbyte *data;
|
||||
} jdwpReplyPacket;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
jdwpCmdPacket cmd;
|
||||
jdwpReplyPacket reply;
|
||||
} type;
|
||||
} jdwpPacket;
|
||||
|
||||
/*
|
||||
* JDWP functions called by the transport.
|
||||
*/
|
||||
typedef struct jdwpTransportCallback {
|
||||
void *(*alloc)(jint numBytes); /* Call this for all allocations */
|
||||
void (*free)(void *buffer); /* Call this for all deallocations */
|
||||
} jdwpTransportCallback;
|
||||
|
||||
typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
|
||||
jdwpTransportCallback *callback,
|
||||
jint version,
|
||||
jdwpTransportEnv** env);
|
||||
|
||||
|
||||
|
||||
/* Function Interface */
|
||||
|
||||
struct jdwpTransportNativeInterface_ {
|
||||
/* 1 : RESERVED */
|
||||
void *reserved1;
|
||||
|
||||
/* 2 : Get Capabilities */
|
||||
jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
|
||||
JDWPTransportCapabilities *capabilities_ptr);
|
||||
|
||||
/* 3 : Attach */
|
||||
jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
|
||||
const char* address,
|
||||
jlong attach_timeout,
|
||||
jlong handshake_timeout);
|
||||
|
||||
/* 4: StartListening */
|
||||
jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
|
||||
const char* address,
|
||||
char** actual_address);
|
||||
|
||||
/* 5: StopListening */
|
||||
jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
|
||||
|
||||
/* 6: Accept */
|
||||
jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
|
||||
jlong accept_timeout,
|
||||
jlong handshake_timeout);
|
||||
|
||||
/* 7: IsOpen */
|
||||
jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
|
||||
|
||||
/* 8: Close */
|
||||
jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
|
||||
|
||||
/* 9: ReadPacket */
|
||||
jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
|
||||
jdwpPacket *pkt);
|
||||
|
||||
/* 10: Write Packet */
|
||||
jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
|
||||
const jdwpPacket* pkt);
|
||||
|
||||
/* 11: GetLastError */
|
||||
jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
|
||||
char** error);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Use inlined functions so that C++ code can use syntax such as
|
||||
* env->Attach("mymachine:5000", 10*1000, 0);
|
||||
*
|
||||
* rather than using C's :-
|
||||
*
|
||||
* (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
|
||||
*/
|
||||
struct _jdwpTransportEnv {
|
||||
const struct jdwpTransportNativeInterface_ *functions;
|
||||
#ifdef __cplusplus
|
||||
|
||||
jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
|
||||
return functions->GetCapabilities(this, capabilities_ptr);
|
||||
}
|
||||
|
||||
jdwpTransportError Attach(const char* address, jlong attach_timeout,
|
||||
jlong handshake_timeout) {
|
||||
return functions->Attach(this, address, attach_timeout, handshake_timeout);
|
||||
}
|
||||
|
||||
jdwpTransportError StartListening(const char* address,
|
||||
char** actual_address) {
|
||||
return functions->StartListening(this, address, actual_address);
|
||||
}
|
||||
|
||||
jdwpTransportError StopListening(void) {
|
||||
return functions->StopListening(this);
|
||||
}
|
||||
|
||||
jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
|
||||
return functions->Accept(this, accept_timeout, handshake_timeout);
|
||||
}
|
||||
|
||||
jboolean IsOpen(void) {
|
||||
return functions->IsOpen(this);
|
||||
}
|
||||
|
||||
jdwpTransportError Close(void) {
|
||||
return functions->Close(this);
|
||||
}
|
||||
|
||||
jdwpTransportError ReadPacket(jdwpPacket *pkt) {
|
||||
return functions->ReadPacket(this, pkt);
|
||||
}
|
||||
|
||||
jdwpTransportError WritePacket(const jdwpPacket* pkt) {
|
||||
return functions->WritePacket(this, pkt);
|
||||
}
|
||||
|
||||
jdwpTransportError GetLastError(char** error) {
|
||||
return functions->GetLastError(this, error);
|
||||
}
|
||||
|
||||
|
||||
#endif /* __cplusplus */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* JDWPTRANSPORT_H */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header file defines the data structures sent by the VM
|
||||
* through the JVMTI CompiledMethodLoad callback function via the
|
||||
* "void * compile_info" parameter. The memory pointed to by the
|
||||
* compile_info parameter may not be referenced after returning from
|
||||
* the CompiledMethodLoad callback. These are VM implementation
|
||||
* specific data structures that may evolve in future releases. A
|
||||
* JVMTI agent should interpret a non-NULL compile_info as a pointer
|
||||
* to a region of memory containing a list of records. In a typical
|
||||
* usage scenario, a JVMTI agent would cast each record to a
|
||||
* jvmtiCompiledMethodLoadRecordHeader, a struct that represents
|
||||
* arbitrary information. This struct contains a kind field to indicate
|
||||
* the kind of information being passed, and a pointer to the next
|
||||
* record. If the kind field indicates inlining information, then the
|
||||
* agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord.
|
||||
* This record contains an array of PCStackInfo structs, which indicate
|
||||
* for every pc address what are the methods on the invocation stack.
|
||||
* The "methods" and "bcis" fields in each PCStackInfo struct specify a
|
||||
* 1-1 mapping between these inlined methods and their bytecode indices.
|
||||
* This can be used to derive the proper source lines of the inlined
|
||||
* methods.
|
||||
*/
|
||||
|
||||
#ifndef _JVMTI_CMLR_H_
|
||||
#define _JVMTI_CMLR_H_
|
||||
|
||||
enum {
|
||||
JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001,
|
||||
JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000,
|
||||
|
||||
JVMTI_CMLR_MAJOR_VERSION = 0x00000001,
|
||||
JVMTI_CMLR_MINOR_VERSION = 0x00000000
|
||||
|
||||
/*
|
||||
* This comment is for the "JDK import from HotSpot" sanity check:
|
||||
* version: 1.0.0
|
||||
*/
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
JVMTI_CMLR_DUMMY = 1,
|
||||
JVMTI_CMLR_INLINE_INFO = 2
|
||||
} jvmtiCMLRKind;
|
||||
|
||||
/*
|
||||
* Record that represents arbitrary information passed through JVMTI
|
||||
* CompiledMethodLoadEvent void pointer.
|
||||
*/
|
||||
typedef struct _jvmtiCompiledMethodLoadRecordHeader {
|
||||
jvmtiCMLRKind kind; /* id for the kind of info passed in the record */
|
||||
jint majorinfoversion; /* major and minor info version values. Init'ed */
|
||||
jint minorinfoversion; /* to current version value in jvmtiExport.cpp. */
|
||||
|
||||
struct _jvmtiCompiledMethodLoadRecordHeader* next;
|
||||
} jvmtiCompiledMethodLoadRecordHeader;
|
||||
|
||||
/*
|
||||
* Record that gives information about the methods on the compile-time
|
||||
* stack at a specific pc address of a compiled method. Each element in
|
||||
* the methods array maps to same element in the bcis array.
|
||||
*/
|
||||
typedef struct _PCStackInfo {
|
||||
void* pc; /* the pc address for this compiled method */
|
||||
jint numstackframes; /* number of methods on the stack */
|
||||
jmethodID* methods; /* array of numstackframes method ids */
|
||||
jint* bcis; /* array of numstackframes bytecode indices */
|
||||
} PCStackInfo;
|
||||
|
||||
/*
|
||||
* Record that contains inlining information for each pc address of
|
||||
* an nmethod.
|
||||
*/
|
||||
typedef struct _jvmtiCompiledMethodLoadInlineRecord {
|
||||
jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
|
||||
jint numpcs; /* number of pc descriptors in this nmethod */
|
||||
PCStackInfo* pcinfo; /* array of numpcs pc descriptors */
|
||||
} jvmtiCompiledMethodLoadInlineRecord;
|
||||
|
||||
/*
|
||||
* Dummy record used to test that we can pass records with different
|
||||
* information through the void pointer provided that they can be cast
|
||||
* to a jvmtiCompiledMethodLoadRecordHeader.
|
||||
*/
|
||||
|
||||
typedef struct _jvmtiCompiledMethodLoadDummyRecord {
|
||||
jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
|
||||
char message[50];
|
||||
} jvmtiCompiledMethodLoadDummyRecord;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* AccessBridgeCallbacks.h 1.17 05/03/21
|
||||
*/
|
||||
|
||||
/*
|
||||
* Header file defining callback typedefs for Windows routines
|
||||
* which are called from Java (responding to events, etc.).
|
||||
*/
|
||||
|
||||
#ifndef __AccessBridgeCallbacks_H__
|
||||
#define __AccessBridgeCallbacks_H__
|
||||
|
||||
#include <jni.h>
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*AccessBridge_PropertyChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *property, wchar_t *oldValue, wchar_t *newValue);
|
||||
|
||||
typedef void (*AccessBridge_JavaShutdownFP) (long vmID);
|
||||
typedef void (*AccessBridge_JavaShutdownFP) (long vmID);
|
||||
|
||||
typedef void (*AccessBridge_FocusGainedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_FocusLostFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_CaretUpdateFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_MouseClickedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MouseEnteredFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MouseExitedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MousePressedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MouseReleasedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_MenuCanceledFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MenuDeselectedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_MenuSelectedFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PopupMenuCanceledFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PopupMenuWillBecomeInvisibleFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PopupMenuWillBecomeVisibleFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
|
||||
typedef void (*AccessBridge_PropertyNameChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldName, wchar_t *newName);
|
||||
typedef void (*AccessBridge_PropertyDescriptionChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldDescription, wchar_t *newDescription);
|
||||
typedef void (*AccessBridge_PropertyStateChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldState, wchar_t *newState);
|
||||
typedef void (*AccessBridge_PropertyValueChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
wchar_t *oldValue, wchar_t *newValue);
|
||||
typedef void (*AccessBridge_PropertySelectionChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PropertyTextChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PropertyCaretChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
int oldPosition, int newPosition);
|
||||
typedef void (*AccessBridge_PropertyVisibleDataChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source);
|
||||
typedef void (*AccessBridge_PropertyChildChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 source,
|
||||
JOBJECT64 oldChild, JOBJECT64 newChild);
|
||||
typedef void (*AccessBridge_PropertyActiveDescendentChangeFP) (long vmID, JOBJECT64 event,
|
||||
JOBJECT64 source,
|
||||
JOBJECT64 oldActiveDescendent,
|
||||
JOBJECT64 newActiveDescendent);
|
||||
|
||||
typedef void (*AccessBridge_PropertyTableModelChangeFP) (long vmID, JOBJECT64 event, JOBJECT64 src,
|
||||
wchar_t *oldValue, wchar_t *newValue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,706 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Wrapper functions around calls to the AccessBridge DLL
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <jni.h>
|
||||
#include "AccessBridgeCallbacks.h"
|
||||
#include "AccessBridgePackages.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define null NULL
|
||||
|
||||
typedef JOBJECT64 AccessibleContext;
|
||||
typedef JOBJECT64 AccessibleText;
|
||||
typedef JOBJECT64 AccessibleValue;
|
||||
typedef JOBJECT64 AccessibleSelection;
|
||||
typedef JOBJECT64 Java_Object;
|
||||
typedef JOBJECT64 PropertyChangeEvent;
|
||||
typedef JOBJECT64 FocusEvent;
|
||||
typedef JOBJECT64 CaretEvent;
|
||||
typedef JOBJECT64 MouseEvent;
|
||||
typedef JOBJECT64 MenuEvent;
|
||||
typedef JOBJECT64 AccessibleTable;
|
||||
typedef JOBJECT64 AccessibleHyperlink;
|
||||
typedef JOBJECT64 AccessibleHypertext;
|
||||
|
||||
|
||||
typedef void (*Windows_runFP) ();
|
||||
|
||||
typedef void (*SetPropertyChangeFP) (AccessBridge_PropertyChangeFP fp);
|
||||
|
||||
typedef void (*SetJavaShutdownFP) (AccessBridge_JavaShutdownFP fp);
|
||||
typedef void (*SetFocusGainedFP) (AccessBridge_FocusGainedFP fp);
|
||||
typedef void (*SetFocusLostFP) (AccessBridge_FocusLostFP fp);
|
||||
|
||||
typedef void (*SetCaretUpdateFP) (AccessBridge_CaretUpdateFP fp);
|
||||
|
||||
typedef void (*SetMouseClickedFP) (AccessBridge_MouseClickedFP fp);
|
||||
typedef void (*SetMouseEnteredFP) (AccessBridge_MouseEnteredFP fp);
|
||||
typedef void (*SetMouseExitedFP) (AccessBridge_MouseExitedFP fp);
|
||||
typedef void (*SetMousePressedFP) (AccessBridge_MousePressedFP fp);
|
||||
typedef void (*SetMouseReleasedFP) (AccessBridge_MouseReleasedFP fp);
|
||||
|
||||
typedef void (*SetMenuCanceledFP) (AccessBridge_MenuCanceledFP fp);
|
||||
typedef void (*SetMenuDeselectedFP) (AccessBridge_MenuDeselectedFP fp);
|
||||
typedef void (*SetMenuSelectedFP) (AccessBridge_MenuSelectedFP fp);
|
||||
typedef void (*SetPopupMenuCanceledFP) (AccessBridge_PopupMenuCanceledFP fp);
|
||||
typedef void (*SetPopupMenuWillBecomeInvisibleFP) (AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||
typedef void (*SetPopupMenuWillBecomeVisibleFP) (AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||
|
||||
typedef void (*SetPropertyNameChangeFP) (AccessBridge_PropertyNameChangeFP fp);
|
||||
typedef void (*SetPropertyDescriptionChangeFP) (AccessBridge_PropertyDescriptionChangeFP fp);
|
||||
typedef void (*SetPropertyStateChangeFP) (AccessBridge_PropertyStateChangeFP fp);
|
||||
typedef void (*SetPropertyValueChangeFP) (AccessBridge_PropertyValueChangeFP fp);
|
||||
typedef void (*SetPropertySelectionChangeFP) (AccessBridge_PropertySelectionChangeFP fp);
|
||||
typedef void (*SetPropertyTextChangeFP) (AccessBridge_PropertyTextChangeFP fp);
|
||||
typedef void (*SetPropertyCaretChangeFP) (AccessBridge_PropertyCaretChangeFP fp);
|
||||
typedef void (*SetPropertyVisibleDataChangeFP) (AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||
typedef void (*SetPropertyChildChangeFP) (AccessBridge_PropertyChildChangeFP fp);
|
||||
typedef void (*SetPropertyActiveDescendentChangeFP) (AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||
|
||||
typedef void (*SetPropertyTableModelChangeFP) (AccessBridge_PropertyTableModelChangeFP fp);
|
||||
|
||||
typedef void (*ReleaseJavaObjectFP) (long vmID, Java_Object object);
|
||||
|
||||
typedef BOOL (*GetVersionInfoFP) (long vmID, AccessBridgeVersionInfo *info);
|
||||
|
||||
typedef BOOL (*IsJavaWindowFP) (HWND window);
|
||||
typedef BOOL (*IsSameObjectFP) (long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||
typedef BOOL (*GetAccessibleContextFromHWNDFP) (HWND window, long *vmID, AccessibleContext *ac);
|
||||
typedef HWND (*getHWNDFromAccessibleContextFP) (long vmID, AccessibleContext ac);
|
||||
|
||||
typedef BOOL (*GetAccessibleContextAtFP) (long vmID, AccessibleContext acParent,
|
||||
jint x, jint y, AccessibleContext *ac);
|
||||
typedef BOOL (*GetAccessibleContextWithFocusFP) (HWND window, long *vmID, AccessibleContext *ac);
|
||||
typedef BOOL (*GetAccessibleContextInfoFP) (long vmID, AccessibleContext ac, AccessibleContextInfo *info);
|
||||
typedef AccessibleContext (*GetAccessibleChildFromContextFP) (long vmID, AccessibleContext ac, jint i);
|
||||
typedef AccessibleContext (*GetAccessibleParentFromContextFP) (long vmID, AccessibleContext ac);
|
||||
|
||||
/* begin AccessibleTable */
|
||||
typedef BOOL (*getAccessibleTableInfoFP) (long vmID, AccessibleContext ac, AccessibleTableInfo *tableInfo);
|
||||
typedef BOOL (*getAccessibleTableCellInfoFP) (long vmID, AccessibleTable accessibleTable,
|
||||
jint row, jint column, AccessibleTableCellInfo *tableCellInfo);
|
||||
|
||||
typedef BOOL (*getAccessibleTableRowHeaderFP) (long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
typedef BOOL (*getAccessibleTableColumnHeaderFP) (long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
typedef AccessibleContext (*getAccessibleTableRowDescriptionFP) (long vmID, AccessibleContext acParent, jint row);
|
||||
typedef AccessibleContext (*getAccessibleTableColumnDescriptionFP) (long vmID, AccessibleContext acParent, jint column);
|
||||
|
||||
typedef jint (*getAccessibleTableRowSelectionCountFP) (long vmID, AccessibleTable table);
|
||||
typedef BOOL (*isAccessibleTableRowSelectedFP) (long vmID, AccessibleTable table, jint row);
|
||||
typedef BOOL (*getAccessibleTableRowSelectionsFP) (long vmID, AccessibleTable table, jint count,
|
||||
jint *selections);
|
||||
|
||||
typedef jint (*getAccessibleTableColumnSelectionCountFP) (long vmID, AccessibleTable table);
|
||||
typedef BOOL (*isAccessibleTableColumnSelectedFP) (long vmID, AccessibleTable table, jint column);
|
||||
typedef BOOL (*getAccessibleTableColumnSelectionsFP) (long vmID, AccessibleTable table, jint count,
|
||||
jint *selections);
|
||||
|
||||
typedef jint (*getAccessibleTableRowFP) (long vmID, AccessibleTable table, jint index);
|
||||
typedef jint (*getAccessibleTableColumnFP) (long vmID, AccessibleTable table, jint index);
|
||||
typedef jint (*getAccessibleTableIndexFP) (long vmID, AccessibleTable table, jint row, jint column);
|
||||
/* end AccessibleTable */
|
||||
|
||||
/* AccessibleRelationSet */
|
||||
typedef BOOL (*getAccessibleRelationSetFP) (long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleRelationSetInfo *relationSetInfo);
|
||||
|
||||
/* AccessibleHypertext */
|
||||
typedef BOOL (*getAccessibleHypertextFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
typedef BOOL (*activateAccessibleHyperlinkFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHyperlink accessibleHyperlink);
|
||||
|
||||
typedef jint (*getAccessibleHyperlinkCountFP)(const long vmID,
|
||||
const AccessibleContext accessibleContext);
|
||||
|
||||
typedef BOOL (*getAccessibleHypertextExtFP) (const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
typedef jint (*getAccessibleHypertextLinkIndexFP)(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex);
|
||||
|
||||
typedef BOOL (*getAccessibleHyperlinkFP)(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex,
|
||||
AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
|
||||
/* Accessible KeyBindings, Icons and Actions */
|
||||
typedef BOOL (*getAccessibleKeyBindingsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleKeyBindings *keyBindings);
|
||||
|
||||
typedef BOOL (*getAccessibleIconsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleIcons *icons);
|
||||
|
||||
typedef BOOL (*getAccessibleActionsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActions *actions);
|
||||
|
||||
typedef BOOL (*doAccessibleActionsFP)(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||
|
||||
|
||||
/* AccessibleText */
|
||||
|
||||
typedef BOOL (*GetAccessibleTextInfoFP) (long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||
typedef BOOL (*GetAccessibleTextItemsFP) (long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index);
|
||||
typedef BOOL (*GetAccessibleTextSelectionInfoFP) (long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection);
|
||||
typedef BOOL (*GetAccessibleTextAttributesFP) (long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes);
|
||||
typedef BOOL (*GetAccessibleTextRectFP) (long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
typedef BOOL (*GetAccessibleTextLineBoundsFP) (long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex);
|
||||
typedef BOOL (*GetAccessibleTextRangeFP) (long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len);
|
||||
|
||||
typedef BOOL (*GetCurrentAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
typedef BOOL (*GetMaximumAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
typedef BOOL (*GetMinimumAccessibleValueFromContextFP) (long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
|
||||
typedef void (*AddAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef void (*ClearAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as);
|
||||
typedef JOBJECT64 (*GetAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef int (*GetAccessibleSelectionCountFromContextFP) (long vmID, AccessibleSelection as);
|
||||
typedef BOOL (*IsAccessibleChildSelectedFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef void (*RemoveAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as, int i);
|
||||
typedef void (*SelectAllAccessibleSelectionFromContextFP) (long vmID, AccessibleSelection as);
|
||||
|
||||
/* Utility methods */
|
||||
|
||||
typedef BOOL (*setTextContentsFP) (const long vmID, const AccessibleContext ac, const wchar_t *text);
|
||||
typedef AccessibleContext (*getParentWithRoleFP) (const long vmID, const AccessibleContext ac, const wchar_t *role);
|
||||
typedef AccessibleContext (*getParentWithRoleElseRootFP) (const long vmID, const AccessibleContext ac, const wchar_t *role);
|
||||
typedef AccessibleContext (*getTopLevelObjectFP) (const long vmID, const AccessibleContext ac);
|
||||
typedef int (*getObjectDepthFP) (const long vmID, const AccessibleContext ac);
|
||||
typedef AccessibleContext (*getActiveDescendentFP) (const long vmID, const AccessibleContext ac);
|
||||
|
||||
|
||||
typedef BOOL (*getVirtualAccessibleNameFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
wchar_t *name, int len);
|
||||
|
||||
typedef BOOL (*requestFocusFP) (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
typedef BOOL (*selectTextRangeFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, const int endIndex);
|
||||
|
||||
typedef BOOL (*getTextAttributesInRangeFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, const int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len);
|
||||
|
||||
typedef int (*getVisibleChildrenCountFP) (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
typedef BOOL (*getVisibleChildrenFP) (const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, VisibleChildrenInfo *children);
|
||||
|
||||
typedef BOOL (*setCaretPositionFP) (const long vmID, const AccessibleContext accessibleContext, const int position);
|
||||
|
||||
typedef BOOL (*getCaretLocationFP) (long vmID, AccessibleContext ac, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
|
||||
typedef int (*getEventsWaitingFP) ();
|
||||
|
||||
typedef struct AccessBridgeFPsTag {
|
||||
Windows_runFP Windows_run;
|
||||
|
||||
SetPropertyChangeFP SetPropertyChange;
|
||||
|
||||
SetJavaShutdownFP SetJavaShutdown;
|
||||
SetFocusGainedFP SetFocusGained;
|
||||
SetFocusLostFP SetFocusLost;
|
||||
|
||||
SetCaretUpdateFP SetCaretUpdate;
|
||||
|
||||
SetMouseClickedFP SetMouseClicked;
|
||||
SetMouseEnteredFP SetMouseEntered;
|
||||
SetMouseExitedFP SetMouseExited;
|
||||
SetMousePressedFP SetMousePressed;
|
||||
SetMouseReleasedFP SetMouseReleased;
|
||||
|
||||
SetMenuCanceledFP SetMenuCanceled;
|
||||
SetMenuDeselectedFP SetMenuDeselected;
|
||||
SetMenuSelectedFP SetMenuSelected;
|
||||
SetPopupMenuCanceledFP SetPopupMenuCanceled;
|
||||
SetPopupMenuWillBecomeInvisibleFP SetPopupMenuWillBecomeInvisible;
|
||||
SetPopupMenuWillBecomeVisibleFP SetPopupMenuWillBecomeVisible;
|
||||
|
||||
SetPropertyNameChangeFP SetPropertyNameChange;
|
||||
SetPropertyDescriptionChangeFP SetPropertyDescriptionChange;
|
||||
SetPropertyStateChangeFP SetPropertyStateChange;
|
||||
SetPropertyValueChangeFP SetPropertyValueChange;
|
||||
SetPropertySelectionChangeFP SetPropertySelectionChange;
|
||||
SetPropertyTextChangeFP SetPropertyTextChange;
|
||||
SetPropertyCaretChangeFP SetPropertyCaretChange;
|
||||
SetPropertyVisibleDataChangeFP SetPropertyVisibleDataChange;
|
||||
SetPropertyChildChangeFP SetPropertyChildChange;
|
||||
SetPropertyActiveDescendentChangeFP SetPropertyActiveDescendentChange;
|
||||
|
||||
SetPropertyTableModelChangeFP SetPropertyTableModelChange;
|
||||
|
||||
ReleaseJavaObjectFP ReleaseJavaObject;
|
||||
GetVersionInfoFP GetVersionInfo;
|
||||
|
||||
IsJavaWindowFP IsJavaWindow;
|
||||
IsSameObjectFP IsSameObject;
|
||||
GetAccessibleContextFromHWNDFP GetAccessibleContextFromHWND;
|
||||
getHWNDFromAccessibleContextFP getHWNDFromAccessibleContext;
|
||||
|
||||
GetAccessibleContextAtFP GetAccessibleContextAt;
|
||||
GetAccessibleContextWithFocusFP GetAccessibleContextWithFocus;
|
||||
GetAccessibleContextInfoFP GetAccessibleContextInfo;
|
||||
GetAccessibleChildFromContextFP GetAccessibleChildFromContext;
|
||||
GetAccessibleParentFromContextFP GetAccessibleParentFromContext;
|
||||
|
||||
getAccessibleTableInfoFP getAccessibleTableInfo;
|
||||
getAccessibleTableCellInfoFP getAccessibleTableCellInfo;
|
||||
|
||||
getAccessibleTableRowHeaderFP getAccessibleTableRowHeader;
|
||||
getAccessibleTableColumnHeaderFP getAccessibleTableColumnHeader;
|
||||
|
||||
getAccessibleTableRowDescriptionFP getAccessibleTableRowDescription;
|
||||
getAccessibleTableColumnDescriptionFP getAccessibleTableColumnDescription;
|
||||
|
||||
getAccessibleTableRowSelectionCountFP getAccessibleTableRowSelectionCount;
|
||||
isAccessibleTableRowSelectedFP isAccessibleTableRowSelected;
|
||||
getAccessibleTableRowSelectionsFP getAccessibleTableRowSelections;
|
||||
|
||||
getAccessibleTableColumnSelectionCountFP getAccessibleTableColumnSelectionCount;
|
||||
isAccessibleTableColumnSelectedFP isAccessibleTableColumnSelected;
|
||||
getAccessibleTableColumnSelectionsFP getAccessibleTableColumnSelections;
|
||||
|
||||
getAccessibleTableRowFP getAccessibleTableRow;
|
||||
getAccessibleTableColumnFP getAccessibleTableColumn;
|
||||
getAccessibleTableIndexFP getAccessibleTableIndex;
|
||||
|
||||
getAccessibleRelationSetFP getAccessibleRelationSet;
|
||||
|
||||
getAccessibleHypertextFP getAccessibleHypertext;
|
||||
activateAccessibleHyperlinkFP activateAccessibleHyperlink;
|
||||
getAccessibleHyperlinkCountFP getAccessibleHyperlinkCount;
|
||||
getAccessibleHypertextExtFP getAccessibleHypertextExt;
|
||||
getAccessibleHypertextLinkIndexFP getAccessibleHypertextLinkIndex;
|
||||
getAccessibleHyperlinkFP getAccessibleHyperlink;
|
||||
|
||||
getAccessibleKeyBindingsFP getAccessibleKeyBindings;
|
||||
getAccessibleIconsFP getAccessibleIcons;
|
||||
getAccessibleActionsFP getAccessibleActions;
|
||||
doAccessibleActionsFP doAccessibleActions;
|
||||
|
||||
GetAccessibleTextInfoFP GetAccessibleTextInfo;
|
||||
GetAccessibleTextItemsFP GetAccessibleTextItems;
|
||||
GetAccessibleTextSelectionInfoFP GetAccessibleTextSelectionInfo;
|
||||
GetAccessibleTextAttributesFP GetAccessibleTextAttributes;
|
||||
GetAccessibleTextRectFP GetAccessibleTextRect;
|
||||
GetAccessibleTextLineBoundsFP GetAccessibleTextLineBounds;
|
||||
GetAccessibleTextRangeFP GetAccessibleTextRange;
|
||||
|
||||
GetCurrentAccessibleValueFromContextFP GetCurrentAccessibleValueFromContext;
|
||||
GetMaximumAccessibleValueFromContextFP GetMaximumAccessibleValueFromContext;
|
||||
GetMinimumAccessibleValueFromContextFP GetMinimumAccessibleValueFromContext;
|
||||
|
||||
AddAccessibleSelectionFromContextFP AddAccessibleSelectionFromContext;
|
||||
ClearAccessibleSelectionFromContextFP ClearAccessibleSelectionFromContext;
|
||||
GetAccessibleSelectionFromContextFP GetAccessibleSelectionFromContext;
|
||||
GetAccessibleSelectionCountFromContextFP GetAccessibleSelectionCountFromContext;
|
||||
IsAccessibleChildSelectedFromContextFP IsAccessibleChildSelectedFromContext;
|
||||
RemoveAccessibleSelectionFromContextFP RemoveAccessibleSelectionFromContext;
|
||||
SelectAllAccessibleSelectionFromContextFP SelectAllAccessibleSelectionFromContext;
|
||||
|
||||
setTextContentsFP setTextContents;
|
||||
getParentWithRoleFP getParentWithRole;
|
||||
getTopLevelObjectFP getTopLevelObject;
|
||||
getParentWithRoleElseRootFP getParentWithRoleElseRoot;
|
||||
getObjectDepthFP getObjectDepth;
|
||||
getActiveDescendentFP getActiveDescendent;
|
||||
|
||||
getVirtualAccessibleNameFP getVirtualAccessibleName;
|
||||
requestFocusFP requestFocus;
|
||||
selectTextRangeFP selectTextRange;
|
||||
getTextAttributesInRangeFP getTextAttributesInRange;
|
||||
getVisibleChildrenCountFP getVisibleChildrenCount;
|
||||
getVisibleChildrenFP getVisibleChildren;
|
||||
setCaretPositionFP setCaretPosition;
|
||||
getCaretLocationFP getCaretLocation;
|
||||
|
||||
getEventsWaitingFP getEventsWaiting;
|
||||
|
||||
} AccessBridgeFPs;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the world
|
||||
*/
|
||||
BOOL initializeAccessBridge();
|
||||
BOOL shutdownAccessBridge();
|
||||
|
||||
/**
|
||||
* Window routines
|
||||
*/
|
||||
BOOL IsJavaWindow(HWND window);
|
||||
|
||||
// Returns the virtual machine ID and AccessibleContext for a top-level window
|
||||
BOOL GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac);
|
||||
|
||||
// Returns the HWND from the AccessibleContext of a top-level window
|
||||
HWND getHWNDFromAccessibleContext(long vmID, AccessibleContext ac);
|
||||
|
||||
|
||||
/**
|
||||
* Event handling routines
|
||||
*/
|
||||
void SetJavaShutdown(AccessBridge_JavaShutdownFP fp);
|
||||
void SetFocusGained(AccessBridge_FocusGainedFP fp);
|
||||
void SetFocusLost(AccessBridge_FocusLostFP fp);
|
||||
|
||||
void SetCaretUpdate(AccessBridge_CaretUpdateFP fp);
|
||||
|
||||
void SetMouseClicked(AccessBridge_MouseClickedFP fp);
|
||||
void SetMouseEntered(AccessBridge_MouseEnteredFP fp);
|
||||
void SetMouseExited(AccessBridge_MouseExitedFP fp);
|
||||
void SetMousePressed(AccessBridge_MousePressedFP fp);
|
||||
void SetMouseReleased(AccessBridge_MouseReleasedFP fp);
|
||||
|
||||
void SetMenuCanceled(AccessBridge_MenuCanceledFP fp);
|
||||
void SetMenuDeselected(AccessBridge_MenuDeselectedFP fp);
|
||||
void SetMenuSelected(AccessBridge_MenuSelectedFP fp);
|
||||
void SetPopupMenuCanceled(AccessBridge_PopupMenuCanceledFP fp);
|
||||
void SetPopupMenuWillBecomeInvisible(AccessBridge_PopupMenuWillBecomeInvisibleFP fp);
|
||||
void SetPopupMenuWillBecomeVisible(AccessBridge_PopupMenuWillBecomeVisibleFP fp);
|
||||
|
||||
void SetPropertyNameChange(AccessBridge_PropertyNameChangeFP fp);
|
||||
void SetPropertyDescriptionChange(AccessBridge_PropertyDescriptionChangeFP fp);
|
||||
void SetPropertyStateChange(AccessBridge_PropertyStateChangeFP fp);
|
||||
void SetPropertyValueChange(AccessBridge_PropertyValueChangeFP fp);
|
||||
void SetPropertySelectionChange(AccessBridge_PropertySelectionChangeFP fp);
|
||||
void SetPropertyTextChange(AccessBridge_PropertyTextChangeFP fp);
|
||||
void SetPropertyCaretChange(AccessBridge_PropertyCaretChangeFP fp);
|
||||
void SetPropertyVisibleDataChange(AccessBridge_PropertyVisibleDataChangeFP fp);
|
||||
void SetPropertyChildChange(AccessBridge_PropertyChildChangeFP fp);
|
||||
void SetPropertyActiveDescendentChange(AccessBridge_PropertyActiveDescendentChangeFP fp);
|
||||
|
||||
void SetPropertyTableModelChange(AccessBridge_PropertyTableModelChangeFP fp);
|
||||
|
||||
|
||||
/**
|
||||
* General routines
|
||||
*/
|
||||
void ReleaseJavaObject(long vmID, Java_Object object);
|
||||
BOOL GetVersionInfo(long vmID, AccessBridgeVersionInfo *info);
|
||||
HWND GetHWNDFromAccessibleContext(long vmID, JOBJECT64 accesibleContext);
|
||||
|
||||
/**
|
||||
* Accessible Context routines
|
||||
*/
|
||||
BOOL GetAccessibleContextAt(long vmID, AccessibleContext acParent,
|
||||
jint x, jint y, AccessibleContext *ac);
|
||||
BOOL GetAccessibleContextWithFocus(HWND window, long *vmID, AccessibleContext *ac);
|
||||
BOOL GetAccessibleContextInfo(long vmID, AccessibleContext ac, AccessibleContextInfo *info);
|
||||
AccessibleContext GetAccessibleChildFromContext(long vmID, AccessibleContext ac, jint index);
|
||||
AccessibleContext GetAccessibleParentFromContext(long vmID, AccessibleContext ac);
|
||||
|
||||
/**
|
||||
* Accessible Text routines
|
||||
*/
|
||||
BOOL GetAccessibleTextInfo(long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y);
|
||||
BOOL GetAccessibleTextItems(long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index);
|
||||
BOOL GetAccessibleTextSelectionInfo(long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection);
|
||||
BOOL GetAccessibleTextAttributes(long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes);
|
||||
BOOL GetAccessibleTextRect(long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index);
|
||||
BOOL GetAccessibleTextLineBounds(long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex);
|
||||
BOOL GetAccessibleTextRange(long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len);
|
||||
|
||||
/* begin AccessibleTable routines */
|
||||
BOOL getAccessibleTableInfo(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
BOOL getAccessibleTableCellInfo(long vmID, AccessibleTable accessibleTable, jint row, jint column,
|
||||
AccessibleTableCellInfo *tableCellInfo);
|
||||
|
||||
BOOL getAccessibleTableRowHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
BOOL getAccessibleTableColumnHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo);
|
||||
|
||||
AccessibleContext getAccessibleTableRowDescription(long vmID, AccessibleContext acParent, jint row);
|
||||
AccessibleContext getAccessibleTableColumnDescription(long vmID, AccessibleContext acParent, jint column);
|
||||
|
||||
jint getAccessibleTableRowSelectionCount(long vmID, AccessibleTable table);
|
||||
BOOL isAccessibleTableRowSelected(long vmID, AccessibleTable table, jint row);
|
||||
BOOL getAccessibleTableRowSelections(long vmID, AccessibleTable table, jint count, jint *selections);
|
||||
|
||||
jint getAccessibleTableColumnSelectionCount(long vmID, AccessibleTable table);
|
||||
BOOL isAccessibleTableColumnSelected(long vmID, AccessibleTable table, jint column);
|
||||
BOOL getAccessibleTableColumnSelections(long vmID, AccessibleTable table, jint count, jint *selections);
|
||||
|
||||
jint getAccessibleTableRow(long vmID, AccessibleTable table, jint index);
|
||||
jint getAccessibleTableColumn(long vmID, AccessibleTable table, jint index);
|
||||
jint getAccessibleTableIndex(long vmID, AccessibleTable table, jint row, jint column);
|
||||
/* end AccessibleTable */
|
||||
|
||||
/* ----- AccessibleRelationSet routines */
|
||||
BOOL getAccessibleRelationSet(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleRelationSetInfo *relationSetInfo);
|
||||
|
||||
/* ----- AccessibleHypertext routines */
|
||||
|
||||
/*
|
||||
* Returns hypertext information associated with a component.
|
||||
*/
|
||||
BOOL getAccessibleHypertext(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
/*
|
||||
* Requests that a hyperlink be activated.
|
||||
*/
|
||||
BOOL activateAccessibleHyperlink(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleHyperlink accessibleHyperlink);
|
||||
|
||||
/*
|
||||
* Returns the number of hyperlinks in a component
|
||||
* Maps to AccessibleHypertext.getLinkCount.
|
||||
* Returns -1 on error.
|
||||
*/
|
||||
jint getAccessibleHyperlinkCount(const long vmID,
|
||||
const AccessibleHypertext hypertext);
|
||||
|
||||
/*
|
||||
* This method is used to iterate through the hyperlinks in a component. It
|
||||
* returns hypertext information for a component starting at hyperlink index
|
||||
* nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will
|
||||
* be returned for each call to this method.
|
||||
* Returns FALSE on error.
|
||||
*/
|
||||
BOOL getAccessibleHypertextExt(const long vmID,
|
||||
const AccessibleContext accessibleContext,
|
||||
const jint nStartIndex,
|
||||
/* OUT */ AccessibleHypertextInfo *hypertextInfo);
|
||||
|
||||
/*
|
||||
* Returns the index into an array of hyperlinks that is associated with
|
||||
* a character index in document; maps to AccessibleHypertext.getLinkIndex
|
||||
* Returns -1 on error.
|
||||
*/
|
||||
jint getAccessibleHypertextLinkIndex(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex);
|
||||
|
||||
/*
|
||||
* Returns the nth hyperlink in a document
|
||||
* Maps to AccessibleHypertext.getLink.
|
||||
* Returns FALSE on error
|
||||
*/
|
||||
BOOL getAccessibleHyperlink(const long vmID,
|
||||
const AccessibleHypertext hypertext,
|
||||
const jint nIndex,
|
||||
/* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo);
|
||||
|
||||
/* Accessible KeyBindings, Icons and Actions */
|
||||
|
||||
/*
|
||||
* Returns a list of key bindings associated with a component.
|
||||
*/
|
||||
BOOL getAccessibleKeyBindings(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleKeyBindings *keyBindings);
|
||||
|
||||
/*
|
||||
* Returns a list of icons associate with a component.
|
||||
*/
|
||||
BOOL getAccessibleIcons(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleIcons *icons);
|
||||
|
||||
/*
|
||||
* Returns a list of actions that a component can perform.
|
||||
*/
|
||||
BOOL getAccessibleActions(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActions *actions);
|
||||
|
||||
/*
|
||||
* Request that a list of AccessibleActions be performed by a component.
|
||||
* Returns TRUE if all actions are performed. Returns FALSE
|
||||
* when the first requested action fails in which case "failure"
|
||||
* contains the index of the action that failed.
|
||||
*/
|
||||
BOOL doAccessibleActions(long vmID, AccessibleContext accessibleContext,
|
||||
AccessibleActionsToDo *actionsToDo, jint *failure);
|
||||
|
||||
|
||||
|
||||
/* Additional utility methods */
|
||||
|
||||
/*
|
||||
* Returns whether two object references refer to the same object.
|
||||
*/
|
||||
BOOL IsSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2);
|
||||
|
||||
/**
|
||||
* Sets editable text contents. The AccessibleContext must implement AccessibleEditableText and
|
||||
* be editable. The maximum text length that can be set is MAX_STRING_SIZE - 1.
|
||||
* Returns whether successful
|
||||
*/
|
||||
BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context with the specified role that is the
|
||||
* ancestor of a given object. The role is one of the role strings
|
||||
* defined in AccessBridgePackages.h
|
||||
* If there is no ancestor object that has the specified role,
|
||||
* returns (AccessibleContext)0.
|
||||
*/
|
||||
AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext,
|
||||
const wchar_t *role);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context with the specified role that is the
|
||||
* ancestor of a given object. The role is one of the role strings
|
||||
* defined in AccessBridgePackages.h. If an object with the specified
|
||||
* role does not exist, returns the top level object for the Java Window.
|
||||
* Returns (AccessibleContext)0 on error.
|
||||
*/
|
||||
AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext,
|
||||
const wchar_t *role);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context for the top level object in
|
||||
* a Java Window. This is same Accessible Context that is obtained
|
||||
* from GetAccessibleContextFromHWND for that window. Returns
|
||||
* (AccessibleContext)0 on error.
|
||||
*/
|
||||
AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Returns how deep in the object hierarchy a given object is.
|
||||
* The top most object in the object hierarchy has an object depth of 0.
|
||||
* Returns -1 on error.
|
||||
*/
|
||||
int getObjectDepth (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Returns the Accessible Context of the current ActiveDescendent of an object.
|
||||
* This method assumes the ActiveDescendent is the component that is currently
|
||||
* selected in a container object.
|
||||
* Returns (AccessibleContext)0 on error or if there is no selection.
|
||||
*/
|
||||
AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Accessible Value routines
|
||||
*/
|
||||
BOOL GetCurrentAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
BOOL GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
BOOL GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len);
|
||||
|
||||
/**
|
||||
* Accessible Selection routines
|
||||
*/
|
||||
void AddAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||
void ClearAccessibleSelectionFromContext(long vmID, AccessibleSelection as);
|
||||
JOBJECT64 GetAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||
int GetAccessibleSelectionCountFromContext(long vmID, AccessibleSelection as);
|
||||
BOOL IsAccessibleChildSelectedFromContext(long vmID, AccessibleSelection as, int i);
|
||||
void RemoveAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i);
|
||||
void SelectAllAccessibleSelectionFromContext(long vmID, AccessibleSelection as);
|
||||
|
||||
/**
|
||||
* Additional methods for Teton
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
|
||||
* whether successful.
|
||||
*
|
||||
* Bug ID 4916682 - Implement JAWS AccessibleName policy
|
||||
*/
|
||||
BOOL getVirtualAccessibleName(const long vmID, const AccessibleContext accessibleContext,
|
||||
wchar_t *name, int len);
|
||||
|
||||
/**
|
||||
* Request focus for a component. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944757 - requestFocus method needed
|
||||
*/
|
||||
BOOL requestFocus(const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Selects text between two indices. Selection includes the text at the start index
|
||||
* and the text at the end index. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944758 - selectTextRange method needed
|
||||
*/
|
||||
BOOL selectTextRange(const long vmID, const AccessibleContext accessibleContext, const int startIndex,
|
||||
const int endIndex);
|
||||
|
||||
/**
|
||||
* Get text attributes between two indices. The attribute list includes the text at the
|
||||
* start index and the text at the end index. Returns whether successful;
|
||||
*
|
||||
* Bug ID 4944761 - getTextAttributes between two indices method needed
|
||||
*/
|
||||
BOOL getTextAttributesInRange(const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex, const int endIndex,
|
||||
AccessibleTextAttributesInfo *attributes, short *len);
|
||||
|
||||
/**
|
||||
* Returns the number of visible children of a component. Returns -1 on error.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
int getVisibleChildrenCount(const long vmID, const AccessibleContext accessibleContext);
|
||||
|
||||
/**
|
||||
* Gets the visible children of an AccessibleContext. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944762- getVisibleChildren for list-like components needed
|
||||
*/
|
||||
BOOL getVisibleChildren(const long vmID, const AccessibleContext accessibleContext,
|
||||
const int startIndex,
|
||||
VisibleChildrenInfo *visibleChildrenInfo);
|
||||
|
||||
/**
|
||||
* Set the caret to a text position. Returns whether successful.
|
||||
*
|
||||
* Bug ID 4944770 - setCaretPosition method needed
|
||||
*/
|
||||
BOOL setCaretPosition(const long vmID, const AccessibleContext accessibleContext,
|
||||
const int position);
|
||||
|
||||
/**
|
||||
* Gets the text caret location
|
||||
*/
|
||||
BOOL getCaretLocation(long vmID, AccessibleContext ac,
|
||||
AccessibleTextRectInfo *rectInfo, jint index);
|
||||
|
||||
/**
|
||||
* Gets the number of events waiting to fire
|
||||
*/
|
||||
int getEventsWaiting();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JAWT_MD_H_
|
||||
#define _JAVASOFT_JAWT_MD_H_
|
||||
|
||||
#include <windows.h>
|
||||
#include "jawt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Win32-specific declarations for AWT native interface.
|
||||
* See notes in jawt.h for an example of use.
|
||||
*/
|
||||
typedef struct jawt_Win32DrawingSurfaceInfo {
|
||||
/* Native window, DDB, or DIB handle */
|
||||
union {
|
||||
HWND hwnd;
|
||||
HBITMAP hbitmap;
|
||||
void* pbits;
|
||||
};
|
||||
/*
|
||||
* This HDC should always be used instead of the HDC returned from
|
||||
* BeginPaint() or any calls to GetDC().
|
||||
*/
|
||||
HDC hdc;
|
||||
HPALETTE hpalette;
|
||||
} JAWT_Win32DrawingSurfaceInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_JAVASOFT_JAWT_MD_H_ */
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
|
||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _JAVASOFT_JNI_MD_H_
|
||||
#define _JAVASOFT_JNI_MD_H_
|
||||
|
||||
#define JNIEXPORT __declspec(dllexport)
|
||||
#define JNIIMPORT __declspec(dllimport)
|
||||
#define JNICALL __stdcall
|
||||
|
||||
typedef long jint;
|
||||
typedef __int64 jlong;
|
||||
typedef signed char jbyte;
|
||||
|
||||
#endif /* !_JAVASOFT_JNI_MD_H_ */
|
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "com_taosdata_jdbc_tmq_TMQConnector.h"
|
||||
#include "jniCommon.h"
|
||||
#include "taos.h"
|
||||
|
||||
void commit_cb(tmq_t *tmq, int32_t code, void *param) {
|
||||
JNIEnv *env = NULL;
|
||||
int status = (*g_vm)->GetEnv(g_vm, (void **)&env, JNI_VERSION_1_6);
|
||||
bool needDetach = false;
|
||||
if (status < 0) {
|
||||
if ((*g_vm)->AttachCurrentThread(g_vm, (void **)&env, NULL) != 0) {
|
||||
return;
|
||||
}
|
||||
needDetach = true;
|
||||
}
|
||||
|
||||
jobject obj = (jobject)param;
|
||||
(*env)->CallVoidMethod(env, obj, g_commitCallback, code);
|
||||
|
||||
(*env)->DeleteGlobalRef(env, obj);
|
||||
param = NULL;
|
||||
|
||||
if (needDetach) {
|
||||
(*g_vm)->DetachCurrentThread(g_vm);
|
||||
}
|
||||
env = NULL;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfNewImp(JNIEnv *env, jobject jobj) {
|
||||
tmq_conf_t *conf = tmq_conf_new();
|
||||
return (jlong)conf;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfSetImp(JNIEnv *env, jobject jobj, jlong conf,
|
||||
jstring jkey, jstring jvalue) {
|
||||
if (jkey == NULL) {
|
||||
jniError("jobj:%p, failed set tmq config. key is null", jobj);
|
||||
return TMQ_CONF_KEY_NULL;
|
||||
}
|
||||
const char *key = (*env)->GetStringUTFChars(env, jkey, NULL);
|
||||
|
||||
if (jvalue == NULL) {
|
||||
jniError("jobj:%p, failed set tmq config. key %s, value is null", jobj, key);
|
||||
(*env)->ReleaseStringUTFChars(env, jkey, key);
|
||||
return TMQ_CONF_VALUE_NULL;
|
||||
}
|
||||
const char *value = (*env)->GetStringUTFChars(env, jvalue, NULL);
|
||||
|
||||
tmq_conf_res_t res = tmq_conf_set((tmq_conf_t *)conf, key, value);
|
||||
(*env)->ReleaseStringUTFChars(env, jkey, key);
|
||||
(*env)->ReleaseStringUTFChars(env, jvalue, value);
|
||||
return (jint)res;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConfDestroyImp(JNIEnv *env, jobject jobj,
|
||||
jlong jconf) {
|
||||
tmq_conf_t *conf = (tmq_conf_t *)jconf;
|
||||
if (conf == NULL) {
|
||||
jniDebug("jobj:%p, tmq config is already destroyed", jobj);
|
||||
} else {
|
||||
tmq_conf_destroy(conf);
|
||||
jniDebug("jobj:%p, config:%p, tmq successfully destroy config", jobj, conf);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerNewImp(JNIEnv *env, jobject jobj,
|
||||
jlong jconf, jobject jconsumer) {
|
||||
tmq_conf_t *conf = (tmq_conf_t *)jconf;
|
||||
if (conf == NULL) {
|
||||
jniError("jobj:%p, tmq config is already destroyed", jobj);
|
||||
return TMQ_CONF_NULL;
|
||||
}
|
||||
int len = 1024;
|
||||
char *msg = (char *)taosMemoryCalloc(1, sizeof(char) * (len + 1));
|
||||
if (msg == NULL) {
|
||||
jniError("jobj:%p, config:%p, tmq alloc memory failed", jobj, conf);
|
||||
return JNI_OUT_OF_MEMORY;
|
||||
}
|
||||
tmq_t *tmq = tmq_consumer_new((tmq_conf_t *)conf, msg, len);
|
||||
if (strlen(msg) > 0) {
|
||||
jniError("jobj:%p, config:%p, tmq create consumer error: %s", jobj, conf, msg);
|
||||
(*env)->CallVoidMethod(env, jconsumer, g_createConsumerErrorCallback, (*env)->NewStringUTF(env, msg));
|
||||
taosMemoryFreeClear(msg);
|
||||
return TMQ_CONSUMER_CREATE_ERROR;
|
||||
}
|
||||
taosMemoryFreeClear(msg);
|
||||
return (jlong)tmq;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicNewImp(JNIEnv *env, jobject jobj, jlong jtmq) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniError("jobj:%p, tmq is closed", jobj);
|
||||
return TMQ_CONSUMER_NULL;
|
||||
}
|
||||
|
||||
tmq_list_t *topics = tmq_list_new();
|
||||
return (jlong)topics;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicAppendImp(JNIEnv *env, jobject jobj,
|
||||
jlong jtopic, jstring jname) {
|
||||
tmq_list_t *topic = (tmq_list_t *)jtopic;
|
||||
if (topic == NULL) {
|
||||
jniError("jobj:%p, tmq topic list is null", jobj);
|
||||
return TMQ_TOPIC_NULL;
|
||||
}
|
||||
if (jname == NULL) {
|
||||
jniDebug("jobj:%p, tmq topic append jname is null", jobj);
|
||||
return TMQ_TOPIC_NAME_NULL;
|
||||
}
|
||||
|
||||
const char *name = (*env)->GetStringUTFChars(env, jname, NULL);
|
||||
|
||||
int32_t res = tmq_list_append((tmq_list_t *)topic, name);
|
||||
(*env)->ReleaseStringUTFChars(env, jname, name);
|
||||
return (jint)res;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqTopicDestroyImp(JNIEnv *env, jobject jobj,
|
||||
jlong jtopic) {
|
||||
tmq_list_t *topic = (tmq_list_t *)jtopic;
|
||||
if (topic == NULL) {
|
||||
jniDebug("jobj:%p, tmq topic list is already destroyed", jobj);
|
||||
} else {
|
||||
tmq_list_destroy((tmq_list_t *)topic);
|
||||
jniDebug("jobj:%p, tmq successfully destroy topic list", jobj);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscribeImp(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||
jlong jtopic) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniError("jobj:%p, tmq is closed", jobj);
|
||||
return TMQ_CONSUMER_NULL;
|
||||
}
|
||||
|
||||
tmq_list_t *topic = (tmq_list_t *)jtopic;
|
||||
if (topic == NULL) {
|
||||
jniDebug("jobj:%p, tmq topic list is already destroyed", jobj);
|
||||
return TMQ_TOPIC_NULL;
|
||||
}
|
||||
|
||||
int32_t res = tmq_subscribe(tmq, topic);
|
||||
return (jint)res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqSubscriptionImp(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||
jobject jconsumer) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniError("jobj:%p, tmq is closed", jobj);
|
||||
return TMQ_CONSUMER_NULL;
|
||||
}
|
||||
|
||||
tmq_list_t *topicList = NULL;
|
||||
int32_t res = tmq_subscription((tmq_t *)tmq, &topicList);
|
||||
if (res != JNI_SUCCESS) {
|
||||
tmq_list_destroy(topicList);
|
||||
jniError("jobj:%p, tmq:%p, tmq get subscription error: %s", jobj, tmq, tmq_err2str(res));
|
||||
return (jint)res;
|
||||
}
|
||||
|
||||
char **topics = tmq_list_to_c_array(topicList);
|
||||
int32_t sz = tmq_list_get_size(topicList);
|
||||
|
||||
jobjectArray arr = (jobjectArray)(*env)->NewObjectArray(env, sz, (*env)->FindClass(env, "java/lang/String"),
|
||||
(*env)->NewStringUTF(env, ""));
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
(*env)->SetObjectArrayElement(env, arr, i, (*env)->NewStringUTF(env, topics[i]));
|
||||
}
|
||||
(*env)->CallVoidMethod(env, jconsumer, g_topicListCallback, arr);
|
||||
tmq_list_destroy(topicList);
|
||||
return JNI_SUCCESS;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitSync(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||
jlong jres) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniError("jobj:%p, tmq is closed", jobj);
|
||||
return TMQ_CONSUMER_NULL;
|
||||
}
|
||||
TAOS_RES *res = (TAOS_RES *)jres;
|
||||
return tmq_commit_sync(tmq, res);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqCommitAsync(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||
jlong jres, jobject consumer) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniError("jobj:%p, tmq is closed", jobj);
|
||||
}
|
||||
TAOS_RES *res = (TAOS_RES *)jres;
|
||||
consumer = (*env)->NewGlobalRef(env, consumer);
|
||||
tmq_commit_async(tmq, res, commit_cb, consumer);
|
||||
}
|
||||
|
||||
JNIEXPORT int JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqUnsubscribeImp(JNIEnv *env, jobject jobj, jlong jtmq) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniError("jobj:%p, tmq is closed", jobj);
|
||||
return TMQ_CONSUMER_NULL;
|
||||
}
|
||||
jniDebug("jobj:%p, tmq:%p, successfully unsubscribe", jobj, tmq);
|
||||
return tmq_unsubscribe((tmq_t *)tmq);
|
||||
}
|
||||
|
||||
JNIEXPORT int JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerCloseImp(JNIEnv *env, jobject jobj,
|
||||
jlong jtmq) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniDebug("jobj:%p, tmq is closed", jobj);
|
||||
return TMQ_CONSUMER_NULL;
|
||||
}
|
||||
return tmq_consumer_close((tmq_t *)tmq);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_getErrMsgImp(JNIEnv *env, jobject jobj, jint code) {
|
||||
return (*env)->NewStringUTF(env, tmq_err2str(code));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqConsumerPoll(JNIEnv *env, jobject jobj, jlong jtmq,
|
||||
jlong time) {
|
||||
tmq_t *tmq = (tmq_t *)jtmq;
|
||||
if (tmq == NULL) {
|
||||
jniDebug("jobj:%p, tmq is closed", jobj);
|
||||
return TMQ_CONSUMER_NULL;
|
||||
}
|
||||
return (jlong)tmq_consumer_poll((tmq_t *)tmq, time);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTopicName(JNIEnv *env, jobject jobj,
|
||||
jlong jres) {
|
||||
TAOS_RES *res = (TAOS_RES *)jres;
|
||||
if (res == NULL) {
|
||||
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||
}
|
||||
return (*env)->NewStringUTF(env, tmq_get_topic_name(res));
|
||||
}
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetDbName(JNIEnv *env, jobject jobj, jlong jres) {
|
||||
TAOS_RES *res = (TAOS_RES *)jres;
|
||||
if (res == NULL) {
|
||||
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||
}
|
||||
return (*env)->NewStringUTF(env, tmq_get_db_name(res));
|
||||
}
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetVgroupId(JNIEnv *env, jobject jobj, jlong jres) {
|
||||
TAOS_RES *res = (TAOS_RES *)jres;
|
||||
if (res == NULL) {
|
||||
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||
}
|
||||
return tmq_get_vgroup_id(res);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_tmqGetTableName(JNIEnv *env, jobject jobj,
|
||||
jlong jres) {
|
||||
TAOS_RES *res = (TAOS_RES *)jres;
|
||||
if (res == NULL) {
|
||||
jniDebug("jobj:%p, invalid res handle", jobj);
|
||||
}
|
||||
return (*env)->NewStringUTF(env, tmq_get_table_name(res));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_tmq_TMQConnector_fetchRawBlockImp(JNIEnv *env, jobject jobj, jlong con,
|
||||
jlong res, jobject rowobj, jint flag,
|
||||
jobject arrayListObj) {
|
||||
TAOS *tscon = (TAOS *)con;
|
||||
int32_t code = check_for_params(jobj, con, res);
|
||||
if (code != JNI_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
||||
TAOS_RES *tres = (TAOS_RES *)res;
|
||||
|
||||
void *data;
|
||||
int32_t numOfRows;
|
||||
int error_code = taos_fetch_raw_block(tres, &numOfRows, &data);
|
||||
if (numOfRows == 0) {
|
||||
if (error_code == JNI_SUCCESS) {
|
||||
jniDebug("jobj:%p, conn:%p, resultset:%p, no data to retrieve", jobj, tscon, (void *)res);
|
||||
return JNI_FETCH_END;
|
||||
} else {
|
||||
jniError("jobj:%p, conn:%p, query interrupted", jobj, tscon);
|
||||
return JNI_RESULT_SET_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t numOfFields = taos_num_fields(tres);
|
||||
if (numOfFields == 0) {
|
||||
jniError("jobj:%p, conn:%p, resultset:%p, fields size is %d", jobj, tscon, tres, numOfFields);
|
||||
return JNI_NUM_OF_FIELDS_0;
|
||||
}
|
||||
|
||||
TAOS_FIELD *fields = taos_fetch_fields(tres);
|
||||
jniDebug("jobj:%p, conn:%p, resultset:%p, fields size is %d", jobj, tscon, tres, numOfFields);
|
||||
if (flag) {
|
||||
for (int i = 0; i < numOfFields; ++i) {
|
||||
jobject metadataObj = (*env)->NewObject(env, g_metadataClass, g_metadataConstructFp);
|
||||
(*env)->SetIntField(env, metadataObj, g_metadataColtypeField, fields[i].type);
|
||||
(*env)->SetIntField(env, metadataObj, g_metadataColsizeField, fields[i].bytes);
|
||||
(*env)->SetIntField(env, metadataObj, g_metadataColindexField, i);
|
||||
jstring metadataObjColname = (*env)->NewStringUTF(env, fields[i].name);
|
||||
(*env)->SetObjectField(env, metadataObj, g_metadataColnameField, metadataObjColname);
|
||||
(*env)->CallBooleanMethod(env, arrayListObj, g_arrayListAddFp, metadataObj);
|
||||
}
|
||||
}
|
||||
|
||||
(*env)->CallVoidMethod(env, rowobj, g_blockdataSetNumOfRowsFp, (jint)numOfRows);
|
||||
(*env)->CallVoidMethod(env, rowobj, g_blockdataSetNumOfColsFp, (jint)numOfFields);
|
||||
|
||||
int32_t len = *(int32_t *)data;
|
||||
(*env)->CallVoidMethod(env, rowobj, g_blockdataSetByteArrayFp, jniFromNCharToByteArray(env, (char *)data, len));
|
||||
return JNI_SUCCESS;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -49,13 +49,8 @@ void cleanupTscQhandle() {
|
|||
// destroy handle
|
||||
taosCleanUpScheduler(tscQhandle);
|
||||
}
|
||||
static int32_t registerRequest(SRequestObj *pRequest) {
|
||||
STscObj *pTscObj = acquireTscObj(pRequest->pTscObj->id);
|
||||
if (NULL == pTscObj) {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
static int32_t registerRequest(SRequestObj *pRequest, STscObj* pTscObj) {
|
||||
// connection has been released already, abort creating request.
|
||||
pRequest->self = taosAddRef(clientReqRefPool, pRequest);
|
||||
|
||||
|
@ -102,7 +97,7 @@ void closeTransporter(SAppInstInfo *pAppInfo) {
|
|||
|
||||
static bool clientRpcRfp(int32_t code, tmsg_t msgType) {
|
||||
if (NEED_REDIRECT_ERROR(code)) {
|
||||
if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) {
|
||||
if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH || msgType == TDMT_SCH_MERGE_FETCH) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -246,29 +241,34 @@ STscObj *acquireTscObj(int64_t rid) { return (STscObj *)taosAcquireRef(clientCon
|
|||
|
||||
int32_t releaseTscObj(int64_t rid) { return taosReleaseRef(clientConnRefPool, rid); }
|
||||
|
||||
void *createRequest(STscObj *pObj, int32_t type) {
|
||||
assert(pObj != NULL);
|
||||
|
||||
void *createRequest(uint64_t connId, int32_t type) {
|
||||
SRequestObj *pRequest = (SRequestObj *)taosMemoryCalloc(1, sizeof(SRequestObj));
|
||||
if (NULL == pRequest) {
|
||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
STscObj* pTscObj = acquireTscObj(connId);
|
||||
if (pTscObj == NULL) {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pRequest->resType = RES_TYPE__QUERY;
|
||||
pRequest->pDb = getDbOfConnection(pObj);
|
||||
pRequest->requestId = generateRequestId();
|
||||
pRequest->metric.start = taosGetTimestampUs();
|
||||
|
||||
pRequest->body.resInfo.convertUcs4 = true; // convert ucs4 by default
|
||||
|
||||
pRequest->type = type;
|
||||
pRequest->pTscObj = pObj;
|
||||
|
||||
pRequest->pDb = getDbOfConnection(pTscObj);
|
||||
pRequest->pTscObj = pTscObj;
|
||||
|
||||
pRequest->msgBuf = taosMemoryCalloc(1, ERROR_MSG_BUF_DEFAULT_SIZE);
|
||||
pRequest->msgBufLen = ERROR_MSG_BUF_DEFAULT_SIZE;
|
||||
tsem_init(&pRequest->body.rspSem, 0, 0);
|
||||
|
||||
if (registerRequest(pRequest)) {
|
||||
if (registerRequest(pRequest, pTscObj)) {
|
||||
doDestroyRequest(pRequest);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -327,8 +327,8 @@ void doDestroyRequest(void *p) {
|
|||
if (pRequest->self) {
|
||||
deregisterRequest(pRequest);
|
||||
}
|
||||
taosMemoryFree(pRequest);
|
||||
|
||||
taosMemoryFree(pRequest);
|
||||
tscTrace("end to destroy request %" PRIx64 " p:%p", reqId, pRequest);
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,6 @@ void destroyRequest(SRequestObj *pRequest) {
|
|||
}
|
||||
|
||||
taos_stop_query(pRequest);
|
||||
|
||||
removeRequest(pRequest->self);
|
||||
}
|
||||
|
||||
|
|
|
@ -264,15 +264,12 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
|
|||
|
||||
static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
|
||||
static int32_t emptyRspNum = 0;
|
||||
if (code != 0) {
|
||||
taosMemoryFreeClear(param);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *key = (char *)param;
|
||||
SClientHbBatchRsp pRsp = {0};
|
||||
tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp);
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp);
|
||||
}
|
||||
|
||||
int32_t rspNum = taosArrayGetSize(pRsp.rsps);
|
||||
|
||||
taosThreadMutexLock(&appInfo.mutex);
|
||||
|
@ -288,6 +285,10 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
|
|||
|
||||
taosMemoryFreeClear(param);
|
||||
|
||||
if (code != 0) {
|
||||
(*pInst)->onlineDnodes = 0;
|
||||
}
|
||||
|
||||
if (rspNum) {
|
||||
tscDebug("hb got %d rsp, %d empty rsp received before", rspNum,
|
||||
atomic_val_compare_exchange_32(&emptyRspNum, emptyRspNum, 0));
|
||||
|
|
|
@ -148,29 +148,49 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
|
|||
return taosConnectImpl(user, &secretEncrypt[0], localDb, NULL, NULL, *pInst, connType);
|
||||
}
|
||||
|
||||
int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj** pRequest) {
|
||||
*pRequest = createRequest(pTscObj, TSDB_SQL_SELECT);
|
||||
int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param, bool validateSql, SRequestObj** pRequest) {
|
||||
*pRequest = createRequest(connId, TSDB_SQL_SELECT);
|
||||
if (*pRequest == NULL) {
|
||||
tscError("failed to malloc sqlObj");
|
||||
tscError("failed to malloc sqlObj, %s", sql);
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
(*pRequest)->sqlstr = taosMemoryMalloc(sqlLen + 1);
|
||||
if ((*pRequest)->sqlstr == NULL) {
|
||||
tscError("0x%" PRIx64 " failed to prepare sql string buffer", (*pRequest)->self);
|
||||
(*pRequest)->msgBuf = strdup("failed to prepare sql string buffer");
|
||||
tscError("0x%" PRIx64 " failed to prepare sql string buffer, %s", (*pRequest)->self, sql);
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
strntolower((*pRequest)->sqlstr, sql, (int32_t)sqlLen);
|
||||
(*pRequest)->sqlstr[sqlLen] = 0;
|
||||
(*pRequest)->sqlLen = sqlLen;
|
||||
(*pRequest)->sqlLen = sqlLen;
|
||||
(*pRequest)->validateOnly = validateSql;
|
||||
|
||||
if (param == NULL) {
|
||||
SSyncQueryParam* pParam = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
||||
if (pParam == NULL) {
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
tsem_init(&pParam->sem, 0, 0);
|
||||
pParam->pRequest = (*pRequest);
|
||||
param = pParam;
|
||||
}
|
||||
|
||||
(*pRequest)->body.param = param;
|
||||
|
||||
STscObj* pTscObj = (*pRequest)->pTscObj;
|
||||
if (taosHashPut(pTscObj->pRequests, &(*pRequest)->self, sizeof((*pRequest)->self), &(*pRequest)->self,
|
||||
sizeof((*pRequest)->self))) {
|
||||
tscError("%d failed to add to request container, reqId:0x%" PRIx64 ", conn:%d, %s", (*pRequest)->self,
|
||||
(*pRequest)->requestId, pTscObj->id, sql);
|
||||
|
||||
destroyRequest(*pRequest);
|
||||
*pRequest = NULL;
|
||||
tscError("put request to request hash failed");
|
||||
return TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -325,11 +345,13 @@ int32_t updateQnodeList(SAppInstInfo* pInfo, SArray* pNodeList) {
|
|||
if (pInfo->pQnodeList) {
|
||||
taosArrayDestroy(pInfo->pQnodeList);
|
||||
pInfo->pQnodeList = NULL;
|
||||
tscDebug("QnodeList cleared in cluster 0x%" PRIx64, pInfo->clusterId);
|
||||
}
|
||||
|
||||
if (pNodeList) {
|
||||
pInfo->pQnodeList = taosArrayDup(pNodeList);
|
||||
taosArraySort(pInfo->pQnodeList, compareQueryNodeLoad);
|
||||
tscDebug("QnodeList updated in cluster 0x%" PRIx64 ", num:%d", pInfo->clusterId, taosArrayGetSize(pInfo->pQnodeList));
|
||||
}
|
||||
taosThreadMutexUnlock(&pInfo->qnodeMutex);
|
||||
|
||||
|
@ -880,18 +902,16 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue
|
|||
return pRequest;
|
||||
}
|
||||
|
||||
SRequestObj* launchQuery(STscObj* pTscObj, const char* sql, int sqlLen, bool validateOnly) {
|
||||
SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly) {
|
||||
SRequestObj* pRequest = NULL;
|
||||
SQuery* pQuery = NULL;
|
||||
|
||||
int32_t code = buildRequest(pTscObj, sql, sqlLen, &pRequest);
|
||||
int32_t code = buildRequest(connId, sql, sqlLen, NULL, validateOnly, &pRequest);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
terrno = code;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pRequest->validateOnly = validateOnly;
|
||||
|
||||
code = parseSql(pRequest, false, &pQuery, NULL);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pRequest->code = code;
|
||||
|
@ -1042,19 +1062,20 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
SRequestObj* execQuery(STscObj* pTscObj, const char* sql, int sqlLen, bool validateOnly) {
|
||||
// todo remove it soon
|
||||
SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly) {
|
||||
SRequestObj* pRequest = NULL;
|
||||
int32_t retryNum = 0;
|
||||
int32_t code = 0;
|
||||
|
||||
do {
|
||||
destroyRequest(pRequest);
|
||||
pRequest = launchQuery(pTscObj, sql, sqlLen, validateOnly);
|
||||
pRequest = launchQuery(connId, sql, sqlLen, validateOnly);
|
||||
if (pRequest == NULL || TSDB_CODE_SUCCESS == pRequest->code || !NEED_CLIENT_HANDLE_ERROR(pRequest->code)) {
|
||||
break;
|
||||
}
|
||||
|
||||
code = refreshMeta(pTscObj, pRequest);
|
||||
code = refreshMeta(pRequest->pTscObj, pRequest);
|
||||
if (code) {
|
||||
pRequest->code = code;
|
||||
break;
|
||||
|
@ -1062,7 +1083,7 @@ SRequestObj* execQuery(STscObj* pTscObj, const char* sql, int sqlLen, bool valid
|
|||
} while (retryNum++ < REQUEST_TOTAL_EXEC_TIMES);
|
||||
|
||||
if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) {
|
||||
removeMeta(pTscObj, pRequest->tableList);
|
||||
removeMeta(pRequest->pTscObj, pRequest->tableList);
|
||||
}
|
||||
|
||||
return pRequest;
|
||||
|
@ -1117,7 +1138,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t
|
|||
return pTscObj;
|
||||
}
|
||||
|
||||
SRequestObj* pRequest = createRequest(pTscObj, TDMT_MND_CONNECT);
|
||||
SRequestObj* pRequest = createRequest(pTscObj->id, TDMT_MND_CONNECT);
|
||||
if (pRequest == NULL) {
|
||||
destroyTscObj(pTscObj);
|
||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
||||
|
@ -1298,16 +1319,16 @@ void doProcessMsgFromServer(SSchedMsg* schedMsg) {
|
|||
pSendInfo->fp(pSendInfo->param, &buf, pMsg->code);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
destroySendMsgInfo(pSendInfo);
|
||||
|
||||
taosMemoryFree(arg);
|
||||
}
|
||||
|
||||
void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
||||
SSchedMsg schedMsg = {0};
|
||||
|
||||
SEpSet* tEpSet = pEpSet != NULL ? taosMemoryCalloc(1, sizeof(SEpSet)) : NULL;
|
||||
if (tEpSet != NULL) {
|
||||
*tEpSet = *pEpSet;
|
||||
SEpSet* tEpSet = NULL;
|
||||
if (pEpSet != NULL) {
|
||||
tEpSet = taosMemoryCalloc(1, sizeof(SEpSet));
|
||||
memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet));
|
||||
}
|
||||
|
||||
SchedArg* arg = taosMemoryCalloc(1, sizeof(SchedArg));
|
||||
|
@ -1444,15 +1465,10 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU
|
|||
return NULL;
|
||||
}
|
||||
|
||||
SSyncQueryParam* pParam = pRequest->body.param;
|
||||
if (NULL == pParam) {
|
||||
pParam = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
||||
tsem_init(&pParam->sem, 0, 0);
|
||||
}
|
||||
|
||||
// convert ucs4 to native multi-bytes string
|
||||
pResultInfo->convertUcs4 = convertUcs4;
|
||||
|
||||
SSyncQueryParam* pParam = pRequest->body.param;
|
||||
taos_fetch_rows_a(pRequest, syncFetchFn, pParam);
|
||||
tsem_wait(&pParam->sem);
|
||||
}
|
||||
|
@ -2024,22 +2040,9 @@ void syncQueryFn(void* param, void* res, int32_t code) {
|
|||
tsem_post(&pParam->sem);
|
||||
}
|
||||
|
||||
void taosAsyncQueryImpl(TAOS* taos, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly) {
|
||||
if (NULL == taos) {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
fp(param, NULL, terrno);
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t rid = *(int64_t*)taos;
|
||||
STscObj* pTscObj = acquireTscObj(rid);
|
||||
if (pTscObj == NULL || sql == NULL || NULL == fp) {
|
||||
void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly) {
|
||||
if (sql == NULL || NULL == fp) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
if (pTscObj) {
|
||||
releaseTscObj(rid);
|
||||
} else {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
}
|
||||
fp(param, NULL, terrno);
|
||||
return;
|
||||
}
|
||||
|
@ -2048,26 +2051,20 @@ void taosAsyncQueryImpl(TAOS* taos, const char* sql, __taos_async_fn_t fp, void*
|
|||
if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) {
|
||||
tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN);
|
||||
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
||||
releaseTscObj(rid);
|
||||
|
||||
fp(param, NULL, terrno);
|
||||
return;
|
||||
}
|
||||
|
||||
SRequestObj* pRequest = NULL;
|
||||
int32_t code = buildRequest(pTscObj, sql, sqlLen, &pRequest);
|
||||
int32_t code = buildRequest(connId, sql, sqlLen, param, validateOnly, &pRequest);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
terrno = code;
|
||||
releaseTscObj(rid);
|
||||
fp(param, NULL, terrno);
|
||||
return;
|
||||
}
|
||||
|
||||
pRequest->validateOnly = validateOnly;
|
||||
pRequest->body.queryFp = fp;
|
||||
pRequest->body.param = param;
|
||||
doAsyncQuery(pRequest, false);
|
||||
releaseTscObj(rid);
|
||||
}
|
||||
|
||||
TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
|
||||
|
@ -2076,36 +2073,22 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int64_t rid = *(int64_t*)taos;
|
||||
STscObj* pTscObj = acquireTscObj(rid);
|
||||
if (pTscObj == NULL || sql == NULL) {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if SYNC_ON_TOP_OF_ASYNC
|
||||
SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam));
|
||||
tsem_init(¶m->sem, 0, 0);
|
||||
|
||||
taosAsyncQueryImpl((TAOS*)&rid, sql, syncQueryFn, param, validateOnly);
|
||||
taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly);
|
||||
tsem_wait(¶m->sem);
|
||||
|
||||
releaseTscObj(rid);
|
||||
|
||||
return param->pRequest;
|
||||
#else
|
||||
size_t sqlLen = strlen(sql);
|
||||
if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) {
|
||||
releaseTscObj(rid);
|
||||
tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN);
|
||||
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TAOS_RES* pRes = execQuery(pTscObj, sql, sqlLen, validateOnly);
|
||||
|
||||
releaseTscObj(rid);
|
||||
|
||||
TAOS_RES* pRes = execQuery(connId, sql, sqlLen, validateOnly);
|
||||
return pRes;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -479,7 +479,6 @@ void taos_stop_query(TAOS_RES *res) {
|
|||
}
|
||||
|
||||
schedulerFreeJob(&pRequest->body.queryJob, TSDB_CODE_TSC_QUERY_KILLED);
|
||||
|
||||
tscDebug("request %" PRIx64 " killed", pRequest->requestId);
|
||||
}
|
||||
|
||||
|
@ -706,7 +705,8 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
|
|||
}
|
||||
|
||||
void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param) {
|
||||
taosAsyncQueryImpl(taos, sql, fp, param, false);
|
||||
int64_t connId = *(int64_t*)taos;
|
||||
taosAsyncQueryImpl(connId, sql, fp, param, false);
|
||||
}
|
||||
|
||||
int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
|
||||
|
@ -915,7 +915,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
|||
return terrno;
|
||||
}
|
||||
|
||||
int64_t rid = *(int64_t *)taos;
|
||||
int64_t connId = *(int64_t *)taos;
|
||||
const int32_t MAX_TABLE_NAME_LENGTH = 12 * 1024 * 1024; // 12MB list
|
||||
int32_t code = 0;
|
||||
SRequestObj * pRequest = NULL;
|
||||
|
@ -933,12 +933,14 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
|||
return TSDB_CODE_TSC_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
STscObj *pTscObj = acquireTscObj(rid);
|
||||
if (pTscObj == NULL) {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
return terrno;
|
||||
char *sql = "taos_load_table_info";
|
||||
code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
terrno = code;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
STscObj* pTscObj = pRequest->pTscObj;
|
||||
code = transferTableNameList(tableNameList, pTscObj->acctId, pTscObj->db, &catalogReq.pTableMeta);
|
||||
if (code) {
|
||||
goto _return;
|
||||
|
@ -950,36 +952,22 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
|
|||
goto _return;
|
||||
}
|
||||
|
||||
char *sql = "taos_load_table_info";
|
||||
code = buildRequest(pTscObj, sql, strlen(sql), &pRequest);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
terrno = code;
|
||||
goto _return;
|
||||
}
|
||||
|
||||
SSyncQueryParam param = {0};
|
||||
tsem_init(¶m.sem, 0, 0);
|
||||
param.pRequest = pRequest;
|
||||
|
||||
SRequestConnInfo conn = {
|
||||
.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self};
|
||||
|
||||
conn.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
|
||||
|
||||
code = catalogAsyncGetAllMeta(pCtg, &conn, &catalogReq, syncCatalogFn, ¶m, NULL);
|
||||
code = catalogAsyncGetAllMeta(pCtg, &conn, &catalogReq, syncCatalogFn, NULL, NULL);
|
||||
if (code) {
|
||||
goto _return;
|
||||
}
|
||||
|
||||
tsem_wait(¶m.sem);
|
||||
SSyncQueryParam* pParam = pRequest->body.param;
|
||||
tsem_wait(&pParam->sem);
|
||||
|
||||
_return:
|
||||
|
||||
taosArrayDestroy(catalogReq.pTableMeta);
|
||||
destroyRequest(pRequest);
|
||||
|
||||
releaseTscObj(rid);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -1570,41 +1570,40 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV
|
|||
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
|
||||
}
|
||||
|
||||
*tsVal = timeDouble;
|
||||
size_t typeLen = strlen(type->valuestring);
|
||||
if (typeLen == 1 && (type->valuestring[0] == 's' || type->valuestring[0] == 'S')) {
|
||||
// seconds
|
||||
timeDouble = timeDouble * 1e9;
|
||||
*tsVal = *tsVal * NANOSECOND_PER_SEC;
|
||||
timeDouble = timeDouble * NANOSECOND_PER_SEC;
|
||||
if (smlDoubleToInt64OverFlow(timeDouble)) {
|
||||
smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL);
|
||||
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
|
||||
}
|
||||
*tsVal = timeDouble;
|
||||
} else if (typeLen == 2 && (type->valuestring[1] == 's' || type->valuestring[1] == 'S')) {
|
||||
switch (type->valuestring[0]) {
|
||||
case 'm':
|
||||
case 'M':
|
||||
// milliseconds
|
||||
timeDouble = timeDouble * 1e6;
|
||||
*tsVal = *tsVal * NANOSECOND_PER_MSEC;
|
||||
timeDouble = timeDouble * NANOSECOND_PER_MSEC;
|
||||
if (smlDoubleToInt64OverFlow(timeDouble)) {
|
||||
smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL);
|
||||
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
|
||||
}
|
||||
*tsVal = timeDouble;
|
||||
break;
|
||||
case 'u':
|
||||
case 'U':
|
||||
// microseconds
|
||||
timeDouble = timeDouble * 1e3;
|
||||
*tsVal = *tsVal * NANOSECOND_PER_USEC;
|
||||
timeDouble = timeDouble * NANOSECOND_PER_USEC;
|
||||
if (smlDoubleToInt64OverFlow(timeDouble)) {
|
||||
smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL);
|
||||
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
|
||||
}
|
||||
*tsVal = timeDouble;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
// nanoseconds
|
||||
*tsVal = timeDouble;
|
||||
break;
|
||||
default:
|
||||
return TSDB_CODE_TSC_INVALID_JSON;
|
||||
|
@ -1641,21 +1640,23 @@ static int32_t smlParseTSFromJSON(SSmlHandle *info, cJSON *root, SArray *cols) {
|
|||
if (timeDouble < 0) {
|
||||
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
|
||||
}
|
||||
|
||||
uint8_t tsLen = smlGetTimestampLen((int64_t)timeDouble);
|
||||
tsVal = (int64_t)timeDouble;
|
||||
if (tsLen == TSDB_TIME_PRECISION_SEC_DIGITS) {
|
||||
timeDouble = timeDouble * 1e9;
|
||||
tsVal = tsVal * NANOSECOND_PER_SEC;
|
||||
timeDouble = timeDouble * NANOSECOND_PER_SEC;
|
||||
if (smlDoubleToInt64OverFlow(timeDouble)) {
|
||||
smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL);
|
||||
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
|
||||
}
|
||||
tsVal = timeDouble;
|
||||
} else if (tsLen == TSDB_TIME_PRECISION_MILLI_DIGITS) {
|
||||
timeDouble = timeDouble * 1e6;
|
||||
tsVal = tsVal * NANOSECOND_PER_MSEC;
|
||||
timeDouble = timeDouble * NANOSECOND_PER_MSEC;
|
||||
if (smlDoubleToInt64OverFlow(timeDouble)) {
|
||||
smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL);
|
||||
return TSDB_CODE_TSC_INVALID_TIME_STAMP;
|
||||
}
|
||||
tsVal = timeDouble;
|
||||
} else if (timeDouble == 0) {
|
||||
tsVal = taosGetTimestampNs();
|
||||
} else {
|
||||
|
@ -2441,22 +2442,15 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int64_t rid = *(int64_t*)taos;
|
||||
STscObj* pTscObj = acquireTscObj(rid);
|
||||
if (NULL == pTscObj) {
|
||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||
uError("SML:taos_schemaless_insert invalid taos");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SRequestObj* request = (SRequestObj*)createRequest(pTscObj, TSDB_SQL_INSERT);
|
||||
SRequestObj* request = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT);
|
||||
if(!request){
|
||||
releaseTscObj(rid);
|
||||
uError("SML:taos_schemaless_insert error request is null");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int batchs = 0;
|
||||
STscObj* pTscObj = request->pTscObj;
|
||||
|
||||
pTscObj->schemalessType = 1;
|
||||
SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf};
|
||||
|
||||
|
@ -2506,7 +2500,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
|
|||
|
||||
batchs = ceil(((double)numLines) / LINE_BATCH);
|
||||
for (int i = 0; i < batchs; ++i) {
|
||||
SRequestObj* req = (SRequestObj*)createRequest(pTscObj, TSDB_SQL_INSERT);
|
||||
SRequestObj* req = (SRequestObj*)createRequest(pTscObj->id, TSDB_SQL_INSERT);
|
||||
if(!req){
|
||||
request->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
uError("SML:taos_schemaless_insert error request is null");
|
||||
|
@ -2548,6 +2542,5 @@ end:
|
|||
// ((STscObj *)taos)->schemalessType = 0;
|
||||
pTscObj->schemalessType = 1;
|
||||
uDebug("resultend:%s", request->msgBuf);
|
||||
releaseTscObj(rid);
|
||||
return (TAOS_RES*)request;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,14 @@
|
|||
|
||||
#include "clientStmt.h"
|
||||
|
||||
static int32_t stmtCreateRequest(STscStmt* pStmt) {
|
||||
if (pStmt->exec.pRequest == NULL) {
|
||||
return buildRequest(pStmt->taos->id, pStmt->sql.sqlStr, pStmt->sql.sqlLen, NULL, false, &pStmt->exec.pRequest);
|
||||
} else {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
|
||||
int32_t code = 0;
|
||||
|
||||
|
@ -217,9 +225,7 @@ int32_t stmtParseSql(STscStmt* pStmt) {
|
|||
.getExecInfoFn = stmtGetExecInfo,
|
||||
};
|
||||
|
||||
if (NULL == pStmt->exec.pRequest) {
|
||||
STMT_ERR_RET(buildRequest(pStmt->taos, pStmt->sql.sqlStr, pStmt->sql.sqlLen, &pStmt->exec.pRequest));
|
||||
}
|
||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
||||
|
||||
STMT_ERR_RET(parseSql(pStmt->exec.pRequest, false, &pStmt->sql.pQuery, &stmtCb));
|
||||
|
||||
|
@ -532,9 +538,7 @@ int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
|
|||
STMT_ERR_RET(TSDB_CODE_TSC_STMT_API_ERROR);
|
||||
}
|
||||
|
||||
if (NULL == pStmt->exec.pRequest) {
|
||||
STMT_ERR_RET(buildRequest(pStmt->taos, pStmt->sql.sqlStr, pStmt->sql.sqlLen, &pStmt->exec.pRequest));
|
||||
}
|
||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
||||
|
||||
STMT_ERR_RET(qCreateSName(&pStmt->bInfo.sname, tbName, pStmt->taos->acctId, pStmt->exec.pRequest->pDb,
|
||||
pStmt->exec.pRequest->msgBuf, pStmt->exec.pRequest->msgBufLen));
|
||||
|
@ -625,9 +629,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
|
|||
pStmt->exec.pRequest = NULL;
|
||||
}
|
||||
|
||||
if (NULL == pStmt->exec.pRequest) {
|
||||
STMT_ERR_RET(buildRequest(pStmt->taos, pStmt->sql.sqlStr, pStmt->sql.sqlLen, &pStmt->exec.pRequest));
|
||||
}
|
||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
||||
|
||||
if (pStmt->bInfo.needParse) {
|
||||
STMT_ERR_RET(stmtParseSql(pStmt));
|
||||
|
@ -873,9 +875,7 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
|||
pStmt->exec.pRequest = NULL;
|
||||
}
|
||||
|
||||
if (NULL == pStmt->exec.pRequest) {
|
||||
STMT_ERR_RET(buildRequest(pStmt->taos, pStmt->sql.sqlStr, pStmt->sql.sqlLen, &pStmt->exec.pRequest));
|
||||
}
|
||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
||||
|
||||
if (pStmt->bInfo.needParse) {
|
||||
STMT_ERR_RET(stmtParseSql(pStmt));
|
||||
|
@ -905,9 +905,7 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
|
|||
pStmt->exec.pRequest = NULL;
|
||||
}
|
||||
|
||||
if (NULL == pStmt->exec.pRequest) {
|
||||
STMT_ERR_RET(buildRequest(pStmt->taos, pStmt->sql.sqlStr, pStmt->sql.sqlLen, &pStmt->exec.pRequest));
|
||||
}
|
||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
||||
|
||||
if (pStmt->bInfo.needParse) {
|
||||
STMT_ERR_RET(stmtParseSql(pStmt));
|
||||
|
@ -933,10 +931,7 @@ int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
|
|||
pStmt->exec.pRequest = NULL;
|
||||
}
|
||||
|
||||
if (NULL == pStmt->exec.pRequest) {
|
||||
STMT_ERR_RET(buildRequest(pStmt->taos, pStmt->sql.sqlStr, pStmt->sql.sqlLen, &pStmt->exec.pRequest));
|
||||
}
|
||||
|
||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
||||
if (pStmt->bInfo.needParse) {
|
||||
STMT_ERR_RET(stmtParseSql(pStmt));
|
||||
}
|
||||
|
@ -969,9 +964,7 @@ int stmtGetParam(TAOS_STMT* stmt, int idx, int* type, int* bytes) {
|
|||
pStmt->exec.pRequest = NULL;
|
||||
}
|
||||
|
||||
if (NULL == pStmt->exec.pRequest) {
|
||||
STMT_ERR_RET(buildRequest(pStmt->taos, pStmt->sql.sqlStr, pStmt->sql.sqlLen, &pStmt->exec.pRequest));
|
||||
}
|
||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
||||
|
||||
if (pStmt->bInfo.needParse) {
|
||||
STMT_ERR_RET(stmtParseSql(pStmt));
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -750,7 +750,6 @@ TEST(testCase, projection_query_stables) {
|
|||
taos_close(pConn);
|
||||
}
|
||||
|
||||
|
||||
TEST(testCase, agg_query_tables) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(pConn, nullptr);
|
||||
|
@ -763,7 +762,7 @@ TEST(testCase, agg_query_tables) {
|
|||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "show table distributed st1");
|
||||
pRes = taos_query(pConn, "show table distributed tup");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
|
||||
taos_free_result(pRes);
|
||||
|
@ -822,13 +821,29 @@ TEST(testCase, async_api_test) {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
TEST(testCase, update_test) {
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(pConn, nullptr);
|
||||
|
||||
taos_query(pConn, "use abc1");
|
||||
TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1");
|
||||
if (taos_errno(pRes) != TSDB_CODE_SUCCESS) {
|
||||
printf("failed to create database, code:%s", taos_errstr(pRes));
|
||||
taos_free_result(pRes);
|
||||
return;
|
||||
}
|
||||
|
||||
TAOS_RES* pRes = taos_query(pConn, "create table tup (ts timestamp, k int);");
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "use abc1");
|
||||
if (taos_errno(pRes) != TSDB_CODE_SUCCESS) {
|
||||
printf("failed to use db, code:%s", taos_errstr(pRes));
|
||||
taos_free_result(pRes);
|
||||
return;
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table tup (ts timestamp, k int);");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
printf("failed to create table, reason:%s", taos_errstr(pRes));
|
||||
}
|
||||
|
@ -836,11 +851,10 @@ TEST(testCase, update_test) {
|
|||
taos_free_result(pRes);
|
||||
|
||||
char s[256] = {0};
|
||||
for(int32_t i = 0; i < 7000; ++i) {
|
||||
sprintf(s, "insert into tup values('2020-1-1 1:1:1', %d)", i);
|
||||
for(int32_t i = 0; i < 17000; ++i) {
|
||||
sprintf(s, "insert into tup values(now+%da, %d)", i, i);
|
||||
pRes = taos_query(pConn, s);
|
||||
taos_free_result(pRes);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
|
@ -1284,4 +1284,210 @@ TEST(testCase, sml_dup_time_Test) {
|
|||
ASSERT_EQ(taos_errno(pRes), 0);
|
||||
taos_free_result(pRes);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
TEST(testCase, sml_16960_Test) {
|
||||
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(taos, nullptr);
|
||||
|
||||
TAOS_RES* pRes = taos_query(taos, "create database if not exists d16368 schemaless 1");
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(taos, "use d16368");
|
||||
taos_free_result(pRes);
|
||||
|
||||
const char *sql[] = {
|
||||
"[\n"
|
||||
"{\n"
|
||||
"\"timestamp\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 1349020800000, \"type\": \"ms\" }\n"
|
||||
",\n"
|
||||
"\"value\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 830525384, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"tags\": {\n"
|
||||
"\"id\": \"stb00_0\",\n"
|
||||
"\"t0\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 83972721, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t1\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 539147525, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t2\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 618258572, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t3\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -10536201, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t4\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 349227409, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t5\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 249347042, \"type\": \"int\" }\n"
|
||||
"},\n"
|
||||
"\"metric\": \"stb0\"\n"
|
||||
"},\n"
|
||||
"{\n"
|
||||
"\"timestamp\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 1349020800001, \"type\": \"ms\" }\n"
|
||||
",\n"
|
||||
"\"value\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -588348364, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"tags\": {\n"
|
||||
"\"id\": \"stb00_0\",\n"
|
||||
"\"t0\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 83972721, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t1\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 539147525, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t2\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 618258572, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t3\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -10536201, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t4\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 349227409, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t5\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 249347042, \"type\": \"int\" }\n"
|
||||
"},\n"
|
||||
"\"metric\": \"stb0\"\n"
|
||||
"},\n"
|
||||
"{\n"
|
||||
"\"timestamp\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 1349020800002, \"type\": \"ms\" }\n"
|
||||
",\n"
|
||||
"\"value\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -370310823, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"tags\": {\n"
|
||||
"\"id\": \"stb00_0\",\n"
|
||||
"\"t0\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 83972721, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t1\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 539147525, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t2\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 618258572, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t3\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -10536201, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t4\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 349227409, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t5\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 249347042, \"type\": \"int\" }\n"
|
||||
"},\n"
|
||||
"\"metric\": \"stb0\"\n"
|
||||
"},\n"
|
||||
"{\n"
|
||||
"\"timestamp\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 1349020800003, \"type\": \"ms\" }\n"
|
||||
",\n"
|
||||
"\"value\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -811250191, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"tags\": {\n"
|
||||
"\"id\": \"stb00_0\",\n"
|
||||
"\"t0\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 83972721, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t1\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 539147525, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t2\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 618258572, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t3\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -10536201, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t4\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 349227409, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t5\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 249347042, \"type\": \"int\" }\n"
|
||||
"},\n"
|
||||
"\"metric\": \"stb0\"\n"
|
||||
"},\n"
|
||||
"{\n"
|
||||
"\"timestamp\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 1349020800004, \"type\": \"ms\" }\n"
|
||||
",\n"
|
||||
"\"value\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -330340558, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"tags\": {\n"
|
||||
"\"id\": \"stb00_0\",\n"
|
||||
"\"t0\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 83972721, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t1\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 539147525, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t2\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 618258572, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t3\":\n"
|
||||
"\n"
|
||||
"{ \"value\": -10536201, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t4\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 349227409, \"type\": \"int\" }\n"
|
||||
",\n"
|
||||
"\"t5\":\n"
|
||||
"\n"
|
||||
"{ \"value\": 249347042, \"type\": \"int\" }\n"
|
||||
"},\n"
|
||||
"\"metric\": \"stb0\"\n"
|
||||
"}\n"
|
||||
"]"
|
||||
};
|
||||
|
||||
pRes = taos_schemaless_insert(taos, (char**)sql, sizeof(sql)/sizeof(sql[0]), TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS);
|
||||
ASSERT_EQ(taos_errno(pRes), 0);
|
||||
taos_free_result(pRes);
|
||||
}
|
||||
*/
|
|
@ -252,7 +252,7 @@ static const SSysTableMeta infosMeta[] = {
|
|||
{TSDB_INS_TABLE_USER_STABLES, userStbsSchema, tListLen(userStbsSchema)},
|
||||
{TSDB_PERFS_TABLE_STREAMS, streamSchema, tListLen(streamSchema)},
|
||||
{TSDB_INS_TABLE_USER_TABLES, userTblsSchema, tListLen(userTblsSchema)},
|
||||
{TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
|
||||
// {TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
|
||||
{TSDB_INS_TABLE_USER_USERS, userUsersSchema, tListLen(userUsersSchema)},
|
||||
{TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema)},
|
||||
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema)},
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
|
@ -228,7 +228,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, ui
|
|||
uint32_t finalNumOfRows = numOfRow1 + numOfRow2;
|
||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||
// Handle the bitmap
|
||||
if (finalNumOfRows > *capacity) {
|
||||
if (finalNumOfRows > *capacity || numOfRow1 == 0) {
|
||||
char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2));
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -262,7 +262,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, ui
|
|||
memcpy(pColumnInfoData->pData + oldLen, pSource->pData, len);
|
||||
pColumnInfoData->varmeta.length = len + oldLen;
|
||||
} else {
|
||||
if (finalNumOfRows > *capacity) {
|
||||
if (finalNumOfRows > *capacity || numOfRow1 == 0) {
|
||||
ASSERT(finalNumOfRows * pColumnInfoData->info.bytes);
|
||||
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, finalNumOfRows * pColumnInfoData->info.bytes);
|
||||
if (tmp == NULL) {
|
||||
|
@ -463,6 +463,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
|
|||
|
||||
pDst->info = pBlock->info;
|
||||
pDst->info.rows = 0;
|
||||
pDst->info.capacity = 0;
|
||||
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
SColumnInfoData colInfo = {0};
|
||||
|
@ -1356,7 +1357,7 @@ SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId)
|
|||
return col;
|
||||
}
|
||||
|
||||
SColumnInfoData* bdGetColumnInfoData(SSDataBlock* pBlock, int32_t index) {
|
||||
SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index) {
|
||||
ASSERT(pBlock != NULL);
|
||||
if (index >= taosArrayGetSize(pBlock->pDataBlock)) {
|
||||
return NULL;
|
||||
|
@ -1735,43 +1736,56 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
|
|||
int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||
int32_t rows = pDataBlock->info.rows;
|
||||
int32_t len = 0;
|
||||
len += snprintf(dumpBuf + len, size - len, "\n%s |block type %d |child id %d|group id %lu|\n", flag,
|
||||
len += snprintf(dumpBuf + len, size - len, "\n%s |block type %d |child id %d|group id:%" PRIu64 "|\n", flag,
|
||||
(int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId);
|
||||
if (len >= size - 1) return dumpBuf;
|
||||
|
||||
for (int32_t j = 0; j < rows; j++) {
|
||||
len += snprintf(dumpBuf + len, size - len, "%s |", flag);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
|
||||
for (int32_t k = 0; k < colNum; k++) {
|
||||
SColumnInfoData* pColInfoData = taosArrayGet(pDataBlock->pDataBlock, k);
|
||||
void* var = POINTER_SHIFT(pColInfoData->pData, j * pColInfoData->info.bytes);
|
||||
if (colDataIsNull(pColInfoData, rows, j, NULL)) {
|
||||
if (colDataIsNull(pColInfoData, rows, j, NULL) || !var) {
|
||||
len += snprintf(dumpBuf + len, size - len, " %15s |", "NULL");
|
||||
if (len >= size -1) return dumpBuf;
|
||||
continue;
|
||||
}
|
||||
switch (pColInfoData->info.type) {
|
||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI);
|
||||
len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_INT:
|
||||
len += snprintf(dumpBuf + len, size - len, " %15d |", *(int32_t*)var);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UINT:
|
||||
len += snprintf(dumpBuf + len, size - len, " %15u |", *(uint32_t*)var);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_BIGINT:
|
||||
len += snprintf(dumpBuf + len, size - len, " %15ld |", *(int64_t*)var);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
len += snprintf(dumpBuf + len, size - len, " %15lu |", *(uint64_t*)var);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_FLOAT:
|
||||
len += snprintf(dumpBuf + len, size - len, " %15f |", *(float*)var);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_DOUBLE:
|
||||
len += snprintf(dumpBuf + len, size - len, " %15lf |", *(double*)var);
|
||||
if (len >= size -1) return dumpBuf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
len += snprintf(dumpBuf + len, size - len, "\n");
|
||||
if (len >= size -1) return dumpBuf;
|
||||
}
|
||||
len += snprintf(dumpBuf + len, size - len, "%s |end\n", flag);
|
||||
return dumpBuf;
|
||||
|
@ -2106,3 +2120,4 @@ const char* blockDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t numOfRow
|
|||
ASSERT(pStart - pData == dataLen);
|
||||
return pStart;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ int32_t tsNumOfMnodeQueryThreads = 2;
|
|||
int32_t tsNumOfMnodeFetchThreads = 1;
|
||||
int32_t tsNumOfMnodeReadThreads = 1;
|
||||
int32_t tsNumOfVnodeQueryThreads = 2;
|
||||
int32_t tsNumOfVnodeFetchThreads = 1;
|
||||
int32_t tsNumOfVnodeFetchThreads = 4;
|
||||
int32_t tsNumOfVnodeWriteThreads = 2;
|
||||
int32_t tsNumOfVnodeSyncThreads = 2;
|
||||
int32_t tsNumOfVnodeMergeThreads = 2;
|
||||
|
@ -191,7 +191,6 @@ int32_t tsTtlUnit = 86400;
|
|||
int32_t tsTtlPushInterval = 60;
|
||||
int32_t tsGrantHBInterval = 60;
|
||||
|
||||
|
||||
void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary) {
|
||||
tstrncpy(tsDiskCfg[index].dir, v1, TSDB_FILENAME_LEN);
|
||||
tsDiskCfg[index].level = level;
|
||||
|
@ -293,15 +292,14 @@ int32_t taosAddClientLogCfg(SConfig *pCfg) {
|
|||
if (cfgAddInt32(pCfg, "numOfLogLines", tsNumOfLogLines, 1000, 2000000000, 1) != 0) return -1;
|
||||
if (cfgAddBool(pCfg, "asyncLog", tsAsyncLog, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "logKeepDays", 0, -365000, 365000, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "cDebugFlag", cDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "debugFlag", 0, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "simDebugFlag", 143, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "tmrDebugFlag", tmrDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "uDebugFlag", uDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "rpcDebugFlag", rpcDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "qDebugFlag", qDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "tmrDebugFlag", tmrDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "jniDebugFlag", jniDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "simDebugFlag", 143, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "debugFlag", 0, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "idxDebugFlag", idxDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "qDebugFlag", qDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "cDebugFlag", cDebugFlag, 0, 255, 1) != 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -309,13 +307,12 @@ static int32_t taosAddServerLogCfg(SConfig *pCfg) {
|
|||
if (cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "vDebugFlag", vDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "mDebugFlag", mDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "qDebugFlag", qDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "wDebugFlag", wDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "sDebugFlag", sDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "tsdbDebugFlag", tsdbDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "tqDebugFlag", tqDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "fsDebugFlag", fsDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "fnDebugFlag", fnDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "udfDebugFlag", udfDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "smaDebugFlag", smaDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "idxDebugFlag", idxDebugFlag, 0, 255, 0) != 0) return -1;
|
||||
return 0;
|
||||
|
@ -419,7 +416,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
|||
if (cfgAddInt32(pCfg, "numOfMnodeReadThreads", tsNumOfMnodeReadThreads, 1, 1024, 0) != 0) return -1;
|
||||
|
||||
tsNumOfVnodeQueryThreads = tsNumOfCores / 2;
|
||||
tsNumOfVnodeQueryThreads = TMAX(tsNumOfVnodeQueryThreads, 1);
|
||||
tsNumOfVnodeQueryThreads = TMAX(tsNumOfVnodeQueryThreads, 2);
|
||||
if (cfgAddInt32(pCfg, "numOfVnodeQueryThreads", tsNumOfVnodeQueryThreads, 1, 1024, 0) != 0) return -1;
|
||||
|
||||
tsNumOfVnodeFetchThreads = TRANGE(tsNumOfVnodeFetchThreads, 1, 1);
|
||||
|
@ -471,7 +468,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
|||
|
||||
if (cfgAddInt32(pCfg, "transPullupInterval", tsTransPullupInterval, 1, 10000, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "mqRebalanceInterval", tsMqRebalanceInterval, 1, 10000, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400*365, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "ttlUnit", tsTtlUnit, 1, 86400 * 365, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "ttlPushInterval", tsTtlPushInterval, 1, 10000, 1) != 0) return -1;
|
||||
|
||||
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
|
||||
|
@ -486,26 +483,24 @@ static void taosSetClientLogCfg(SConfig *pCfg) {
|
|||
tsNumOfLogLines = cfgGetItem(pCfg, "numOfLogLines")->i32;
|
||||
tsAsyncLog = cfgGetItem(pCfg, "asyncLog")->bval;
|
||||
tsLogKeepDays = cfgGetItem(pCfg, "logKeepDays")->i32;
|
||||
cDebugFlag = cfgGetItem(pCfg, "cDebugFlag")->i32;
|
||||
uDebugFlag = cfgGetItem(pCfg, "uDebugFlag")->i32;
|
||||
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
|
||||
rpcDebugFlag = cfgGetItem(pCfg, "rpcDebugFlag")->i32;
|
||||
tmrDebugFlag = cfgGetItem(pCfg, "tmrDebugFlag")->i32;
|
||||
uDebugFlag = cfgGetItem(pCfg, "uDebugFlag")->i32;
|
||||
jniDebugFlag = cfgGetItem(pCfg, "jniDebugFlag")->i32;
|
||||
idxDebugFlag = cfgGetItem(pCfg, "idxDebugFlag")->i32;
|
||||
rpcDebugFlag = cfgGetItem(pCfg, "rpcDebugFlag")->i32;
|
||||
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
|
||||
cDebugFlag = cfgGetItem(pCfg, "cDebugFlag")->i32;
|
||||
}
|
||||
|
||||
static void taosSetServerLogCfg(SConfig *pCfg) {
|
||||
dDebugFlag = cfgGetItem(pCfg, "dDebugFlag")->i32;
|
||||
vDebugFlag = cfgGetItem(pCfg, "vDebugFlag")->i32;
|
||||
mDebugFlag = cfgGetItem(pCfg, "mDebugFlag")->i32;
|
||||
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
|
||||
wDebugFlag = cfgGetItem(pCfg, "wDebugFlag")->i32;
|
||||
sDebugFlag = cfgGetItem(pCfg, "sDebugFlag")->i32;
|
||||
tsdbDebugFlag = cfgGetItem(pCfg, "tsdbDebugFlag")->i32;
|
||||
tqDebugFlag = cfgGetItem(pCfg, "tqDebugFlag")->i32;
|
||||
fsDebugFlag = cfgGetItem(pCfg, "fsDebugFlag")->i32;
|
||||
fnDebugFlag = cfgGetItem(pCfg, "fnDebugFlag")->i32;
|
||||
udfDebugFlag = cfgGetItem(pCfg, "udfDebugFlag")->i32;
|
||||
smaDebugFlag = cfgGetItem(pCfg, "smaDebugFlag")->i32;
|
||||
idxDebugFlag = cfgGetItem(pCfg, "idxDebugFlag")->i32;
|
||||
}
|
||||
|
@ -637,7 +632,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
||||
int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
||||
int32_t len = strlen(name);
|
||||
char lowcaseName[CFG_NAME_MAX_LEN + 1] = {0};
|
||||
strntolower(lowcaseName, name, TMIN(CFG_NAME_MAX_LEN, len));
|
||||
|
@ -667,7 +662,7 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
tsCompressColData = cfgGetItem(pCfg, "compressColData")->i32;
|
||||
} else if (strcasecmp("countAlwaysReturnValue", name) == 0) {
|
||||
tsCountAlwaysReturnValue = cfgGetItem(pCfg, "countAlwaysReturnValue")->i32;
|
||||
} else if (strcasecmp("cDebugFlag", name) == 0) {
|
||||
} else if (strcasecmp("cDebugFlag", name) == 0) {
|
||||
cDebugFlag = cfgGetItem(pCfg, "cDebugFlag")->i32;
|
||||
}
|
||||
break;
|
||||
|
@ -692,10 +687,10 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
tstrncpy(tsLocalFqdn, cfgGetItem(pCfg, "fqdn")->str, TSDB_FQDN_LEN);
|
||||
tsServerPort = (uint16_t)cfgGetItem(pCfg, "serverPort")->i32;
|
||||
snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
|
||||
|
||||
char defaultFirstEp[TSDB_EP_LEN] = {0};
|
||||
snprintf(defaultFirstEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
|
||||
|
||||
SConfigItem *pFirstEpItem = cfgGetItem(pCfg, "firstEp");
|
||||
SEp firstEp = {0};
|
||||
taosGetFqdnPortFromEp(strlen(pFirstEpItem->str) == 0 ? defaultFirstEp : pFirstEpItem->str, &firstEp);
|
||||
|
@ -705,10 +700,10 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
tstrncpy(tsLocalFqdn, cfgGetItem(pCfg, "fqdn")->str, TSDB_FQDN_LEN);
|
||||
tsServerPort = (uint16_t)cfgGetItem(pCfg, "serverPort")->i32;
|
||||
snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
|
||||
|
||||
char defaultFirstEp[TSDB_EP_LEN] = {0};
|
||||
snprintf(defaultFirstEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
|
||||
|
||||
SConfigItem *pFirstEpItem = cfgGetItem(pCfg, "firstEp");
|
||||
SEp firstEp = {0};
|
||||
taosGetFqdnPortFromEp(strlen(pFirstEpItem->str) == 0 ? defaultFirstEp : pFirstEpItem->str, &firstEp);
|
||||
|
@ -716,8 +711,6 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
cfgSetItem(pCfg, "firstEp", tsFirst, pFirstEpItem->stype);
|
||||
} else if (strcasecmp("fsDebugFlag", name) == 0) {
|
||||
fsDebugFlag = cfgGetItem(pCfg, "fsDebugFlag")->i32;
|
||||
} else if (strcasecmp("fnDebugFlag", name) == 0) {
|
||||
fnDebugFlag = cfgGetItem(pCfg, "fnDebugFlag")->i32;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -781,7 +774,7 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
} else if (strcasecmp("minSlidingTime", name) == 0) {
|
||||
tsMinSlidingTime = cfgGetItem(pCfg, "minSlidingTime")->i32;
|
||||
} else if (strcasecmp("minIntervalTime", name) == 0) {
|
||||
tsMinIntervalTime = cfgGetItem(pCfg, "minIntervalTime")->i32;
|
||||
tsMinIntervalTime = cfgGetItem(pCfg, "minIntervalTime")->i32;
|
||||
} else if (strcasecmp("minimalLogDirGB", name) == 0) {
|
||||
tsLogSpace.reserved = cfgGetItem(pCfg, "minimalLogDirGB")->fval;
|
||||
}
|
||||
|
@ -818,6 +811,8 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
case 'u': {
|
||||
if (strcasecmp("multiProcess", name) == 0) {
|
||||
tsMultiProcess = cfgGetItem(pCfg, "multiProcess")->bval;
|
||||
} else if (strcasecmp("udfDebugFlag", name) == 0) {
|
||||
udfDebugFlag = cfgGetItem(pCfg, "udfDebugFlag")->i32;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -925,10 +920,10 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
tstrncpy(tsLocalFqdn, cfgGetItem(pCfg, "fqdn")->str, TSDB_FQDN_LEN);
|
||||
tsServerPort = (uint16_t)cfgGetItem(pCfg, "serverPort")->i32;
|
||||
snprintf(tsLocalEp, sizeof(tsLocalEp), "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
|
||||
|
||||
char defaultFirstEp[TSDB_EP_LEN] = {0};
|
||||
snprintf(defaultFirstEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
|
||||
|
||||
|
||||
SConfigItem *pFirstEpItem = cfgGetItem(pCfg, "firstEp");
|
||||
SEp firstEp = {0};
|
||||
taosGetFqdnPortFromEp(strlen(pFirstEpItem->str) == 0 ? defaultFirstEp : pFirstEpItem->str, &firstEp);
|
||||
|
@ -1000,14 +995,13 @@ int32_t taosSetCfg(SConfig *pCfg, char* name) {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
terrno = TSDB_CODE_CFG_NOT_FOUND;
|
||||
terrno = TSDB_CODE_CFG_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
|
||||
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc) {
|
||||
if (tsCfg == NULL) osDefaultInit();
|
||||
|
|
|
@ -381,9 +381,11 @@ static int32_t tDeserializeSClientHbRsp(SDecoder *pDecoder, SClientHbRsp *pRsp)
|
|||
if (pQnodeNum > 0) {
|
||||
pRsp->query->pQnodeList = taosArrayInit(pQnodeNum, sizeof(SQueryNodeLoad));
|
||||
if (NULL == pRsp->query->pQnodeList) return -1;
|
||||
SQueryNodeLoad load = {0};
|
||||
if (tDecodeSQueryNodeLoad(pDecoder, &load) < 0) return -1;
|
||||
taosArrayPush(pRsp->query->pQnodeList, &load);
|
||||
for (int32_t i = 0; i < pQnodeNum; ++i) {
|
||||
SQueryNodeLoad load = {0};
|
||||
if (tDecodeSQueryNodeLoad(pDecoder, &load) < 0) return -1;
|
||||
taosArrayPush(pRsp->query->pQnodeList, &load);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -496,11 +498,18 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq
|
|||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->igExists) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->source) < 0) return -1;
|
||||
for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) {
|
||||
if (tEncodeI8(&encoder, pReq->reserved[i]) < 0) return -1;
|
||||
}
|
||||
if (tEncodeI64(&encoder, pReq->suid) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pReq->delay1) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pReq->delay2) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pReq->watermark1) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pReq->watermark2) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->colVer) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->tagVer) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->numOfColumns) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->numOfTags) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->numOfFuncs) < 0) return -1;
|
||||
|
@ -553,11 +562,18 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
|
|||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pReq->igExists) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pReq->source) < 0) return -1;
|
||||
for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) {
|
||||
if (tDecodeI8(&decoder, &pReq->reserved[i]) < 0) return -1;
|
||||
}
|
||||
if (tDecodeI64(&decoder, &pReq->suid) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pReq->delay1) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pReq->delay2) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pReq->watermark1) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pReq->watermark2) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->ttl) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->colVer) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->tagVer) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->numOfColumns) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->numOfTags) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->numOfFuncs) < 0) return -1;
|
||||
|
@ -645,6 +661,11 @@ int32_t tSerializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq) {
|
|||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->igNotExists) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->source) < 0) return -1;
|
||||
for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) {
|
||||
if (tEncodeI8(&encoder, pReq->reserved[i]) < 0) return -1;
|
||||
}
|
||||
if (tEncodeI64(&encoder, pReq->suid) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
|
@ -659,6 +680,12 @@ int32_t tDeserializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq)
|
|||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pReq->igNotExists) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pReq->source) < 0) return -1;
|
||||
for (int32_t i = 0; i < sizeof(pReq->reserved) / sizeof(int8_t); ++i) {
|
||||
if (tDecodeI8(&decoder, &pReq->reserved[i]) < 0) return -1;
|
||||
}
|
||||
if (tDecodeI64(&decoder, &pReq->suid) < 0) return -1;
|
||||
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
|
@ -672,8 +699,6 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq)
|
|||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->name) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pReq->alterType) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->tagVer) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->colVer) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->numOfFields) < 0) return -1;
|
||||
for (int32_t i = 0; i < pReq->numOfFields; ++i) {
|
||||
SField *pField = taosArrayGet(pReq->pFields, i);
|
||||
|
@ -700,8 +725,6 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq
|
|||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->name) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pReq->alterType) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->tagVer) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->colVer) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->numOfFields) < 0) return -1;
|
||||
pReq->pFields = taosArrayInit(pReq->numOfFields, sizeof(SField));
|
||||
if (pReq->pFields == NULL) {
|
||||
|
@ -2624,6 +2647,31 @@ int32_t tDeserializeSDbCfgReq(void *buf, int32_t bufLen, SDbCfgReq *pReq) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSTrimDbReq(void *buf, int32_t bufLen, STrimDbReq *pReq) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
@ -5406,11 +5454,11 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) {
|
|||
} else if (pVal->type == TMQ_OFFSET__RESET_LATEST) {
|
||||
snprintf(buf, maxLen, "offset(reset to latest)");
|
||||
} else if (pVal->type == TMQ_OFFSET__LOG) {
|
||||
snprintf(buf, maxLen, "offset(log) ver:%ld", pVal->version);
|
||||
snprintf(buf, maxLen, "offset(log) ver:%" PRId64, pVal->version);
|
||||
} else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||
snprintf(buf, maxLen, "offset(ss data) uid:%ld, ts:%ld", pVal->uid, pVal->ts);
|
||||
snprintf(buf, maxLen, "offset(ss data) uid:%" PRId64 ", ts:%" PRId64, pVal->uid, pVal->ts);
|
||||
} else if (pVal->type == TMQ_OFFSET__SNAPSHOT_META) {
|
||||
snprintf(buf, maxLen, "offset(ss meta) uid:%ld, ts:%ld", pVal->uid, pVal->ts);
|
||||
snprintf(buf, maxLen, "offset(ss meta) uid:%" PRId64 ", ts:%" PRId64, pVal->uid, pVal->ts);
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* This program is free software: you can use, redistribute, and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3
|
||||
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#define TSDB_SQL_C
|
||||
#include "tmsgtype.h"
|
|
@ -115,6 +115,14 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
|
|||
|
||||
#endif
|
||||
|
||||
SName* toName(int32_t acctId, const char* pDbName, const char* pTableName, SName* pName) {
|
||||
pName->type = TSDB_TABLE_NAME_T;
|
||||
pName->acctId = acctId;
|
||||
strcpy(pName->dbname, pDbName);
|
||||
strcpy(pName->tname, pTableName);
|
||||
return pName;
|
||||
}
|
||||
|
||||
int32_t tNameExtractFullName(const SName* name, char* dst) {
|
||||
assert(name != NULL && dst != NULL);
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ int main(int argc, char const *argv[]) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
dInfo("start to open dnode");
|
||||
dInfo("start to init service");
|
||||
dmSetSignalHandle();
|
||||
int32_t code = dmRun();
|
||||
dInfo("shutting down the service");
|
||||
|
|
|
@ -21,7 +21,7 @@ extern SConfig *tsCfg;
|
|||
|
||||
static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) {
|
||||
if (pMgmt->pData->dnodeId == 0 || pMgmt->pData->clusterId == 0) {
|
||||
dInfo("set dnodeId:%d clusterId:%" PRId64, pCfg->dnodeId, pCfg->clusterId);
|
||||
dInfo("set local info, dnodeId:%d clusterId:%" PRId64, pCfg->dnodeId, pCfg->clusterId);
|
||||
taosThreadRwlockWrlock(&pMgmt->pData->lock);
|
||||
pMgmt->pData->dnodeId = pCfg->dnodeId;
|
||||
pMgmt->pData->clusterId = pCfg->clusterId;
|
||||
|
|
|
@ -214,6 +214,7 @@ SArray *mmGetMsgHandles() {
|
|||
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||
|
@ -237,10 +238,12 @@ SArray *mmGetMsgHandles() {
|
|||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PING, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PING_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST_BATCH, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_REQUEST_VOTE, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_REQUEST_VOTE_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_BATCH, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
|
||||
|
|
|
@ -167,7 +167,7 @@ int32_t mmPutMsgToQueue(SMnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
|
|||
if (pMsg == NULL) return -1;
|
||||
memcpy(pMsg, pRpc, sizeof(SRpcMsg));
|
||||
|
||||
dTrace("msg:%p, is created and will put int %s queue", pMsg, pWorker->name);
|
||||
dTrace("msg:%p, is created and will put into %s queue, type:%s", pMsg, pWorker->name, TMSG_INFO(pRpc->msgType));
|
||||
return mmPutMsgToWorker(pMgmt, pWorker, pMsg);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ SArray *qmGetMsgHandles() {
|
|||
if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH_RSP, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER;
|
||||
|
||||
|
|
|
@ -328,6 +328,7 @@ SArray *vmGetMsgHandles() {
|
|||
if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_VND_UPDATE_TAG_VAL, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
|
||||
|
@ -376,11 +377,15 @@ SArray *vmGetMsgHandles() {
|
|||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PING, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_PING_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST_BATCH, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_CLIENT_REQUEST_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_REQUEST_VOTE, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_REQUEST_VOTE_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_BATCH, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SET_VNODE_STANDBY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
|
|
@ -173,7 +173,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
|
|||
pThread->pCfgs[pThread->vnodeNum++] = pCfgs[v];
|
||||
}
|
||||
|
||||
dInfo("start %d threads to open %d vnodes", threadNum, numOfVnodes);
|
||||
dInfo("open %d vnodes with %d threads", numOfVnodes, threadNum);
|
||||
|
||||
for (int32_t t = 0; t < threadNum; ++t) {
|
||||
SVnodeThread *pThread = &threads[t];
|
||||
|
@ -204,7 +204,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
|
|||
dError("there are total vnodes:%d, opened:%d", pMgmt->state.totalVnodes, pMgmt->state.openVnodes);
|
||||
return -1;
|
||||
} else {
|
||||
dInfo("total vnodes:%d open successfully", pMgmt->state.totalVnodes);
|
||||
dInfo("successfully opened %d vnodes", pMgmt->state.totalVnodes);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,9 +238,9 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) {
|
|||
}
|
||||
|
||||
int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
|
||||
pVnode->pWriteQ = tWWorkerAllocQueue(&pMgmt->writePool, pVnode->pImpl, (FItems)vnodeProposeMsg);
|
||||
pVnode->pWriteQ = tWWorkerAllocQueue(&pMgmt->writePool, pVnode->pImpl, (FItems)vnodeProposeWriteMsg);
|
||||
pVnode->pSyncQ = tWWorkerAllocQueue(&pMgmt->syncPool, pVnode, (FItems)vmProcessSyncQueue);
|
||||
pVnode->pApplyQ = tWWorkerAllocQueue(&pMgmt->applyPool, pVnode->pImpl, (FItems)vnodeApplyMsg);
|
||||
pVnode->pApplyQ = tWWorkerAllocQueue(&pMgmt->applyPool, pVnode->pImpl, (FItems)vnodeApplyWriteMsg);
|
||||
pVnode->pQueryQ = tQWorkerAllocQueue(&pMgmt->queryPool, pVnode, (FItem)vmProcessQueryQueue);
|
||||
pVnode->pFetchQ = tQWorkerAllocQueue(&pMgmt->fetchPool, pVnode, (FItem)vmProcessFetchQueue);
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ static void dmClearVars(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
int32_t dmInitDnode(SDnode *pDnode, EDndNodeType rtype) {
|
||||
dInfo("start to create dnode");
|
||||
dDebug("start to create dnode");
|
||||
int32_t code = -1;
|
||||
char path[PATH_MAX + 100] = {0};
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ int32_t dmRunDnode(SDnode *pDnode) {
|
|||
|
||||
while (1) {
|
||||
if (pDnode->stop) {
|
||||
dInfo("dnode is about to stop");
|
||||
dInfo("TDengine is about to stop");
|
||||
dmSetStatus(pDnode, DND_STAT_STOPPED);
|
||||
dmStopNodes(pDnode);
|
||||
dmCloseNodes(pDnode);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue