client

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 17 Imported by: 11

Documentation

Index

Constants

View Source
const (
	SuccessStatus        int32 = 200
	StillExecutingStatus int32 = 201
	InvalidHandleStatus  int32 = 202
	IncompatibleVersion  int32 = 203

	NodeDeleteFailedError                  int32 = 298
	AliasAlreadyExistError                 int32 = 299
	PathAlreadyExistError                  int32 = 300
	PathNotExistError                      int32 = 301
	UnsupportedFetchMetadataOperationError int32 = 302
	MetadataError                          int32 = 303
	TimeseriesNotExist                     int32 = 304
	OutOfTTLError                          int32 = 305
	ConfigAdjuster                         int32 = 306
	MergeError                             int32 = 307
	SystemCheckError                       int32 = 308
	SyncDeviceOwnerConflictError           int32 = 309
	SyncConnectionException                int32 = 310
	StorageGroupProcessorError             int32 = 311
	StorageGroupError                      int32 = 312
	StorageEngineError                     int32 = 313
	TsfileProcessorError                   int32 = 314
	PathIllegal                            int32 = 315
	LoadFileError                          int32 = 316
	StorageGroupNotReady                   int32 = 317

	ExecuteStatementError    int32 = 400
	SQLParseError            int32 = 401
	GenerateTimeZoneError    int32 = 402
	SetTimeZoneError         int32 = 403
	NotStorageGroupError     int32 = 404
	QueryNotAllowed          int32 = 405
	AstFormatError           int32 = 406
	LogicalOperatorError     int32 = 407
	LogicalOptimizeError     int32 = 408
	UnsupportedFillTypeError int32 = 409
	PathErroRint32           int32 = 410
	QueryProcessError        int32 = 411
	WriteProcessError        int32 = 412
	WriteProcessReject       int32 = 413

	UnsupportedIndexFuncError int32 = 421
	UnsupportedIndexTypeError int32 = 422

	InternalServerError        int32 = 500
	CloseOperationError        int32 = 501
	ReadOnlySystemError        int32 = 502
	DiskSpaceInsufficientError int32 = 503
	StartUpError               int32 = 504
	ShutDownError              int32 = 505
	MultipleError              int32 = 506

	WrongLoginPasswordError int32 = 600
	NotLoginError           int32 = 601
	NoPermissionError       int32 = 602
	UninitializedAuthError  int32 = 603

	PartitionNotReady    int32 = 700
	TimeOut              int32 = 701
	NoLeader             int32 = 702
	UnsupportedOperation int32 = 703
	NodeReadOnly         int32 = 704
	ConsistencyFailure   int32 = 705
	NoConnection         int32 = 706
	NeedRedirection      int32 = 707
)

TSStatusCode

View Source
const (
	DefaultTimeZone        = "Asia/Shanghai"
	DefaultFetchSize       = 1024
	DefaultConnectRetryMax = 3
)
View Source
const (
	TimestampColumnName = "Time"
)

Variables

This section is empty.

Functions

func VerifySuccess

func VerifySuccess(status *rpc.TSStatus) error

Types

type BatchError

type BatchError struct {
	// contains filtered or unexported fields
}

func NewBatchError

func NewBatchError(statuses []*rpc.TSStatus) *BatchError

func (*BatchError) Error

func (e *BatchError) Error() string

func (*BatchError) GetStatuses

func (e *BatchError) GetStatuses() []*rpc.TSStatus

type ClusterConfig added in v0.12.1

type ClusterConfig struct {
	NodeUrls        []string //ip:port
	UserName        string
	Password        string
	FetchSize       int32
	TimeZone        string
	ConnectRetryMax int
}

type ClusterSession added in v0.12.1

type ClusterSession struct {
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Host            string
	Port            string
	UserName        string
	Password        string
	FetchSize       int32
	TimeZone        string
	ConnectRetryMax int
}

type Field

type Field struct {
	// contains filtered or unexported fields
}

func (*Field) GetDataType

