client

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 18 Imported by: 11

Documentation

Index

Constants

View Source
const (
	SuccessStatus       int32 = 200
	IncompatibleVersion int32 = 201
	ConfigurationError  int32 = 202
	StartUpError        int32 = 203
	ShutDownError       int32 = 204

	UnsupportedOperation    int32 = 300
	ExecuteStatementError   int32 = 301
	MultipleError           int32 = 302
	IllegalParameter        int32 = 303
	OverlapWithExistingTask int32 = 304
	InternalServerError     int32 = 305

	RedirectionRecommend int32 = 400

	DatabaseNotExist        int32 = 500
	DatabaseAlreadyExists   int32 = 501
	SeriesOverflow          int32 = 502
	TimeseriesAlreadyExist  int32 = 503
	TimeseriesInBlackList   int32 = 504
	AliasAlreadyExist       int32 = 505
	PathAlreadyExist        int32 = 506
	MetadataError           int32 = 507
	PathNotExist            int32 = 508
	IllegalPath             int32 = 509
	CreateTemplateError     int32 = 510
	DuplicatedTemplate      int32 = 511
	UndefinedTemplate       int32 = 512
	TemplateNotSet          int32 = 513
	DifferentTemplate       int32 = 514
	TemplateIsInUse         int32 = 515
	TemplateIncompatible    int32 = 516
	SegmentNotFound         int32 = 517
	PageOutOfSpace          int32 = 518
	RecordDuplicated        int32 = 519
	SegmentOutOfSpace       int32 = 520
	SchemaFileNotExists     int32 = 521
	OversizeRecord          int32 = 522
	SchemaFileRedoLogBroken int32 = 523
	TemplateNotActivated    int32 = 524

	SystemReadOnly         int32 = 600
	StorageEngineError     int32 = 601
	StorageEngineNotReady  int32 = 602
	DataregionProcessError int32 = 603
	TsfileProcessorError   int32 = 604
	WriteProcessError      int32 = 605
	WriteProcessReject     int32 = 606
	OutOfTtl               int32 = 607
	CompactionError        int32 = 608
	AlignedTimeseriesError int32 = 609
	WalError               int32 = 610
	DiskSpaceInsufficient  int32 = 611

	SqlParseError             int32 = 700
	SemanticError             int32 = 701
	GenerateTimeZoneError     int32 = 702
	SetTimeZoneError          int32 = 703
	QueryNotAllowed           int32 = 704
	LogicalOperatorError      int32 = 705
	LogicalOptimizeError      int32 = 706
	UnsupportedFillType       int32 = 707
	QueryProcessError         int32 = 708
	MppMemoryNotEnough        int32 = 709
	CloseOperationError       int32 = 710
	TsblockSerializeError     int32 = 711
	InternalRequestTimeOut    int32 = 712
	InternalRequestRetryError int32 = 713

	InitAuthError             int32 = 800
	WrongLoginPassword        int32 = 801
	NotLogin                  int32 = 802
	NoPermission              int32 = 803
	UserNotExist              int32 = 804
	UserAlreadyExist          int32 = 805
	UserAlreadyHasRole        int32 = 806
	UserNotHasRole            int32 = 807
	RoleNotExist              int32 = 808
	RoleAlreadyExist          int32 = 809
	AlreadyHasPrivilege       int32 = 810
	NotHasPrivilege           int32 = 811
	ClearPermissionCacheError int32 = 812
	UnknownAuthPrivilege      int32 = 813
	UnsupportedAuthOperation  int32 = 814
	AuthIoException           int32 = 815

	MigrateRegionError        int32 = 900
	CreateRegionError         int32 = 901
	DeleteRegionError         int32 = 902
	PartitionCacheUpdateError int32 = 903
	ConsensusNotInitialized   int32 = 904
	RegionLeaderChangeError   int32 = 905
	NoAvailableRegionGroup    int32 = 906

	DatanodeAlreadyRegistered int32 = 1000
	NoEnoughDatanode          int32 = 1001
	AddConfignodeError        int32 = 1002
	RemoveConfignodeError     int32 = 1003
	DatanodeNotExist          int32 = 1004
	DatanodeStopError         int32 = 1005
	RemoveDatanodeError       int32 = 1006
	RegisterRemovedDatanode   int32 = 1007
	CanNotConnectDatanode     int32 = 1008

	LoadFileError                 int32 = 1100
	LoadPieceOfTsfileError        int32 = 1101
	DeserializePieceOfTsfileError int32 = 1102
	SyncConnectionError           int32 = 1103
	SyncFileRedirectionError      int32 = 1104
	SyncFileError                 int32 = 1105
	CreatePipeSinkError           int32 = 1106
	PipeError                     int32 = 1107
	PipeserverError               int32 = 1108
	VerifyMetadataError           int32 = 1109

	UdfLoadClassError        int32 = 1200
	UdfDownloadError         int32 = 1201
	CreateUdfOnDatanodeError int32 = 1202
	DropUdfOnDatanodeError   int32 = 1203

	CreateTriggerError         int32 = 1300
	DropTriggerError           int32 = 1301
	TriggerFireError           int32 = 1302
	TriggerLoadClassError      int32 = 1303
	TriggerDownloadError       int32 = 1304
	CreateTriggerInstanceError int32 = 1305
	ActiveTriggerInstanceError int32 = 1306
	DropTriggerInstanceError   int32 = 1307
	UpdateTriggerLocationError int32 = 1308

	NoSuchCq                  int32 = 1400
	CqAlreadyActive           int32 = 1401
	CqAlreadyExist            int32 = 1402
	CqUpdateLastExecTimeError int32 = 1403
)

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 *common.TSStatus) error

Types

type BatchError

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

func NewBatchError

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

func (*BatchError) Error

func (e *BatchError) Error() string

func (*BatchError) GetStatuses

func (e *BatchError) GetStatuses() []*common.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.IClientRPCServiceClient, 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 *common.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 *common.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 *common.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 *common.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 *common.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 *common.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 *common.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 *common.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) ExecuteAggregationQuery added in v1.1.5

func (s *Session) ExecuteAggregationQuery(paths []string, aggregations []common.TAggregationType,
	startTime *int64, endTime *int64, interval *int64,
	timeoutMs *int64) (*SessionDataSet, error)

func (*Session) ExecuteBatchStatement

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

func (*Session) ExecuteNonQueryStatement added in v1.0.0

func (s *Session) ExecuteNonQueryStatement(sql string) (r *common.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) FastInsertRecords added in v1.1.7

func (s *Session) FastInsertRecords(deviceIds []string,
	dataTypes [][]TSDataType,
	values [][]interface{},
	timestamps []int64) (r *common.TSStatus, err 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 *common.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 *common.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 *common.TSStatus, err error)

func (*Session) InsertAlignedTablet added in v0.13.0

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

func (*Session) InsertAlignedTablets added in v0.13.0

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

func (*Session) InsertRecord

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

func (*Session) InsertRecords

func (s *Session) InsertRecords(deviceIds []string, measurements [][]string, dataTypes [][]TSDataType, values [][]interface{},
	timestamps []int64) (r *common.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 *common.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 *common.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 *common.TSStatus, err error)

func (*Session) InsertTablets

func (s *Session) InsertTablets(tablets []*Tablet, sorted bool) (r *common.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 *common.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 *common.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.IClientRPCServiceClient, 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
	ZSTD         TSCompressionType = 8
)

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