Skip to content

Commit

Permalink
update thrift to 0.15.0 to fit IoTDB 0.13.0 (#41)
Browse files Browse the repository at this point in the history
* update thrift to 0.15.0

1. replace "NewTFramedTransport" with "NewTFramedTransportConf", and use default conf for this function.

2.fix function "NewTSocketConf"

3.replace deprecated func "NewTFramedTransport"

p.s.
in thrift 0.14.1, func NewTSocketConf returns two values;
in thrift 0.15.0, func NewTSocketConf just returns one.

* update readme and makefile to fit thrift 0.15.0

update readme and makefile to fit thrift 0.15.0
  • Loading branch information
citrusreticulata committed Jul 22, 2022
1 parent 84b8d45 commit d090bac
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 28 deletions.
2 changes: 1 addition & 1 deletion LICENSE-binary
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@ following license. See licenses/ for text of these licenses.

Apache Software Foundation License 2.0
--------------------------------------
github.com/apache/thrift@v0.14.1
github.com/apache/thrift@v0.15.0
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ generate:
fi

@if ! command -v thrift &> /dev/null; then \
echo "thrift could not be found, please install thrift 0.14.1"; \
echo "thrift could not be found, please install thrift 0.15.0"; \
exit 1; \
fi

@if [[ "`thrift --version|grep -o '0.14.[0-9]'`" == "" ]]; then \
echo "please install thrift 0.14.1"; \
@if [[ "`thrift --version|grep -o '0.15.[0-9]'`" == "" ]]; then \
echo "please install thrift 0.15.0"; \
exit 1; \
fi

Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@

# Apache IoTDB

[![E2E Tests](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml/badge.svg)](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml)
[![GitHub release](https://img.shields.io/github/release/apache/iotdb-client-go.svg)](https://github.com/apache/iotdb-client-go/releases)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
![](https://github-size-badge.herokuapp.com/apache/iotdb-client-go.svg)
![](https://img.shields.io/badge/platform-win10%20%7C%20macos%20%7C%20linux-yellow.svg)
[![IoTDB Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/)


Apache IoTDB (Database for Internet of Things) is an IoT native database with high performance for
data management and analysis, deployable on the edge and the cloud. Due to its light-weight
architecture, high performance and rich feature set together with its deep integration with
Expand All @@ -38,6 +30,13 @@ high-speed data ingestion and complex data analysis in the IoT industrial fields

# Apache IoTDB Client for Go

[![E2E Tests](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml/badge.svg)](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml)
[![GitHub release](https://img.shields.io/github/release/apache/iotdb-client-go.svg)](https://github.com/apache/iotdb-client-go/releases)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
![](https://github-size-badge.herokuapp.com/apache/iotdb-client-go.svg)
![](https://img.shields.io/badge/platform-win10%20%7C%20macos%20%7C%20linux-yellow.svg)
[![IoTDB Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/)

## Overview

This is the GoLang client of Apache IoTDB.
Expand Down Expand Up @@ -68,10 +67,10 @@ go run session_example.go
Without go mod

```sh
# get thrift 0.14.1
# get thrift 0.15.0
go get github.com/apache/thrift
cd $GOPATH/src/github.com/apache/thrift
git checkout 0.14.1
git checkout 0.15.0

mkdir -p $GOPATH/src/iotdb-client-go-example/session_example
cd $GOPATH/src/iotdb-client-go-example/session_example
Expand All @@ -92,4 +91,4 @@ go run session_example.go
* golang >= 1.13
* make >= 3.0
* curl >= 7.1.1
* thrift 0.14.1
* thrift 0.15.0
19 changes: 16 additions & 3 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,21 @@
-->
[English](./README.md) | [中文](./README_ZH.md)

# Apache IoTDB

Apache IoTDB(物联网数据库)是一个物联网原生数据库,在数据管理和分析方面表现良好,可部署在边缘设备和云上。
由于其轻量级架构、高性能和丰富的功能集,以及与Apache Hadoop、Spark和Flink的深度集成,
Apache IoTDB可以满足物联网工业领域的海量数据存储、高速数据摄取和复杂数据分析的要求。

# Apache IoTDB Go语言客户端

[![E2E Tests](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml/badge.svg)](https://github.com/apache/iotdb-client-go/actions/workflows/e2e.yml)
[![GitHub release](https://img.shields.io/github/release/apache/iotdb-client-go.svg)](https://github.com/apache/iotdb-client-go/releases)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
![](https://github-size-badge.herokuapp.com/apache/iotdb-client-go.svg)
![](https://img.shields.io/badge/platform-win10%20%7C%20macos%20%7C%20linux-yellow.svg)
[![IoTDB Website](https://img.shields.io/website-up-down-green-red/https/shields.io.svg?label=iotdb-website)](https://iotdb.apache.org/)

## 概览

本仓库是Apache IoTDB的Go语言客户端.
Expand Down Expand Up @@ -52,10 +65,10 @@ go run session_example.go
不使用go mod,采用GOPATH

```sh
# get thrift 0.14.1
# get thrift 0.15.0
go get github.com/apache/thrift
cd $GOPATH/src/github.com/apache/thrift
git checkout 0.14.1
git checkout 0.15.0

mkdir -p $GOPATH/src/iotdb-client-go-example/session_example
cd $GOPATH/src/iotdb-client-go-example/session_example
Expand All @@ -75,4 +88,4 @@ go run session_example.go
* golang >= 1.13
* make >= 3.0
* curl >= 7.1.1
* thrift 0.14.1
* thrift 0.15.0
19 changes: 13 additions & 6 deletions client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,16 @@ func (s *Session) Open(enableRPCCompression bool, connectionTimeoutInMs int) err
var protocolFactory thrift.TProtocolFactory
var err error

s.trans, err = thrift.NewTSocketConf(net.JoinHostPort(s.config.Host, s.config.Port), &thrift.TConfiguration{
// in thrift 0.14.1, this func returns two values; in thrift 0.15.0, it returns one.
s.trans = thrift.NewTSocketConf(net.JoinHostPort(s.config.Host, s.config.Port), &thrift.TConfiguration{
ConnectTimeout: time.Duration(connectionTimeoutInMs), // Use 0 for no timeout
})
if err != nil {
return err
}
s.trans = thrift.NewTFramedTransport(s.trans)
// s.trans = thrift.NewTFramedTransport(s.trans) // deprecated
var tmp_conf = thrift.TConfiguration{MaxFrameSize: thrift.DEFAULT_MAX_FRAME_SIZE}
s.trans = thrift.NewTFramedTransportConf(s.trans, &tmp_conf)
if !s.trans.IsOpen() {
err = s.trans.Open()
if err != nil {
Expand Down Expand Up @@ -813,11 +816,13 @@ func NewClusterSession(ClusterConfig *ClusterConfig) Session {
}
var err error
for e := endPointList.Front(); e != nil; e = e.Next() {
session.trans, err = thrift.NewTSocketConf(net.JoinHostPort(e.Value.(endPoint).Host, e.Value.(endPoint).Port), &thrift.TConfiguration{
session.trans = thrift.NewTSocketConf(net.JoinHostPort(e.Value.(endPoint).Host, e.Value.(endPoint).Port), &thrift.TConfiguration{
ConnectTimeout: time.Duration(0), // Use 0 for no timeout
})
if err == nil {
session.trans = thrift.NewTFramedTransport(session.trans)
// session.trans = thrift.NewTFramedTransport(session.trans) // deprecated
var tmp_conf = thrift.TConfiguration{MaxFrameSize: thrift.DEFAULT_MAX_FRAME_SIZE}
session.trans = thrift.NewTFramedTransportConf(session.trans, &tmp_conf)
if !session.trans.IsOpen() {
err = session.trans.Open()
if err != nil {
Expand All @@ -839,11 +844,13 @@ func NewClusterSession(ClusterConfig *ClusterConfig) Session {
func (s *Session) initClusterConn(node endPoint) error {
var err error

s.trans, err = thrift.NewTSocketConf(net.JoinHostPort(node.Host, node.Port), &thrift.TConfiguration{
s.trans = thrift.NewTSocketConf(net.JoinHostPort(node.Host, node.Port), &thrift.TConfiguration{
ConnectTimeout: time.Duration(0), // Use 0 for no timeout
})
if err == nil {
s.trans = thrift.NewTFramedTransport(s.trans)
// s.trans = thrift.NewTFramedTransport(s.trans) // deprecated
var tmp_conf = thrift.TConfiguration{MaxFrameSize: thrift.DEFAULT_MAX_FRAME_SIZE}
s.trans = thrift.NewTFramedTransportConf(s.trans, &tmp_conf)
if !s.trans.IsOpen() {
err = s.trans.Open()
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion client/sessiondataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

package client

import "github.com/apache/iotdb-client-go/rpc"
import (
"github.com/apache/iotdb-client-go/rpc"
)

const (
TimestampColumnName = "Time"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/apache/iotdb-client-go
go 1.13

require (
github.com/apache/thrift v0.14.1
github.com/apache/thrift v0.15.0
github.com/stretchr/testify v1.8.0
)
17 changes: 15 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
github.com/apache/thrift v0.14.1 h1:Yh8v0hpCj63p5edXOLaqTJW0IJ1p+eMW6+YSOqw1d6s=
github.com/apache/thrift v0.14.1/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.15.0 h1:aGvdaR0v1t9XLgjtBYwxcBvBOTMqClzwE26CHOgjW1Y=
github.com/apache/thrift v0.15.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down

0 comments on commit d090bac

Please sign in to comment.