Documentation ¶
Overview ¶
Copyright [2019] housepower
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func GetValueByType(metric Metric, cwt *ColumnWithType) (val interface{})
- func PutRow(r *Row)
- func PutRows(rs *Rows)
- func WhichType(typ string) (dataType int, nullable bool)
- type Batch
- type BatchGroup
- type BatchSys
- type ColumnWithType
- type DimMetrics
- type InputMessage
- type Metric
- type MsgRow
- type Row
- type Rows
- type TypeInfo
Constants ¶
const ( TypeUnknown = iota Int Float String DateTime ElasticDateTime IntArray FloatArray StringArray DateTimeArray )
Variables ¶
This section is empty.
Functions ¶
func GetValueByType ¶ added in v1.5.2
func GetValueByType(metric Metric, cwt *ColumnWithType) (val interface{})
There are only three cases for the value type of metric, (float64, string, map [string] interface {})
Types ¶
type Batch ¶ added in v1.5.2
type Batch struct { Rows *Rows BatchIdx int64 RealSize int Group *BatchGroup }
type BatchGroup ¶ added in v1.5.2
type BatchGroup struct { Batchs []*Batch Offsets map[int]int64 Sys *BatchSys PendWrite int32 //how many batches in this group are pending to wirte to ClickHouse }
BatchGroup consists of multiple batches. The `before` relationship could be impossible if messages of a partition are distributed to multiple batches. So those batches need to be committed after ALL of them have been written to clickhouse.
type BatchSys ¶ added in v1.5.2
type BatchSys struct {
// contains filtered or unexported fields
}
func NewBatchSys ¶ added in v1.5.2
func (*BatchSys) CreateBatchGroupMulti ¶ added in v1.5.2
func (*BatchSys) CreateBatchGroupSingle ¶ added in v1.5.2
type ColumnWithType ¶
ColumnWithType
type DimMetrics ¶
type DimMetrics struct { Dims []*ColumnWithType Fields []*ColumnWithType }
DimMetrics
type InputMessage ¶ added in v1.5.2
type InputMessage struct { Topic string Partition int Key []byte Value []byte Offset int64 Timestamp *time.Time }
MsgWithMeta abstract messages We are not using interface because virtual call. See https://syslog.ravelin.com/go-interfaces-but-at-what-cost-961e0f58a07b?gi=58f6761d1d70
type Metric ¶
type Metric interface { GetInt(key string, nullable bool) (val interface{}) GetFloat(key string, nullable bool) (val interface{}) GetString(key string, nullable bool) (val interface{}) GetDateTime(key string, nullable bool) (val interface{}) GetElasticDateTime(key string, nullable bool) (val interface{}) GetArray(key string, t int) (val interface{}) GetNewKeys(knownKeys *sync.Map, newKeys *sync.Map) bool }
Metric interface for metric collection
type MsgRow ¶ added in v1.5.2
type MsgRow struct { Msg *InputMessage Row *Row Shard int }
type Row ¶ added in v1.5.2
type Row []interface{}
func MetricToRow ¶ added in v1.5.2
func MetricToRow(metric Metric, msg InputMessage, dims []*ColumnWithType) (row *Row)