func (f *Field) GetDataType() TSDataType

func (*Field) GetFloat32

func (f *Field) GetFloat32() float32

func (*Field) GetFloat64

func (f *Field) GetFloat64() float64

func (*Field) GetInt32

func (f *Field) GetInt32() int32

func (*Field) GetInt64

func (f *Field) GetInt64() int64

func (*Field) GetName

func (f *Field) GetName() string

func (*Field) GetText

func (f *Field) GetText() string

func (*Field) GetValue

func (f *Field) GetValue() interface{}

func (*Field) IsNull

func (f *Field) IsNull() bool

type IoTDBRpcDataSet

type IoTDBRpcDataSet struct {
	// contains filtered or unexported fields
}

func NewIoTDBRpcDataSet

func NewIoTDBRpcDataSet(sql string, columnNameList []string, columnTypes []string,
	columnNameIndex map[string]int32,
	queryId int64, client *rpc.TSIServiceClient, sessionId int64, queryDataSet *rpc.TSQueryDataSet,
	ignoreTimeStamp bool, fetchSize int32, timeoutMs *int64) *IoTDBRpcDataSet

func (*IoTDBRpcDataSet) Close

func (s *IoTDBRpcDataSet) Close() (err error)

func (*IoTDBRpcDataSet) GetTimestamp

func (s *IoTDBRpcDataSet) GetTimestamp() int64

func (*IoTDBRpcDataSet) IsClosed

func (s *IoTDBRpcDataSet) IsClosed() bool

type MeasurementSchema

type MeasurementSchema struct {
	Measurement string
	DataType    TSDataType
	Encoding    TSEncoding
	Compressor  TSCompressionType
	Properties  map[string]string
}

type PoolConfig added in v0.13.1

type PoolConfig struct {
	Host            string
	Port            string
	NodeUrls        []string
	UserName        string
	Password        string
	FetchSize       int32
	TimeZone        string
	ConnectRetryMax int
}

type RowRecord

type RowRecord struct {
	// contains filtered or unexported fields
}

func (*RowRecord) GetFields

func (r *RowRecord) GetFields() []*Field

func (*RowRecord) GetTimestamp

func (r *RowRecord) GetTimestamp() int64

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewClusterSession added in v0.12.1

func NewClusterSession(clusterConfig *ClusterConfig) Session

func NewSession

func NewSession(config *Config) Session

func (*Session) Close

func (s *Session) Close() (r *rpc.TSStatus, err error)

func (*Session) CreateAlignedTimeseries added in v0.13.0

func (s *Session) CreateAlignedTimeseries(prefixPath string, measurements []string, dataTypes []TSDataType, encodings []TSEncoding, compressors []TSCompressionType, measurementAlias []string) (r *rpc.TSStatus, err error)

*create single aligned time series *params *prefixPath: string, time series prefix path (starts from root) *measurements: []string, sensor names *dataTypes: []int32, data types for time series *encodings: []int32, encodings for time series *compressors: []int32, compressing types for time series *measurementAlias: []string, sensor names alias *return *error: correctness of operation

func (*Session) CreateMultiTimeseries

func (s *Session) CreateMultiTimeseries(paths []string, dataTypes []TSDataType, encodings []TSEncoding, compressors []TSCompressionType) (r *rpc.TSStatus, err error)

*create multiple time series *params *paths: []string, complete time series paths (starts from root) *dataTypes: []int32, data types for time series *encodings: []int32, encodings for time series *compressors: []int32, compressing types for time series *return *error: correctness of operation

func (*Session) CreateTimeseries

func (s *Session) CreateTimeseries(path string, dataType TSDataType, encoding TSEncoding, compressor TSCompressionType, attributes map[string]string, tags map[string]string) (r *rpc.TSStatus, err error)

*create single time series *params *path: string, complete time series path (starts from root) *dataType: int32, data type for this time series *encoding: int32, data type for this time series *compressor: int32, compressing type for this time series *return *error: correctness of operation

func (*Session) DeleteData

