Documentation
¶
Overview ¶
Package types 提供所有数据类型的定义和转换工具。
本包包含:
- protobuf 生成的消息类型(来自 microts.proto)
- 类型转换工具函数
类型分类:
基础类型:Point, PointRow, FieldValue, FieldType gRPC 消息:WriteRequest, WriteResponse, QueryRangeRequest, etc. 配置类型:Config, MemTableConfig 元数据类型:MeasurementMeta, FieldDef
时间单位:
所有时间戳和时间间隔都使用纳秒(int64)。 转换辅助函数提供帮助从 time.Duration 转换。
Index ¶
- Constants
- Variables
- func RegisterMicroTSServer(s grpc.ServiceRegistrar, srv MicroTSServer)
- type CompactionConfig
- type Config
- func (*Config) Descriptor() ([]byte, []int)deprecated
- func (x *Config) GetDataDir() string
- func (x *Config) GetMemTableCfg() *MemTableConfig
- func (c *Config) GetShardDuration() time.Duration
- func (x *Config) GetShardDurationNanos() int64
- func (*Config) ProtoMessage()
- func (x *Config) ProtoReflect() protoreflect.Message
- func (x *Config) Reset()
- func (c *Config) SetShardDuration(d time.Duration)
- func (x *Config) String() string
- type CreateDatabaseRequest
- func (*CreateDatabaseRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateDatabaseRequest) GetDatabase() string
- func (*CreateDatabaseRequest) ProtoMessage()
- func (x *CreateDatabaseRequest) ProtoReflect() protoreflect.Message
- func (x *CreateDatabaseRequest) Reset()
- func (x *CreateDatabaseRequest) String() string
- type CreateDatabaseResponse
- func (*CreateDatabaseResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreateDatabaseResponse) GetError() string
- func (x *CreateDatabaseResponse) GetSuccess() bool
- func (*CreateDatabaseResponse) ProtoMessage()
- func (x *CreateDatabaseResponse) ProtoReflect() protoreflect.Message
- func (x *CreateDatabaseResponse) Reset()
- func (x *CreateDatabaseResponse) String() string
- type CreateMeasurementRequest
- func (*CreateMeasurementRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateMeasurementRequest) GetDatabase() string
- func (x *CreateMeasurementRequest) GetMeasurement() string
- func (*CreateMeasurementRequest) ProtoMessage()
- func (x *CreateMeasurementRequest) ProtoReflect() protoreflect.Message
- func (x *CreateMeasurementRequest) Reset()
- func (x *CreateMeasurementRequest) String() string
- type CreateMeasurementResponse
- func (*CreateMeasurementResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreateMeasurementResponse) GetError() string
- func (x *CreateMeasurementResponse) GetSuccess() bool
- func (*CreateMeasurementResponse) ProtoMessage()
- func (x *CreateMeasurementResponse) ProtoReflect() protoreflect.Message
- func (x *CreateMeasurementResponse) Reset()
- func (x *CreateMeasurementResponse) String() string
- type DropDatabaseRequest
- func (*DropDatabaseRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DropDatabaseRequest) GetDatabase() string
- func (*DropDatabaseRequest) ProtoMessage()
- func (x *DropDatabaseRequest) ProtoReflect() protoreflect.Message
- func (x *DropDatabaseRequest) Reset()
- func (x *DropDatabaseRequest) String() string
- type DropDatabaseResponse
- func (*DropDatabaseResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DropDatabaseResponse) GetError() string
- func (x *DropDatabaseResponse) GetSuccess() bool
- func (*DropDatabaseResponse) ProtoMessage()
- func (x *DropDatabaseResponse) ProtoReflect() protoreflect.Message
- func (x *DropDatabaseResponse) Reset()
- func (x *DropDatabaseResponse) String() string
- type DropMeasurementRequest
- func (*DropMeasurementRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DropMeasurementRequest) GetDatabase() string
- func (x *DropMeasurementRequest) GetMeasurement() string
- func (*DropMeasurementRequest) ProtoMessage()
- func (x *DropMeasurementRequest) ProtoReflect() protoreflect.Message
- func (x *DropMeasurementRequest) Reset()
- func (x *DropMeasurementRequest) String() string
- type DropMeasurementResponse
- func (*DropMeasurementResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DropMeasurementResponse) GetError() string
- func (x *DropMeasurementResponse) GetSuccess() bool
- func (*DropMeasurementResponse) ProtoMessage()
- func (x *DropMeasurementResponse) ProtoReflect() protoreflect.Message
- func (x *DropMeasurementResponse) Reset()
- func (x *DropMeasurementResponse) String() string
- type FieldValue
- func (*FieldValue) Descriptor() ([]byte, []int)deprecated
- func (x *FieldValue) GetBoolValue() bool
- func (x *FieldValue) GetFloatValue() float64
- func (x *FieldValue) GetIntValue() int64
- func (x *FieldValue) GetStringValue() string
- func (x *FieldValue) GetValue() isFieldValue_Value
- func (*FieldValue) ProtoMessage()
- func (x *FieldValue) ProtoReflect() protoreflect.Message
- func (x *FieldValue) Reset()
- func (x *FieldValue) String() string
- type FieldValue_BoolValue
- type FieldValue_FloatValue
- type FieldValue_IntValue
- type FieldValue_StringValue
- type HealthRequest
- type HealthResponse
- func (*HealthResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HealthResponse) GetHealthy() bool
- func (x *HealthResponse) GetVersion() string
- func (*HealthResponse) ProtoMessage()
- func (x *HealthResponse) ProtoReflect() protoreflect.Message
- func (x *HealthResponse) Reset()
- func (x *HealthResponse) String() string
- type ListDatabasesRequest
- type ListDatabasesResponse
- func (*ListDatabasesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListDatabasesResponse) GetDatabases() []string
- func (*ListDatabasesResponse) ProtoMessage()
- func (x *ListDatabasesResponse) ProtoReflect() protoreflect.Message
- func (x *ListDatabasesResponse) Reset()
- func (x *ListDatabasesResponse) String() string
- type ListMeasurementsRequest
- func (*ListMeasurementsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListMeasurementsRequest) GetDatabase() string
- func (*ListMeasurementsRequest) ProtoMessage()
- func (x *ListMeasurementsRequest) ProtoReflect() protoreflect.Message
- func (x *ListMeasurementsRequest) Reset()
- func (x *ListMeasurementsRequest) String() string
- type ListMeasurementsResponse
- func (*ListMeasurementsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListMeasurementsResponse) GetMeasurements() []string
- func (*ListMeasurementsResponse) ProtoMessage()
- func (x *ListMeasurementsResponse) ProtoReflect() protoreflect.Message
- func (x *ListMeasurementsResponse) Reset()
- func (x *ListMeasurementsResponse) String() string
- type MemTableConfig
- func (*MemTableConfig) Descriptor() ([]byte, []int)deprecated
- func (c *MemTableConfig) GetIdleDuration() time.Duration
- func (x *MemTableConfig) GetIdleDurationNanos() int64
- func (x *MemTableConfig) GetMaxCount() int32
- func (x *MemTableConfig) GetMaxSize() int64
- func (*MemTableConfig) ProtoMessage()
- func (x *MemTableConfig) ProtoReflect() protoreflect.Message
- func (x *MemTableConfig) Reset()
- func (c *MemTableConfig) SetIdleDuration(d time.Duration)
- func (x *MemTableConfig) String() string
- type MicroTSClient
- type MicroTSServer
- type Point
- func (*Point) Descriptor() ([]byte, []int)deprecated
- func (x *Point) GetDatabase() string
- func (p *Point) GetField(name string) any
- func (x *Point) GetFields() map[string]*FieldValue
- func (x *Point) GetMeasurement() string
- func (x *Point) GetTags() map[string]string
- func (x *Point) GetTimestamp() int64
- func (*Point) ProtoMessage()
- func (x *Point) ProtoReflect() protoreflect.Message
- func (x *Point) Reset()
- func (p *Point) SetField(name string, value any)
- func (x *Point) String() string
- type PointRow
- func (*PointRow) Descriptor() ([]byte, []int)deprecated
- func (p *PointRow) GetField(name string) any
- func (x *PointRow) GetFields() map[string]*FieldValue
- func (x *PointRow) GetSid() uint64
- func (x *PointRow) GetTags() map[string]string
- func (x *PointRow) GetTimestamp() int64
- func (*PointRow) ProtoMessage()
- func (x *PointRow) ProtoReflect() protoreflect.Message
- func (x *PointRow) Reset()
- func (p *PointRow) SetField(name string, value any)
- func (x *PointRow) String() string
- func (p *PointRow) ToPoint(database, measurement string) *Point
- type QueryRangeRequest
- func (*QueryRangeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryRangeRequest) GetDatabase() string
- func (x *QueryRangeRequest) GetEndTime() int64
- func (x *QueryRangeRequest) GetFields() []string
- func (x *QueryRangeRequest) GetLimit() int64
- func (x *QueryRangeRequest) GetMeasurement() string
- func (x *QueryRangeRequest) GetOffset() int64
- func (x *QueryRangeRequest) GetStartTime() int64
- func (x *QueryRangeRequest) GetTags() map[string]string
- func (*QueryRangeRequest) ProtoMessage()
- func (x *QueryRangeRequest) ProtoReflect() protoreflect.Message
- func (x *QueryRangeRequest) Reset()
- func (x *QueryRangeRequest) String() string
- type QueryRangeResponse
- func (*QueryRangeResponse) Descriptor() ([]byte, []int)deprecated
- func (x *QueryRangeResponse) GetDatabase() string
- func (x *QueryRangeResponse) GetEndTime() int64
- func (x *QueryRangeResponse) GetHasMore() bool
- func (x *QueryRangeResponse) GetMeasurement() string
- func (x *QueryRangeResponse) GetRows() []*Row
- func (x *QueryRangeResponse) GetStartTime() int64
- func (x *QueryRangeResponse) GetTotalCount() int64
- func (*QueryRangeResponse) ProtoMessage()
- func (x *QueryRangeResponse) ProtoReflect() protoreflect.Message
- func (x *QueryRangeResponse) Reset()
- func (x *QueryRangeResponse) String() string
- type Row
- func (*Row) Descriptor() ([]byte, []int)deprecated
- func (x *Row) GetFields() map[string]*FieldValue
- func (x *Row) GetTags() map[string]string
- func (x *Row) GetTimestamp() int64
- func (*Row) ProtoMessage()
- func (x *Row) ProtoReflect() protoreflect.Message
- func (x *Row) Reset()
- func (x *Row) String() string
- type UnimplementedMicroTSServer
- func (UnimplementedMicroTSServer) CreateDatabase(context.Context, *CreateDatabaseRequest) (*CreateDatabaseResponse, error)
- func (UnimplementedMicroTSServer) CreateMeasurement(context.Context, *CreateMeasurementRequest) (*CreateMeasurementResponse, error)
- func (UnimplementedMicroTSServer) DropDatabase(context.Context, *DropDatabaseRequest) (*DropDatabaseResponse, error)
- func (UnimplementedMicroTSServer) DropMeasurement(context.Context, *DropMeasurementRequest) (*DropMeasurementResponse, error)
- func (UnimplementedMicroTSServer) Health(context.Context, *HealthRequest) (*HealthResponse, error)
- func (UnimplementedMicroTSServer) ListDatabases(context.Context, *ListDatabasesRequest) (*ListDatabasesResponse, error)
- func (UnimplementedMicroTSServer) ListMeasurements(context.Context, *ListMeasurementsRequest) (*ListMeasurementsResponse, error)
- func (UnimplementedMicroTSServer) QueryRange(context.Context, *QueryRangeRequest) (*QueryRangeResponse, error)
- func (UnimplementedMicroTSServer) Write(context.Context, *WriteRequest) (*WriteResponse, error)
- func (UnimplementedMicroTSServer) WriteBatch(context.Context, *WriteBatchRequest) (*WriteBatchResponse, error)
- type UnsafeMicroTSServer
- type WriteBatchRequest
- func (*WriteBatchRequest) Descriptor() ([]byte, []int)deprecated
- func (x *WriteBatchRequest) GetPoints() []*WriteRequest
- func (*WriteBatchRequest) ProtoMessage()
- func (x *WriteBatchRequest) ProtoReflect() protoreflect.Message
- func (x *WriteBatchRequest) Reset()
- func (x *WriteBatchRequest) String() string
- type WriteBatchResponse
- func (*WriteBatchResponse) Descriptor() ([]byte, []int)deprecated
- func (x *WriteBatchResponse) GetCount() int32
- func (x *WriteBatchResponse) GetError() string
- func (x *WriteBatchResponse) GetSuccess() bool
- func (*WriteBatchResponse) ProtoMessage()
- func (x *WriteBatchResponse) ProtoReflect() protoreflect.Message
- func (x *WriteBatchResponse) Reset()
- func (x *WriteBatchResponse) String() string
- type WriteRequest
- func (*WriteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *WriteRequest) GetDatabase() string
- func (x *WriteRequest) GetFields() map[string]*FieldValue
- func (x *WriteRequest) GetMeasurement() string
- func (x *WriteRequest) GetTags() map[string]string
- func (x *WriteRequest) GetTimestamp() int64
- func (*WriteRequest) ProtoMessage()
- func (x *WriteRequest) ProtoReflect() protoreflect.Message
- func (x *WriteRequest) Reset()
- func (x *WriteRequest) String() string
- type WriteResponse
- func (*WriteResponse) Descriptor() ([]byte, []int)deprecated
- func (x *WriteResponse) GetError() string
- func (x *WriteResponse) GetSuccess() bool
- func (*WriteResponse) ProtoMessage()
- func (x *WriteResponse) ProtoReflect() protoreflect.Message
- func (x *WriteResponse) Reset()
- func (x *WriteResponse) String() string
Constants ¶
const ( MicroTS_Write_FullMethodName = "/microts.v1.MicroTS/Write" MicroTS_WriteBatch_FullMethodName = "/microts.v1.MicroTS/WriteBatch" MicroTS_QueryRange_FullMethodName = "/microts.v1.MicroTS/QueryRange" MicroTS_ListMeasurements_FullMethodName = "/microts.v1.MicroTS/ListMeasurements" MicroTS_CreateMeasurement_FullMethodName = "/microts.v1.MicroTS/CreateMeasurement" MicroTS_DropMeasurement_FullMethodName = "/microts.v1.MicroTS/DropMeasurement" MicroTS_ListDatabases_FullMethodName = "/microts.v1.MicroTS/ListDatabases" MicroTS_CreateDatabase_FullMethodName = "/microts.v1.MicroTS/CreateDatabase" MicroTS_DropDatabase_FullMethodName = "/microts.v1.MicroTS/DropDatabase" MicroTS_Health_FullMethodName = "/microts.v1.MicroTS/Health" )
Variables ¶
var File_microts_proto protoreflect.FileDescriptor
var MicroTS_ServiceDesc = grpc.ServiceDesc{ ServiceName: "microts.v1.MicroTS", HandlerType: (*MicroTSServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Write", Handler: _MicroTS_Write_Handler, }, { MethodName: "WriteBatch", Handler: _MicroTS_WriteBatch_Handler, }, { MethodName: "QueryRange", Handler: _MicroTS_QueryRange_Handler, }, { MethodName: "ListMeasurements", Handler: _MicroTS_ListMeasurements_Handler, }, { MethodName: "CreateMeasurement", Handler: _MicroTS_CreateMeasurement_Handler, }, { MethodName: "DropMeasurement", Handler: _MicroTS_DropMeasurement_Handler, }, { MethodName: "ListDatabases", Handler: _MicroTS_ListDatabases_Handler, }, { MethodName: "CreateDatabase", Handler: _MicroTS_CreateDatabase_Handler, }, { MethodName: "DropDatabase", Handler: _MicroTS_DropDatabase_Handler, }, { MethodName: "Health", Handler: _MicroTS_Health_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "microts.proto", }
MicroTS_ServiceDesc is the grpc.ServiceDesc for MicroTS service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMicroTSServer ¶
func RegisterMicroTSServer(s grpc.ServiceRegistrar, srv MicroTSServer)
Types ¶
type CompactionConfig ¶
type CompactionConfig struct {
// 最大 SSTable 数量,超过此值触发 compaction
MaxSSTableCount int
// 单次 compaction 最大文件数(0 表示不限制)
MaxCompactionBatch int
// 单个 Shard 数据大小上限(字节),超过后不参与 compaction
ShardSizeLimit int64
// 定时触发间隔(0 表示禁用定时触发)
CheckInterval time.Duration
// Compaction 超时时间
Timeout time.Duration
}
CompactionConfig 配置 Compaction 行为。
字段说明:
- MaxSSTableCount: 最大 SSTable 数量,超过此值触发 compaction
- MaxCompactionBatch: 单次 compaction 最大文件数(0 表示不限制)
- ShardSizeLimit: 单个 Shard 数据大小上限(字节),超过后不参与 compaction
- CheckInterval: 定时检查间隔(0 表示禁用定时触发)
- Timeout: Compaction 超时时间
func DefaultCompactionConfig ¶
func DefaultCompactionConfig() *CompactionConfig
DefaultCompactionConfig 返回默认的 Compaction 配置。
type Config ¶
type Config struct {
// 数据目录
DataDir string `protobuf:"bytes,1,opt,name=data_dir,json=dataDir,proto3" json:"data_dir,omitempty"`
// Shard 时间窗口(纳秒)
ShardDurationNanos int64 `protobuf:"varint,2,opt,name=shard_duration_nanos,json=shardDurationNanos,proto3" json:"shard_duration_nanos,omitempty"`
// 内存表配置
MemTableCfg *MemTableConfig `protobuf:"bytes,3,opt,name=mem_table_cfg,json=memTableCfg,proto3" json:"mem_table_cfg,omitempty"`
// contains filtered or unexported fields
}
引擎配置
Config 是数据库的完整配置结构。 这是存储引擎使用的配置,包含数据目录、分片时长和内存表配置。
字段说明:
- data_dir: 数据存储目录路径
- shard_duration_nanos: Shard 时间窗口(纳秒),最小 1 小时
- mem_table_cfg: 内存表配置
ShardDuration 说明:
ShardDuration 控制数据在磁盘上的分片大小。 较小的值会产生更多小文件,利于过期数据快速清理。 较大的值减少文件数量,提高大时间范围查询效率。 建议值:1小时(3600000000000) - 7天(604800000000000)。
func (*Config) Descriptor
deprecated
func (*Config) GetDataDir ¶
func (*Config) GetMemTableCfg ¶
func (x *Config) GetMemTableCfg() *MemTableConfig
func (*Config) GetShardDuration ¶
GetShardDuration 返回 ShardDurationNanos 的 time.Duration 形式。
func (*Config) GetShardDurationNanos ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) ProtoReflect ¶
func (x *Config) ProtoReflect() protoreflect.Message
func (*Config) SetShardDuration ¶
SetShardDuration 设置 ShardDurationNanos。
type CreateDatabaseRequest ¶
type CreateDatabaseRequest struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
// contains filtered or unexported fields
}
创建数据库请求
func (*CreateDatabaseRequest) Descriptor
deprecated
func (*CreateDatabaseRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateDatabaseRequest.ProtoReflect.Descriptor instead.
func (*CreateDatabaseRequest) GetDatabase ¶
func (x *CreateDatabaseRequest) GetDatabase() string
func (*CreateDatabaseRequest) ProtoMessage ¶
func (*CreateDatabaseRequest) ProtoMessage()
func (*CreateDatabaseRequest) ProtoReflect ¶
func (x *CreateDatabaseRequest) ProtoReflect() protoreflect.Message
func (*CreateDatabaseRequest) Reset ¶
func (x *CreateDatabaseRequest) Reset()
func (*CreateDatabaseRequest) String ¶
func (x *CreateDatabaseRequest) String() string
type CreateDatabaseResponse ¶
type CreateDatabaseResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
创建数据库响应
func (*CreateDatabaseResponse) Descriptor
deprecated
func (*CreateDatabaseResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateDatabaseResponse.ProtoReflect.Descriptor instead.
func (*CreateDatabaseResponse) GetError ¶
func (x *CreateDatabaseResponse) GetError() string
func (*CreateDatabaseResponse) GetSuccess ¶
func (x *CreateDatabaseResponse) GetSuccess() bool
func (*CreateDatabaseResponse) ProtoMessage ¶
func (*CreateDatabaseResponse) ProtoMessage()
func (*CreateDatabaseResponse) ProtoReflect ¶
func (x *CreateDatabaseResponse) ProtoReflect() protoreflect.Message
func (*CreateDatabaseResponse) Reset ¶
func (x *CreateDatabaseResponse) Reset()
func (*CreateDatabaseResponse) String ¶
func (x *CreateDatabaseResponse) String() string
type CreateMeasurementRequest ¶
type CreateMeasurementRequest struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"`
// contains filtered or unexported fields
}
创建 Measurement 请求
func (*CreateMeasurementRequest) Descriptor
deprecated
func (*CreateMeasurementRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateMeasurementRequest.ProtoReflect.Descriptor instead.
func (*CreateMeasurementRequest) GetDatabase ¶
func (x *CreateMeasurementRequest) GetDatabase() string
func (*CreateMeasurementRequest) GetMeasurement ¶
func (x *CreateMeasurementRequest) GetMeasurement() string
func (*CreateMeasurementRequest) ProtoMessage ¶
func (*CreateMeasurementRequest) ProtoMessage()
func (*CreateMeasurementRequest) ProtoReflect ¶
func (x *CreateMeasurementRequest) ProtoReflect() protoreflect.Message
func (*CreateMeasurementRequest) Reset ¶
func (x *CreateMeasurementRequest) Reset()
func (*CreateMeasurementRequest) String ¶
func (x *CreateMeasurementRequest) String() string
type CreateMeasurementResponse ¶
type CreateMeasurementResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
创建 Measurement 响应
func (*CreateMeasurementResponse) Descriptor
deprecated
func (*CreateMeasurementResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateMeasurementResponse.ProtoReflect.Descriptor instead.
func (*CreateMeasurementResponse) GetError ¶
func (x *CreateMeasurementResponse) GetError() string
func (*CreateMeasurementResponse) GetSuccess ¶
func (x *CreateMeasurementResponse) GetSuccess() bool
func (*CreateMeasurementResponse) ProtoMessage ¶
func (*CreateMeasurementResponse) ProtoMessage()
func (*CreateMeasurementResponse) ProtoReflect ¶
func (x *CreateMeasurementResponse) ProtoReflect() protoreflect.Message
func (*CreateMeasurementResponse) Reset ¶
func (x *CreateMeasurementResponse) Reset()
func (*CreateMeasurementResponse) String ¶
func (x *CreateMeasurementResponse) String() string
type DropDatabaseRequest ¶
type DropDatabaseRequest struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
// contains filtered or unexported fields
}
删除数据库请求
func (*DropDatabaseRequest) Descriptor
deprecated
func (*DropDatabaseRequest) Descriptor() ([]byte, []int)
Deprecated: Use DropDatabaseRequest.ProtoReflect.Descriptor instead.
func (*DropDatabaseRequest) GetDatabase ¶
func (x *DropDatabaseRequest) GetDatabase() string
func (*DropDatabaseRequest) ProtoMessage ¶
func (*DropDatabaseRequest) ProtoMessage()
func (*DropDatabaseRequest) ProtoReflect ¶
func (x *DropDatabaseRequest) ProtoReflect() protoreflect.Message
func (*DropDatabaseRequest) Reset ¶
func (x *DropDatabaseRequest) Reset()
func (*DropDatabaseRequest) String ¶
func (x *DropDatabaseRequest) String() string
type DropDatabaseResponse ¶
type DropDatabaseResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
删除数据库响应
func (*DropDatabaseResponse) Descriptor
deprecated
func (*DropDatabaseResponse) Descriptor() ([]byte, []int)
Deprecated: Use DropDatabaseResponse.ProtoReflect.Descriptor instead.
func (*DropDatabaseResponse) GetError ¶
func (x *DropDatabaseResponse) GetError() string
func (*DropDatabaseResponse) GetSuccess ¶
func (x *DropDatabaseResponse) GetSuccess() bool
func (*DropDatabaseResponse) ProtoMessage ¶
func (*DropDatabaseResponse) ProtoMessage()
func (*DropDatabaseResponse) ProtoReflect ¶
func (x *DropDatabaseResponse) ProtoReflect() protoreflect.Message
func (*DropDatabaseResponse) Reset ¶
func (x *DropDatabaseResponse) Reset()
func (*DropDatabaseResponse) String ¶
func (x *DropDatabaseResponse) String() string
type DropMeasurementRequest ¶
type DropMeasurementRequest struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"`
// contains filtered or unexported fields
}
删除 Measurement 请求
func (*DropMeasurementRequest) Descriptor
deprecated
func (*DropMeasurementRequest) Descriptor() ([]byte, []int)
Deprecated: Use DropMeasurementRequest.ProtoReflect.Descriptor instead.
func (*DropMeasurementRequest) GetDatabase ¶
func (x *DropMeasurementRequest) GetDatabase() string
func (*DropMeasurementRequest) GetMeasurement ¶
func (x *DropMeasurementRequest) GetMeasurement() string
func (*DropMeasurementRequest) ProtoMessage ¶
func (*DropMeasurementRequest) ProtoMessage()
func (*DropMeasurementRequest) ProtoReflect ¶
func (x *DropMeasurementRequest) ProtoReflect() protoreflect.Message
func (*DropMeasurementRequest) Reset ¶
func (x *DropMeasurementRequest) Reset()
func (*DropMeasurementRequest) String ¶
func (x *DropMeasurementRequest) String() string
type DropMeasurementResponse ¶
type DropMeasurementResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
删除 Measurement 响应
func (*DropMeasurementResponse) Descriptor
deprecated
func (*DropMeasurementResponse) Descriptor() ([]byte, []int)
Deprecated: Use DropMeasurementResponse.ProtoReflect.Descriptor instead.
func (*DropMeasurementResponse) GetError ¶
func (x *DropMeasurementResponse) GetError() string
func (*DropMeasurementResponse) GetSuccess ¶
func (x *DropMeasurementResponse) GetSuccess() bool
func (*DropMeasurementResponse) ProtoMessage ¶
func (*DropMeasurementResponse) ProtoMessage()
func (*DropMeasurementResponse) ProtoReflect ¶
func (x *DropMeasurementResponse) ProtoReflect() protoreflect.Message
func (*DropMeasurementResponse) Reset ¶
func (x *DropMeasurementResponse) Reset()
func (*DropMeasurementResponse) String ¶
func (x *DropMeasurementResponse) String() string
type FieldValue ¶
type FieldValue struct {
// Types that are valid to be assigned to Value:
//
// *FieldValue_IntValue
// *FieldValue_FloatValue
// *FieldValue_StringValue
// *FieldValue_BoolValue
Value isFieldValue_Value `protobuf_oneof:"value"`
// contains filtered or unexported fields
}
字段值
Point 的字段值使用 oneof 支持多种数据类型。 存储引擎会根据值的实际类型进行相应的编码和处理。
支持的类型:
- int_value: 64位有符号整数,适用于计数器、ID 等
- float_value: 64位浮点数,适用于温度、电压等连续值
- string_value: 可变长度字符串,适用于状态描述
- bool_value: 布尔值,适用于开关状态
类型说明:
写入时根据值的类型自动选择对应的字段。 查询时根据实际存储的类型返回相应值。
func NewFieldValue ¶
func NewFieldValue(v any) *FieldValue
NewFieldValue 从任何值创建 FieldValue。
支持的类型:int64, float64, string, bool。 如果类型不支持,返回 nil。
func (*FieldValue) Descriptor
deprecated
func (*FieldValue) Descriptor() ([]byte, []int)
Deprecated: Use FieldValue.ProtoReflect.Descriptor instead.
func (*FieldValue) GetBoolValue ¶
func (x *FieldValue) GetBoolValue() bool
func (*FieldValue) GetFloatValue ¶
func (x *FieldValue) GetFloatValue() float64
func (*FieldValue) GetIntValue ¶
func (x *FieldValue) GetIntValue() int64
func (*FieldValue) GetStringValue ¶
func (x *FieldValue) GetStringValue() string
func (*FieldValue) GetValue ¶
func (x *FieldValue) GetValue() isFieldValue_Value
func (*FieldValue) ProtoMessage ¶
func (*FieldValue) ProtoMessage()
func (*FieldValue) ProtoReflect ¶
func (x *FieldValue) ProtoReflect() protoreflect.Message
func (*FieldValue) Reset ¶
func (x *FieldValue) Reset()
func (*FieldValue) String ¶
func (x *FieldValue) String() string
type FieldValue_BoolValue ¶
type FieldValue_BoolValue struct {
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
}
type FieldValue_FloatValue ¶
type FieldValue_FloatValue struct {
FloatValue float64 `protobuf:"fixed64,2,opt,name=float_value,json=floatValue,proto3,oneof"`
}
type FieldValue_IntValue ¶
type FieldValue_IntValue struct {
IntValue int64 `protobuf:"varint,1,opt,name=int_value,json=intValue,proto3,oneof"`
}
type FieldValue_StringValue ¶
type FieldValue_StringValue struct {
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
}
type HealthRequest ¶
type HealthRequest struct {
// contains filtered or unexported fields
}
健康检查请求
func (*HealthRequest) Descriptor
deprecated
func (*HealthRequest) Descriptor() ([]byte, []int)
Deprecated: Use HealthRequest.ProtoReflect.Descriptor instead.
func (*HealthRequest) ProtoMessage ¶
func (*HealthRequest) ProtoMessage()
func (*HealthRequest) ProtoReflect ¶
func (x *HealthRequest) ProtoReflect() protoreflect.Message
func (*HealthRequest) Reset ¶
func (x *HealthRequest) Reset()
func (*HealthRequest) String ¶
func (x *HealthRequest) String() string
type HealthResponse ¶
type HealthResponse struct {
Healthy bool `protobuf:"varint,1,opt,name=healthy,proto3" json:"healthy,omitempty"`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
// contains filtered or unexported fields
}
健康检查响应
func (*HealthResponse) Descriptor
deprecated
func (*HealthResponse) Descriptor() ([]byte, []int)
Deprecated: Use HealthResponse.ProtoReflect.Descriptor instead.
func (*HealthResponse) GetHealthy ¶
func (x *HealthResponse) GetHealthy() bool
func (*HealthResponse) GetVersion ¶
func (x *HealthResponse) GetVersion() string
func (*HealthResponse) ProtoMessage ¶
func (*HealthResponse) ProtoMessage()
func (*HealthResponse) ProtoReflect ¶
func (x *HealthResponse) ProtoReflect() protoreflect.Message
func (*HealthResponse) Reset ¶
func (x *HealthResponse) Reset()
func (*HealthResponse) String ¶
func (x *HealthResponse) String() string
type ListDatabasesRequest ¶
type ListDatabasesRequest struct {
// contains filtered or unexported fields
}
列出数据库请求
func (*ListDatabasesRequest) Descriptor
deprecated
func (*ListDatabasesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListDatabasesRequest.ProtoReflect.Descriptor instead.
func (*ListDatabasesRequest) ProtoMessage ¶
func (*ListDatabasesRequest) ProtoMessage()
func (*ListDatabasesRequest) ProtoReflect ¶
func (x *ListDatabasesRequest) ProtoReflect() protoreflect.Message
func (*ListDatabasesRequest) Reset ¶
func (x *ListDatabasesRequest) Reset()
func (*ListDatabasesRequest) String ¶
func (x *ListDatabasesRequest) String() string
type ListDatabasesResponse ¶
type ListDatabasesResponse struct {
Databases []string `protobuf:"bytes,1,rep,name=databases,proto3" json:"databases,omitempty"`
// contains filtered or unexported fields
}
列出数据库响应
func (*ListDatabasesResponse) Descriptor
deprecated
func (*ListDatabasesResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListDatabasesResponse.ProtoReflect.Descriptor instead.
func (*ListDatabasesResponse) GetDatabases ¶
func (x *ListDatabasesResponse) GetDatabases() []string
func (*ListDatabasesResponse) ProtoMessage ¶
func (*ListDatabasesResponse) ProtoMessage()
func (*ListDatabasesResponse) ProtoReflect ¶
func (x *ListDatabasesResponse) ProtoReflect() protoreflect.Message
func (*ListDatabasesResponse) Reset ¶
func (x *ListDatabasesResponse) Reset()
func (*ListDatabasesResponse) String ¶
func (x *ListDatabasesResponse) String() string
type ListMeasurementsRequest ¶
type ListMeasurementsRequest struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
// contains filtered or unexported fields
}
列出 Measurement 请求
func (*ListMeasurementsRequest) Descriptor
deprecated
func (*ListMeasurementsRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListMeasurementsRequest.ProtoReflect.Descriptor instead.
func (*ListMeasurementsRequest) GetDatabase ¶
func (x *ListMeasurementsRequest) GetDatabase() string
func (*ListMeasurementsRequest) ProtoMessage ¶
func (*ListMeasurementsRequest) ProtoMessage()
func (*ListMeasurementsRequest) ProtoReflect ¶
func (x *ListMeasurementsRequest) ProtoReflect() protoreflect.Message
func (*ListMeasurementsRequest) Reset ¶
func (x *ListMeasurementsRequest) Reset()
func (*ListMeasurementsRequest) String ¶
func (x *ListMeasurementsRequest) String() string
type ListMeasurementsResponse ¶
type ListMeasurementsResponse struct {
Measurements []string `protobuf:"bytes,1,rep,name=measurements,proto3" json:"measurements,omitempty"`
// contains filtered or unexported fields
}
列出 Measurement 响应
func (*ListMeasurementsResponse) Descriptor
deprecated
func (*ListMeasurementsResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListMeasurementsResponse.ProtoReflect.Descriptor instead.
func (*ListMeasurementsResponse) GetMeasurements ¶
func (x *ListMeasurementsResponse) GetMeasurements() []string
func (*ListMeasurementsResponse) ProtoMessage ¶
func (*ListMeasurementsResponse) ProtoMessage()
func (*ListMeasurementsResponse) ProtoReflect ¶
func (x *ListMeasurementsResponse) ProtoReflect() protoreflect.Message
func (*ListMeasurementsResponse) Reset ¶
func (x *ListMeasurementsResponse) Reset()
func (*ListMeasurementsResponse) String ¶
func (x *ListMeasurementsResponse) String() string
type MemTableConfig ¶
type MemTableConfig struct {
// 最大内存大小(字节),默认 64MB
MaxSize int64 `protobuf:"varint,1,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
// 最大条目数,默认 3000
MaxCount int32 `protobuf:"varint,2,opt,name=max_count,json=maxCount,proto3" json:"max_count,omitempty"`
// 空闲时间阈值(纳秒),默认 60秒
IdleDurationNanos int64 `protobuf:"varint,3,opt,name=idle_duration_nanos,json=idleDurationNanos,proto3" json:"idle_duration_nanos,omitempty"`
// contains filtered or unexported fields
}
内存表配置
内存表(MemTable)是写入缓冲区,数据先写入 MemTable, 当满足任一条件时刷新到 SSTable。
刷新条件(满足任一即触发):
- max_size: 内存占用(估算)达到上限
- max_count: 条目数达到上限
- idle_duration_nanos: 超过空闲时间没有新数据写入(纳秒)
性能调优建议:
增加 max_size 可以减少刷盘频率,但会增加内存占用和恢复时间。 减少 idle_duration 可以更快释放内存,但会增加小文件数量。 max_count 主要作为后备保护。
默认值:
- max_size: 64MB
- max_count: 3000
- idle_duration_nanos: 60秒(60000000000纳秒)
func DefaultMemTableConfig ¶
func DefaultMemTableConfig() *MemTableConfig
DefaultMemTableConfig 返回默认的 MemTableConfig。
默认配置:
- MaxSize: 64MB
- MaxCount: 3000
- IdleDuration: 1分钟
func (*MemTableConfig) Descriptor
deprecated
func (*MemTableConfig) Descriptor() ([]byte, []int)
Deprecated: Use MemTableConfig.ProtoReflect.Descriptor instead.
func (*MemTableConfig) GetIdleDuration ¶
func (c *MemTableConfig) GetIdleDuration() time.Duration
GetIdleDuration 返回 IdleDurationNanos 的 time.Duration 形式。
func (*MemTableConfig) GetIdleDurationNanos ¶
func (x *MemTableConfig) GetIdleDurationNanos() int64
func (*MemTableConfig) GetMaxCount ¶
func (x *MemTableConfig) GetMaxCount() int32
func (*MemTableConfig) GetMaxSize ¶
func (x *MemTableConfig) GetMaxSize() int64
func (*MemTableConfig) ProtoMessage ¶
func (*MemTableConfig) ProtoMessage()
func (*MemTableConfig) ProtoReflect ¶
func (x *MemTableConfig) ProtoReflect() protoreflect.Message
func (*MemTableConfig) Reset ¶
func (x *MemTableConfig) Reset()
func (*MemTableConfig) SetIdleDuration ¶
func (c *MemTableConfig) SetIdleDuration(d time.Duration)
SetIdleDuration 设置 IdleDurationNanos。
func (*MemTableConfig) String ¶
func (x *MemTableConfig) String() string
type MicroTSClient ¶
type MicroTSClient interface {
// 单点写入
//
// 将单个数据点写入时序数据库。
// 数据首先写入 WAL,然后写入 MemTable。
Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error)
// 批量写入
//
// 批量写入多个数据点,吞吐量通常比单点写入高。
// 批量写入不是原子操作,部分失败不会回滚已写入的点。
WriteBatch(ctx context.Context, in *WriteBatchRequest, opts ...grpc.CallOption) (*WriteBatchResponse, error)
// 范围查询
//
// 查询指定时间范围内的数据,支持字段过滤、标签过滤和分页。
// 数据按时间戳升序返回。
QueryRange(ctx context.Context, in *QueryRangeRequest, opts ...grpc.CallOption) (*QueryRangeResponse, error)
// 列出 Measurement
//
// 返回指定数据库中的所有 Measurement 名称。
// 如果数据库不存在,返回空列表。
ListMeasurements(ctx context.Context, in *ListMeasurementsRequest, opts ...grpc.CallOption) (*ListMeasurementsResponse, error)
// 创建 Measurement
//
// 在指定数据库中创建一个新的 Measurement。
// 如果数据库不存在,会自动创建。
// 如果 Measurement 已存在,不会返回错误。
CreateMeasurement(ctx context.Context, in *CreateMeasurementRequest, opts ...grpc.CallOption) (*CreateMeasurementResponse, error)
// 删除 Measurement
//
// 删除指定的 Measurement 及其所有元数据。
// 注意:磁盘上的数据文件不会被立即删除。
DropMeasurement(ctx context.Context, in *DropMeasurementRequest, opts ...grpc.CallOption) (*DropMeasurementResponse, error)
// 列出数据库
//
// 返回所有数据库名称列表。
ListDatabases(ctx context.Context, in *ListDatabasesRequest, opts ...grpc.CallOption) (*ListDatabasesResponse, error)
// 创建数据库
//
// 创建一个新的数据库。
// 如果数据库已存在,不会返回错误。
CreateDatabase(ctx context.Context, in *CreateDatabaseRequest, opts ...grpc.CallOption) (*CreateDatabaseResponse, error)
// 删除数据库
//
// 删除指定的数据库及其所有 Measurement。
// 警告:此操作会永久删除元数据,且不可恢复。
DropDatabase(ctx context.Context, in *DropDatabaseRequest, opts ...grpc.CallOption) (*DropDatabaseResponse, error)
// 健康检查
//
// 返回服务的健康状态,用于负载均衡器健康检查和监控。
Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error)
}
MicroTSClient is the client API for MicroTS service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
MicroTS 时序数据库服务 ¶
提供完整的时序数据库远程访问接口,包括:
- 数据写入:单点写入、批量写入
- 数据查询:范围查询、分页支持
- 元数据管理:数据库和 Measurement 的增删改查
- 健康检查:服务状态查询
并发安全:
所有 RPC 方法都可以从多个 goroutine 并发调用。 gRPC 框架保证每个请求在独立的 goroutine 中处理。
func NewMicroTSClient ¶
func NewMicroTSClient(cc grpc.ClientConnInterface) MicroTSClient
type MicroTSServer ¶
type MicroTSServer interface {
// 单点写入
//
// 将单个数据点写入时序数据库。
// 数据首先写入 WAL,然后写入 MemTable。
Write(context.Context, *WriteRequest) (*WriteResponse, error)
// 批量写入
//
// 批量写入多个数据点,吞吐量通常比单点写入高。
// 批量写入不是原子操作,部分失败不会回滚已写入的点。
WriteBatch(context.Context, *WriteBatchRequest) (*WriteBatchResponse, error)
// 范围查询
//
// 查询指定时间范围内的数据,支持字段过滤、标签过滤和分页。
// 数据按时间戳升序返回。
QueryRange(context.Context, *QueryRangeRequest) (*QueryRangeResponse, error)
// 列出 Measurement
//
// 返回指定数据库中的所有 Measurement 名称。
// 如果数据库不存在,返回空列表。
ListMeasurements(context.Context, *ListMeasurementsRequest) (*ListMeasurementsResponse, error)
// 创建 Measurement
//
// 在指定数据库中创建一个新的 Measurement。
// 如果数据库不存在,会自动创建。
// 如果 Measurement 已存在,不会返回错误。
CreateMeasurement(context.Context, *CreateMeasurementRequest) (*CreateMeasurementResponse, error)
// 删除 Measurement
//
// 删除指定的 Measurement 及其所有元数据。
// 注意:磁盘上的数据文件不会被立即删除。
DropMeasurement(context.Context, *DropMeasurementRequest) (*DropMeasurementResponse, error)
// 列出数据库
//
// 返回所有数据库名称列表。
ListDatabases(context.Context, *ListDatabasesRequest) (*ListDatabasesResponse, error)
// 创建数据库
//
// 创建一个新的数据库。
// 如果数据库已存在,不会返回错误。
CreateDatabase(context.Context, *CreateDatabaseRequest) (*CreateDatabaseResponse, error)
// 删除数据库
//
// 删除指定的数据库及其所有 Measurement。
// 警告:此操作会永久删除元数据,且不可恢复。
DropDatabase(context.Context, *DropDatabaseRequest) (*DropDatabaseResponse, error)
// 健康检查
//
// 返回服务的健康状态,用于负载均衡器健康检查和监控。
Health(context.Context, *HealthRequest) (*HealthResponse, error)
}
MicroTSServer is the server API for MicroTS service. All implementations should embed UnimplementedMicroTSServer for forward compatibility.
MicroTS 时序数据库服务 ¶
提供完整的时序数据库远程访问接口,包括:
- 数据写入:单点写入、批量写入
- 数据查询:范围查询、分页支持
- 元数据管理:数据库和 Measurement 的增删改查
- 健康检查:服务状态查询
并发安全:
所有 RPC 方法都可以从多个 goroutine 并发调用。 gRPC 框架保证每个请求在独立的 goroutine 中处理。
type Point ¶
type Point struct {
// 数据库名称
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
// 测量名称(类似表名)
Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"`
// 标签键值对,用于标识时间序列
Tags map[string]string `` /* 135-byte string literal not displayed */
// 时间戳,纳秒级 Unix 时间戳
Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// 字段值,存储实际的数据
Fields map[string]*FieldValue `` /* 139-byte string literal not displayed */
// contains filtered or unexported fields
}
数据点
Point 是写入时序数据库的基本数据单元。 每个 Point 代表时间序列中的一个数据点。
必需字段:
- database: 数据库名称,用于隔离不同业务的数据
- measurement: 测量名称,类似关系数据库的表名
- timestamp: 纳秒级 Unix 时间戳
- tags: 标签键值对,用于标识时间序列
- fields: 字段值,存储实际的数据
标签与字段的区别:
标签用于索引和分组,会被存储在 Series Key 中,查询效率高。 字段存储实际数据值,不会被索引,但可以存储大量不同的值。
最佳实践:
标签建议使用 host, region, service 等维度信息。 时间戳推荐使用 time.Now().UnixNano() 获取。
func (*Point) Descriptor
deprecated
func (*Point) GetDatabase ¶
func (*Point) GetFields ¶
func (x *Point) GetFields() map[string]*FieldValue
func (*Point) GetMeasurement ¶
func (*Point) GetTimestamp ¶
func (*Point) ProtoMessage ¶
func (*Point) ProtoMessage()
func (*Point) ProtoReflect ¶
func (x *Point) ProtoReflect() protoreflect.Message
type PointRow ¶
type PointRow struct {
// Series ID,用于内部标识唯一的标签组合
Sid uint64 `protobuf:"varint,1,opt,name=sid,proto3" json:"sid,omitempty"`
// 时间戳
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// 标签键值对
Tags map[string]string `` /* 135-byte string literal not displayed */
// 字段值
Fields map[string]*FieldValue `` /* 139-byte string literal not displayed */
// contains filtered or unexported fields
}
查询结果行
PointRow 是查询结果的单行数据。 相比 Point,PointRow 增加了 SID 字段用于内部标识。
字段说明:
- sid: Series ID,内部生成的序列标识符(从1开始递增)
- timestamp: 数据点的时间戳(纳秒)
- tags: 标签键值对
- fields: 字段值
SID 说明:
SID 由存储引擎为每个唯一的标签组合分配。 相同的标签组合始终对应同一个 SID。 用户通常不需要直接使用此字段。
func (*PointRow) Descriptor
deprecated
func (*PointRow) GetFields ¶
func (x *PointRow) GetFields() map[string]*FieldValue
func (*PointRow) GetTimestamp ¶
func (*PointRow) ProtoMessage ¶
func (*PointRow) ProtoMessage()
func (*PointRow) ProtoReflect ¶
func (x *PointRow) ProtoReflect() protoreflect.Message
type QueryRangeRequest ¶
type QueryRangeRequest struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"`
StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
Fields []string `protobuf:"bytes,5,rep,name=fields,proto3" json:"fields,omitempty"`
Tags map[string]string `` /* 135-byte string literal not displayed */
Offset int64 `protobuf:"varint,7,opt,name=offset,proto3" json:"offset,omitempty"`
Limit int64 `protobuf:"varint,8,opt,name=limit,proto3" json:"limit,omitempty"`
// contains filtered or unexported fields
}
范围查询请求
func (*QueryRangeRequest) Descriptor
deprecated
func (*QueryRangeRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryRangeRequest.ProtoReflect.Descriptor instead.
func (*QueryRangeRequest) GetDatabase ¶
func (x *QueryRangeRequest) GetDatabase() string
func (*QueryRangeRequest) GetEndTime ¶
func (x *QueryRangeRequest) GetEndTime() int64
func (*QueryRangeRequest) GetFields ¶
func (x *QueryRangeRequest) GetFields() []string
func (*QueryRangeRequest) GetLimit ¶
func (x *QueryRangeRequest) GetLimit() int64
func (*QueryRangeRequest) GetMeasurement ¶
func (x *QueryRangeRequest) GetMeasurement() string
func (*QueryRangeRequest) GetOffset ¶
func (x *QueryRangeRequest) GetOffset() int64
func (*QueryRangeRequest) GetStartTime ¶
func (x *QueryRangeRequest) GetStartTime() int64
func (*QueryRangeRequest) GetTags ¶
func (x *QueryRangeRequest) GetTags() map[string]string
func (*QueryRangeRequest) ProtoMessage ¶
func (*QueryRangeRequest) ProtoMessage()
func (*QueryRangeRequest) ProtoReflect ¶
func (x *QueryRangeRequest) ProtoReflect() protoreflect.Message
func (*QueryRangeRequest) Reset ¶
func (x *QueryRangeRequest) Reset()
func (*QueryRangeRequest) String ¶
func (x *QueryRangeRequest) String() string
type QueryRangeResponse ¶
type QueryRangeResponse struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"`
StartTime int64 `protobuf:"varint,3,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
EndTime int64 `protobuf:"varint,4,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
TotalCount int64 `protobuf:"varint,5,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"`
HasMore bool `protobuf:"varint,6,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"`
Rows []*Row `protobuf:"bytes,7,rep,name=rows,proto3" json:"rows,omitempty"`
// contains filtered or unexported fields
}
范围查询响应
func (*QueryRangeResponse) Descriptor
deprecated
func (*QueryRangeResponse) Descriptor() ([]byte, []int)
Deprecated: Use QueryRangeResponse.ProtoReflect.Descriptor instead.
func (*QueryRangeResponse) GetDatabase ¶
func (x *QueryRangeResponse) GetDatabase() string
func (*QueryRangeResponse) GetEndTime ¶
func (x *QueryRangeResponse) GetEndTime() int64
func (*QueryRangeResponse) GetHasMore ¶
func (x *QueryRangeResponse) GetHasMore() bool
func (*QueryRangeResponse) GetMeasurement ¶
func (x *QueryRangeResponse) GetMeasurement() string
func (*QueryRangeResponse) GetRows ¶
func (x *QueryRangeResponse) GetRows() []*Row
func (*QueryRangeResponse) GetStartTime ¶
func (x *QueryRangeResponse) GetStartTime() int64
func (*QueryRangeResponse) GetTotalCount ¶
func (x *QueryRangeResponse) GetTotalCount() int64
func (*QueryRangeResponse) ProtoMessage ¶
func (*QueryRangeResponse) ProtoMessage()
func (*QueryRangeResponse) ProtoReflect ¶
func (x *QueryRangeResponse) ProtoReflect() protoreflect.Message
func (*QueryRangeResponse) Reset ¶
func (x *QueryRangeResponse) Reset()
func (*QueryRangeResponse) String ¶
func (x *QueryRangeResponse) String() string
type Row ¶
type Row struct {
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Tags map[string]string `` /* 135-byte string literal not displayed */
Fields map[string]*FieldValue `` /* 139-byte string literal not displayed */
// contains filtered or unexported fields
}
一行数据(用于查询响应)
func (*Row) Descriptor
deprecated
func (*Row) GetFields ¶
func (x *Row) GetFields() map[string]*FieldValue
func (*Row) GetTimestamp ¶
func (*Row) ProtoMessage ¶
func (*Row) ProtoMessage()
func (*Row) ProtoReflect ¶
func (x *Row) ProtoReflect() protoreflect.Message
type UnimplementedMicroTSServer ¶
type UnimplementedMicroTSServer struct{}
UnimplementedMicroTSServer should be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedMicroTSServer) CreateDatabase ¶
func (UnimplementedMicroTSServer) CreateDatabase(context.Context, *CreateDatabaseRequest) (*CreateDatabaseResponse, error)
func (UnimplementedMicroTSServer) CreateMeasurement ¶
func (UnimplementedMicroTSServer) CreateMeasurement(context.Context, *CreateMeasurementRequest) (*CreateMeasurementResponse, error)
func (UnimplementedMicroTSServer) DropDatabase ¶
func (UnimplementedMicroTSServer) DropDatabase(context.Context, *DropDatabaseRequest) (*DropDatabaseResponse, error)
func (UnimplementedMicroTSServer) DropMeasurement ¶
func (UnimplementedMicroTSServer) DropMeasurement(context.Context, *DropMeasurementRequest) (*DropMeasurementResponse, error)
func (UnimplementedMicroTSServer) Health ¶
func (UnimplementedMicroTSServer) Health(context.Context, *HealthRequest) (*HealthResponse, error)
func (UnimplementedMicroTSServer) ListDatabases ¶
func (UnimplementedMicroTSServer) ListDatabases(context.Context, *ListDatabasesRequest) (*ListDatabasesResponse, error)
func (UnimplementedMicroTSServer) ListMeasurements ¶
func (UnimplementedMicroTSServer) ListMeasurements(context.Context, *ListMeasurementsRequest) (*ListMeasurementsResponse, error)
func (UnimplementedMicroTSServer) QueryRange ¶
func (UnimplementedMicroTSServer) QueryRange(context.Context, *QueryRangeRequest) (*QueryRangeResponse, error)
func (UnimplementedMicroTSServer) Write ¶
func (UnimplementedMicroTSServer) Write(context.Context, *WriteRequest) (*WriteResponse, error)
func (UnimplementedMicroTSServer) WriteBatch ¶
func (UnimplementedMicroTSServer) WriteBatch(context.Context, *WriteBatchRequest) (*WriteBatchResponse, error)
type UnsafeMicroTSServer ¶
type UnsafeMicroTSServer interface {
// contains filtered or unexported methods
}
UnsafeMicroTSServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MicroTSServer will result in compilation errors.
type WriteBatchRequest ¶
type WriteBatchRequest struct {
Points []*WriteRequest `protobuf:"bytes,1,rep,name=points,proto3" json:"points,omitempty"`
// contains filtered or unexported fields
}
批量写入请求
func (*WriteBatchRequest) Descriptor
deprecated
func (*WriteBatchRequest) Descriptor() ([]byte, []int)
Deprecated: Use WriteBatchRequest.ProtoReflect.Descriptor instead.
func (*WriteBatchRequest) GetPoints ¶
func (x *WriteBatchRequest) GetPoints() []*WriteRequest
func (*WriteBatchRequest) ProtoMessage ¶
func (*WriteBatchRequest) ProtoMessage()
func (*WriteBatchRequest) ProtoReflect ¶
func (x *WriteBatchRequest) ProtoReflect() protoreflect.Message
func (*WriteBatchRequest) Reset ¶
func (x *WriteBatchRequest) Reset()
func (*WriteBatchRequest) String ¶
func (x *WriteBatchRequest) String() string
type WriteBatchResponse ¶
type WriteBatchResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
Count int32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`
// contains filtered or unexported fields
}
批量写入响应
func (*WriteBatchResponse) Descriptor
deprecated
func (*WriteBatchResponse) Descriptor() ([]byte, []int)
Deprecated: Use WriteBatchResponse.ProtoReflect.Descriptor instead.
func (*WriteBatchResponse) GetCount ¶
func (x *WriteBatchResponse) GetCount() int32
func (*WriteBatchResponse) GetError ¶
func (x *WriteBatchResponse) GetError() string
func (*WriteBatchResponse) GetSuccess ¶
func (x *WriteBatchResponse) GetSuccess() bool
func (*WriteBatchResponse) ProtoMessage ¶
func (*WriteBatchResponse) ProtoMessage()
func (*WriteBatchResponse) ProtoReflect ¶
func (x *WriteBatchResponse) ProtoReflect() protoreflect.Message
func (*WriteBatchResponse) Reset ¶
func (x *WriteBatchResponse) Reset()
func (*WriteBatchResponse) String ¶
func (x *WriteBatchResponse) String() string
type WriteRequest ¶
type WriteRequest struct {
Database string `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"`
Measurement string `protobuf:"bytes,2,opt,name=measurement,proto3" json:"measurement,omitempty"`
Tags map[string]string `` /* 135-byte string literal not displayed */
Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Fields map[string]*FieldValue `` /* 139-byte string literal not displayed */
// contains filtered or unexported fields
}
写入请求
func (*WriteRequest) Descriptor
deprecated
func (*WriteRequest) Descriptor() ([]byte, []int)
Deprecated: Use WriteRequest.ProtoReflect.Descriptor instead.
func (*WriteRequest) GetDatabase ¶
func (x *WriteRequest) GetDatabase() string
func (*WriteRequest) GetFields ¶
func (x *WriteRequest) GetFields() map[string]*FieldValue
func (*WriteRequest) GetMeasurement ¶
func (x *WriteRequest) GetMeasurement() string
func (*WriteRequest) GetTags ¶
func (x *WriteRequest) GetTags() map[string]string
func (*WriteRequest) GetTimestamp ¶
func (x *WriteRequest) GetTimestamp() int64
func (*WriteRequest) ProtoMessage ¶
func (*WriteRequest) ProtoMessage()
func (*WriteRequest) ProtoReflect ¶
func (x *WriteRequest) ProtoReflect() protoreflect.Message
func (*WriteRequest) Reset ¶
func (x *WriteRequest) Reset()
func (*WriteRequest) String ¶
func (x *WriteRequest) String() string
type WriteResponse ¶
type WriteResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
// contains filtered or unexported fields
}
写入响应
func (*WriteResponse) Descriptor
deprecated
func (*WriteResponse) Descriptor() ([]byte, []int)
Deprecated: Use WriteResponse.ProtoReflect.Descriptor instead.
func (*WriteResponse) GetError ¶
func (x *WriteResponse) GetError() string
func (*WriteResponse) GetSuccess ¶
func (x *WriteResponse) GetSuccess() bool
func (*WriteResponse) ProtoMessage ¶
func (*WriteResponse) ProtoMessage()
func (*WriteResponse) ProtoReflect ¶
func (x *WriteResponse) ProtoReflect() protoreflect.Message
func (*WriteResponse) Reset ¶
func (x *WriteResponse) Reset()
func (*WriteResponse) String ¶
func (x *WriteResponse) String() string