dao

package
v0.0.0-...-3f388d4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

-------------------------------------------------------------------------

*
* dao.go
*    data access object for database backend
*
*
* Copyright (c) 2021, Alibaba Group Holding Limited
* 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.
*
* IDENTIFICATION
*           plugins/db_backend/dao/dao.go
*-------------------------------------------------------------------------

Index

Constants

View Source
const (
	RETENTION_HOUR    = 03
	RETENTION_MIN     = 23
	RETENTION_SECOND  = 43
	MIN_TRACKLOG_TIME = 500
)
View Source
const ASYNC_CHANNEL_SIZE = 50
View Source
const DATAMODEL_CONFIG_TABLE = "meta_data_model_config"
View Source
const DBConnTimeout = 10
View Source
const DBQueryTimeout = 60
View Source
const TABLE_CONFIG_VERSION = "meta_data_model_version"

Variables

View Source
var RETENTION_INTERVAL int = 3600
View Source
var RETENTION_TIME int = 3 * 24 * 60 * 60

Functions

This section is empty.

Types

type Aggregation

type Aggregation struct {
	Granularity int `json:"granularity"`
	Retention   int `json:"retention"`
}

type AsyncInsertData

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

type Column

type Column struct {
	Name     string          `json:"name"`
	Type     string          `json:"type"`
	DimTable *DimensionTable `json:"dimtable"`
	AggType  string          `json:"aggtype"`
}

func (*Column) DeepCopy

func (c *Column) DeepCopy() *Column

type DBInfo

type DBInfo struct {
	InsName  string
	Host     string
	Port     int
	UserName string
	Password string
	Role     string

	DBPath string // base path for sqlite
	DBName string
	Schema string
	DBType string
}

type DBManager

type DBManager struct {
	Databases []*Database `json:"db_schemas"`
	// contains filtered or unexported fields
}

func NewDBManager

func NewDBManager() *DBManager

func (*DBManager) GetOrInitInstance

func (s *DBManager) GetOrInitInstance(
	dbname string,
	insname string,
	insinfo *InsInfo,
	dbinfo *DBInfo,
	initsqls []db_config.QueryCtx) (*Instance, error)

func (*DBManager) Init

func (s *DBManager) Init(conf string, path string) error

func (*DBManager) Stop

func (s *DBManager) Stop() error

func (*DBManager) StopInstance

func (s *DBManager) StopInstance(dbname string, insname string) error

type Database

type Database struct {
	Name        string    `json:"name"`
	DBTemplate  *Instance `json:"dbtemplate"`
	InstanceMap map[string]*Instance
}

type DimKey

type DimKey struct {
	Name   string `json:"name"`
	Source string `json:"source"`
}

type DimensionTable

type DimensionTable struct {
	Name     string
	DimKey   DimKey   `json:"dimkey"`
	DimValue []string `json:"dimvalue"`
}

func (*DimensionTable) DeepCopy

func (dim *DimensionTable) DeepCopy() *DimensionTable

type FactTable

type FactTable struct {
	TagMap   map[string]*Column
	ValueMap map[string]*Column
}

func (*FactTable) DeepCopy

func (fact *FactTable) DeepCopy() *FactTable

type InsInfo

type InsInfo struct {
	LogicalInsName  string
	PhysicalInsName string
}

type Instance

type Instance struct {
	DataType string
	Name     string
	InsInfo  *InsInfo
	DBInfo   *DBInfo

	Tables   []*TimeSeriesTable `json:"tables"`
	TableMap map[string]*TimeSeriesTable

	HighPriorityAsyncChannel chan *AsyncInsertData
	LowPriorityAsyncChannel  chan *AsyncInsertData
	AsyncInsertStopper       chan int
	// contains filtered or unexported fields
}

func (*Instance) AsyncInsert

func (ins *Instance) AsyncInsert(name string, schema []string, data [][]interface{}) error

func (*Instance) DeepCopy

func (ins *Instance) DeepCopy() *Instance

func (*Instance) Init

func (ins *Instance) Init(name string,
	insinfo *InsInfo, dbinfo *DBInfo,
	initsqls []db_config.QueryCtx) error

func (*Instance) Insert

func (ins *Instance) Insert(name string, schema []string, data [][]interface{}) error

func (*Instance) IsLowPriority

func (ins *Instance) IsLowPriority(name string) bool

func (*Instance) Stop

func (ins *Instance) Stop() error

type TimeSeriesTable

type TimeSeriesTable struct {
	Name   string    `json:"name"`
	Tags   []*Column `json:"tags"`
	Values []*Column `json:"values"`

	TagMap   map[string]*Column
	ValueMap map[string]*Column

	FactTable         *FactTable
	DimensionTableMap map[string]*DimensionTable

	Aggregations   []Aggregation `json:"aggregations"`
	AggregationMap map[string]Aggregation
	Retention      int `json:"retention"`
}

func (*TimeSeriesTable) DeepCopy

func (t *TimeSeriesTable) DeepCopy() *TimeSeriesTable

Jump to

Keyboard shortcuts

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