func (s *Session) DeleteData(paths []string, startTime int64, endTime int64) (r *rpc.TSStatus, err error)

*delete all startTime <= data <= endTime in multiple time series *params *paths: []string, time series array that the data in *startTime: int64, start time of deletion range *endTime: int64, end time of deletion range *return *error: correctness of operation

func (*Session) DeleteStorageGroup

func (s *Session) DeleteStorageGroup(storageGroupId string) (r *rpc.TSStatus, err error)

*delete one storage group *param *storageGroupId: string, storage group name (starts from root) *return *error: correctness of operation

func (*Session) DeleteStorageGroups

func (s *Session) DeleteStorageGroups(storageGroupIds ...string) (r *rpc.TSStatus, err error)

*delete multiple storage group *param *storageGroupIds: []string, paths of the target storage groups *return *error: correctness of operation

func (*Session) DeleteTimeseries

func (s *Session) DeleteTimeseries(paths []string) (r *rpc.TSStatus, err error)

*delete multiple time series, including data and schema *params *paths: []string, time series paths, which should be complete (starts from root) *return *error: correctness of operation

func (*Session) ExecuteBatchStatement

func (s *Session) ExecuteBatchStatement(inserts []string) (r *rpc.TSStatus, err error)

func (*Session) ExecuteQueryStatement

func (s *Session) ExecuteQueryStatement(sql string, timeoutMs *int64) (*SessionDataSet, error)

func (*Session) ExecuteRawDataQuery

func (s *Session) ExecuteRawDataQuery(paths []string, startTime int64, endTime int64) (*SessionDataSet, error)

func (*Session) ExecuteStatement

func (s *Session) ExecuteStatement(sql string) (*SessionDataSet, error)

func (*Session) ExecuteUpdateStatement

func (s *Session) ExecuteUpdateStatement(sql string) (*SessionDataSet, error)

func (*Session) GetSessionId

func (s *Session) GetSessionId() int64

func (*Session) GetTimeZone

func (s *Session) GetTimeZone() (string, error)

func (*Session) InsertAlignedRecord added in v0.13.0

func (s *Session) InsertAlignedRecord(deviceId string, measurements []string, dataTypes []TSDataType, values []interface{}, timestamp int64) (r *rpc.TSStatus, err error)

func (*Session) InsertAlignedRecords added in v0.13.0

func (s *Session) InsertAlignedRecords(deviceIds []string, measurements [][]string, dataTypes [][]TSDataType, values [][]interface{},
	timestamps []int64) (r *rpc.TSStatus, err error)

func (*Session) InsertAlignedRecordsOfOneDevice added in v0.13.0

func (s *Session) InsertAlignedRecordsOfOneDevice(deviceId string, timestamps []int64, measurementsSlice [][]string, dataTypesSlice [][]TSDataType, valuesSlice [][]interface{}, sorted bool) (r *rpc.TSStatus, err error)

func (*Session) InsertAlignedTablet added in v0.13.0

func (s *Session) InsertAlignedTablet(tablet *Tablet, sorted bool) (r *rpc.TSStatus, err error)

func (*Session) InsertAlignedTablets added in v0.13.0

func (s *Session) InsertAlignedTablets(tablets []*Tablet, sorted bool) (r *rpc.TSStatus, err error)

func (*Session) InsertRecord

func (s *Session) InsertRecord(deviceId string, measurements []string, dataTypes []TSDataType, values []interface{}, timestamp int64) (r *rpc.TSStatus, err error)

func (*Session) InsertRecords

func (s *Session) InsertRecords(deviceIds []string, measurements [][]string, dataTypes [][]TSDataType, values [][]interface{},
	timestamps []int64) (r *rpc.TSStatus, err error)

*insert multiple rows of data, records are independent to each other, in other words, there's no relationship *between those records * *params *deviceIds: []string, time series paths for device *measurements: [][]string, each element of outer list indicates measurements of a device *dataTypes: [][]int32, each element of outer list indicates sensor data types of a device *values: [][]interface{}, values to be inserted, for each device *timestamps: []int64, timestamps for records *

