MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / newClusterSessionWithSqlDialect

Function newClusterSessionWithSqlDialect

client/session.go:1319–1352  ·  view source on GitHub ↗
(clusterConfig *ClusterConfig)

Source from the content-addressed store, hash-verified

1317}
1318
1319func newClusterSessionWithSqlDialect(clusterConfig *ClusterConfig) (Session, error) {
1320 session := Session{}
1321 session.endPointList = make([]endPoint, len(clusterConfig.NodeUrls))
1322 for i := 0; i < len(clusterConfig.NodeUrls); i++ {
1323 node := endPoint{}
1324 node.Host = strings.Split(clusterConfig.NodeUrls[i], ":")[0]
1325 node.Port = strings.Split(clusterConfig.NodeUrls[i], ":")[1]
1326 session.endPointList[i] = node
1327 }
1328 var err error
1329 for i := range session.endPointList {
1330 ep := session.endPointList[i]
1331 session.trans = thrift.NewTSocketConf(net.JoinHostPort(ep.Host, ep.Port), &thrift.TConfiguration{
1332 ConnectTimeout: time.Duration(0), // Use 0 for no timeout
1333 })
1334 // session.trans = thrift.NewTFramedTransport(session.trans) // deprecated
1335 tmp_conf := thrift.TConfiguration{MaxFrameSize: thrift.DEFAULT_MAX_FRAME_SIZE}
1336 session.trans = thrift.NewTFramedTransportConf(session.trans, &tmp_conf)
1337 if !session.trans.IsOpen() {
1338 err = session.trans.Open()
1339 if err != nil {
1340 log.Println(err)
1341 } else {
1342 session.config = getConfig(ep.Host, ep.Port,
1343 clusterConfig.UserName, clusterConfig.Password, clusterConfig.FetchSize, clusterConfig.TimeZone, clusterConfig.ConnectRetryMax, clusterConfig.Database, clusterConfig.sqlDialect)
1344 break
1345 }
1346 }
1347 }
1348 if !session.trans.IsOpen() {
1349 return session, fmt.Errorf("no server can connect")
1350 }
1351 return session, nil
1352}
1353
1354func (s *Session) initClusterConn(node endPoint) error {
1355 var err error

Callers 3

NewClusterTableSessionFunction · 0.85
ConstructSessionMethod · 0.85
NewClusterSessionFunction · 0.85

Calls 2

getConfigFunction · 0.85
OpenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…