func (*Session) InsertRecordsOfOneDevice

func (s *Session) InsertRecordsOfOneDevice(deviceId string, timestamps []int64, measurementsSlice [][]string, dataTypesSlice [][]TSDataType, valuesSlice [][]interface{}, sorted bool) (r *rpc.TSStatus, err error)

InsertRecordsOfOneDevice Insert multiple rows, which can reduce the overhead of network. This method is just like jdbc executeBatch, we pack some insert request in batch and send them to server. If you want improve your performance, please see insertTablet method Each row is independent, which could have different deviceId, time, number of measurements

func (*Session) InsertStringRecord

func (s *Session) InsertStringRecord(deviceId string, measurements []string, values []string, timestamp int64) (r *rpc.TSStatus, err error)

*special case for inserting one row of String (TEXT) value *params *deviceId: string, time series path for device *measurements: []string, sensor names *values: []string, values to be inserted, for each sensor *timestamp: int64, indicate the timestamp of the row of data *return *error: correctness of operation

func (*Session) InsertTablet

func (s *Session) InsertTablet(tablet *Tablet, sorted bool) (r *rpc.TSStatus, err error)

func (*Session) InsertTablets

func (s *Session) InsertTablets(tablets []*Tablet, sorted bool) (r *rpc.TSStatus, err error)

* InsertTablets insert multiple tablets, tablets are independent to each other *params *tablets: []*client.Tablet, list of tablets

func (*Session) Open

func (s *Session) Open(enableRPCCompression bool, connectionTimeoutInMs int) error

func (*Session) OpenCluster added in v0.12.1

func (s *Session) OpenCluster(enableRPCCompression bool) error

func (*Session) SetStorageGroup

func (s *Session) SetStorageGroup(storageGroupId string) (r *rpc.TSStatus, err error)

*set one storage group *param *storageGroupId: string, storage group name (starts from root) *return *error: correctness of operation

func (*Session) SetTimeZone

func (s *Session) SetTimeZone(timeZone string) (r *rpc.TSStatus, err error)

type SessionDataSet

type SessionDataSet struct {
	// contains filtered or unexported fields
}

func NewSessionDataSet

func NewSessionDataSet(sql string, columnNameList []string, columnTypeList []string,
	columnNameIndex map[string]int32,
	queryId int64, client *rpc.TSIServiceClient, sessionId int64, queryDataSet *rpc.TSQueryDataSet,
	ignoreTimeStamp bool, fetchSize int32, timeoutMs *int64) *SessionDataSet

func (*SessionDataSet) Close

func (s *SessionDataSet) Close() error

func (*SessionDataSet) GetBool

func (s *SessionDataSet) GetBool(columnName string) bool

func (*SessionDataSet) GetColumnCount

func (s *SessionDataSet) GetColumnCount() int

func (*SessionDataSet) GetColumnDataType

func (s *SessionDataSet) GetColumnDataType(columnIndex int) TSDataType

func (*SessionDataSet) GetColumnName

func (s *SessionDataSet) GetColumnName(columnIndex int) string

func (*SessionDataSet) GetColumnNames

func (s *SessionDataSet) GetColumnNames() []string

func (*SessionDataSet) GetDouble

func (s *SessionDataSet) GetDouble(columnName string) float64

func (*SessionDataSet) GetFloat

func (s *SessionDataSet) GetFloat(columnName string) float32

func (*SessionDataSet) GetInt32

func (s *SessionDataSet) GetInt32(columnName string) int32

func (*SessionDataSet) GetInt64

func (s *SessionDataSet) GetInt64(columnName string) int64

func (*SessionDataSet) GetRowRecord

func (s *SessionDataSet) GetRowRecord() (*RowRecord, error)

func (*SessionDataSet) GetText

func (s *SessionDataSet) GetText(columnName string) string

GetText returns string value of column value on row. This is not goroutine safe

func (*SessionDataSet) GetTimestamp

func (s *SessionDataSet) GetTimestamp() int64

func (*SessionDataSet) GetValue

func (s *SessionDataSet) GetValue(columnName string) interface{}

func (*SessionDataSet) IsClosed

func (s *SessionDataSet) IsClosed() bool

func (*SessionDataSet) IsIgnoreTimeStamp

func (s *SessionDataSet) IsIgnoreTimeStamp() bool

func (*SessionDataSet) Next

func (s *SessionDataSet) Next() (bool, error)

Next prepares the next result row for reading, returns true on success, or false if there is no next result row or an error appened while preparing it. consulted Err should be consulted to distinguish between the two cases. This is not goroutine safe

func (*SessionDataSet) Scan

func (s *SessionDataSet) Scan(dest ...interface{}) error

type SessionPool added in v0.13.1

type SessionPool struct {
	// contains filtered or unexported fields
}

func NewSessionPool added in v0.13.1

func NewSessionPool(conf *PoolConfig, maxSize, connectionTimeoutInMs, waitToGetSessionTimeoutInMs int,
	enableCompression bool) SessionPool

func (*SessionPool) Close added in v0.13.1

func (spool *SessionPool) Close()

func (*SessionPool) ConstructSession added in v0.13.1

func (spool *SessionPool) ConstructSession(config *PoolConfig) (session Session, err error)

func (*SessionPool) GetSession added in v0.13.1

func (spool *SessionPool) GetSession() (session Session, err error)

func (*SessionPool) PutBack added in v0.13.1

func (spool *SessionPool) PutBack(session Session)

type TSCompressionType

type TSCompressionType uint8
const (
	UNCOMPRESSED TSCompressionType = 0
	SNAPPY       TSCompressionType = 1
	GZIP         TSCompressionType = 2
	LZO          TSCompressionType = 3
	SDT          TSCompressionType = 4
	PAA          TSCompressionType = 5
	PLA          TSCompressionType = 6
	LZ4          TSCompressionType = 7
)

type TSDataType

type TSDataType int8
const (
	UNKNOWN TSDataType = -1
	BOOLEAN TSDataType = 0
	INT32   TSDataType = 1
	INT64   TSDataType = 2
	FLOAT   TSDataType = 3
	DOUBLE  TSDataType = 4
	TEXT    TSDataType = 5
)

type TSEncoding

type TSEncoding uint8
const (
	PLAIN            TSEncoding = 0
	PLAIN_DICTIONARY TSEncoding = 1
	RLE              TSEncoding = 2
	DIFF             TSEncoding = 3
	TS_2DIFF         TSEncoding = 4
	BITMAP           TSEncoding = 5
	GORILLA_V1       TSEncoding = 6
	REGULAR          TSEncoding = 7
	GORILLA          TSEncoding = 8
)

type Tablet

type Tablet struct {
	// contains filtered or unexported fields
}

func NewTablet

func NewTablet(deviceId string, measurementSchemas []*MeasurementSchema, rowCount int) (*Tablet, error)

func (*Tablet) GetMeasurements

func (t *Tablet) GetMeasurements() []string

func (*Tablet) GetRowCount

func (t *Tablet) GetRowCount() int

func (*Tablet) GetTimestampBytes

func (t *Tablet) GetTimestampBytes() []byte

func (*Tablet) GetValueAt

func (t *Tablet) GetValueAt(columnIndex, rowIndex int) (interface{}, error)

func (*Tablet) Len

func (t *Tablet) Len() int

func (*Tablet) Less

func (t *Tablet) Less(i, j int) bool

func (*Tablet) SetTimestamp

func (t *Tablet) SetTimestamp(timestamp int64, rowIndex int)

func (*Tablet) SetValueAt

func (t *Tablet) SetValueAt(value interface{}, columnIndex, rowIndex int) error

func (*Tablet) Sort

func (t *Tablet) Sort() error

func (*Tablet) Swap

func (t *Tablet) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL