tsdb

package
v0.0.0-...-034a78d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataFamily

type DataFamily interface {
	Scan(scanContext *ScanContext) Scanner
}

type Engine

type Engine interface {
	// Name returns tsdb engine's name, engine's name is database's name for user
	Name() string
	// NumOfShards returns number of shards in tsdb engine
	NumOfShards() int
	// CreateShards creates shards for data partition
	CreateShards(option option.ShardOption, shardIDs ...int32) error
	// GetShard returns shard by given shard id, if not exist returns nil
	GetShard(shardID int32) Shard
	// GetMetadataGetter returns metadata getter for metric level metadata
	GetMetadataGetter() index.MetadataGetter
	// Close closed engine then release resource
	Close() error
}

Engine represents a time series storage engine

func NewEngine

func NewEngine(name string, path string) (Engine, error)

NewEngine creates engine instance if create engine's path successfully

type FieldUID

type FieldUID interface {
	//GetOrCreateFieldID  returns find the ID associated with a given field name and field type or create it.
	GetOrCreateFieldID(metricID uint32, fieldName string, fieldType field.Type) (uint32, error)
	//GetFields returns get all fields within the metric name
	GetFields(metricID uint32, limit int16) map[string]struct{}
	//GetFieldID returns get fieldID by fieldName within the metric name
	GetFieldID(metricID uint32, fieldName string) uint32
	//Flush represents forces a flush of in-memory data, and clear it
	Flush() error
}

FieldUID represents field unique under the metric name. Database level sharing.

type IntervalSegment

type IntervalSegment interface {
	// GetOrCreateSegment creates new segment if not exist, if exist return it
	GetOrCreateSegment(segmentName string) (Segment, error)
	// GetSegments returns segment list by time range, return nil if not match
	GetSegments(timeRange timeutil.TimeRange) []Segment
	// Close closes interval segment, release resource
	Close()
}

IntervalSegment represents a interval segment, there are some segments in a shard.

type MetricUID

type MetricUID interface {
	//GetOrCreateMetricID returns find the metric ID associated with a given name or create it.
	GetOrCreateMetricID(metricName string, create bool) (uint32, bool)
	//SuggestMetrics returns suggestions of metric names given a search prefix.
	SuggestMetrics(prefix string, limit int16) map[string]struct{}
	//Flush represents forces a flush of in-memory data, and clear it
	Flush() error
}

MetricUid represents metric name unique id under the database

type ScanContext

type ScanContext struct {
	// required
	MetricID  uint32
	FieldIDs  []uint16
	TimeRange timeutil.TimeRange

	// optional, if SeriesIDSet is nil, just search metric level data
	SeriesIDSet *series.MultiVerSeriesIDSet
}

type Scanner

type Scanner interface {
	HasNext() bool
	Next() field.MultiTimeSeries
	Close()
}

type Segment

type Segment interface {
	// BaseTime returns segment base time
	BaseTime() int64
	// GetDataFamilies returns data family list by time range, return nil if not match
	GetDataFamilies(timeRange timeutil.TimeRange) []DataFamily
	// Close closes segment, include kv store
	Close()
}

Segment represents a time based segment, there are some segments in a interval segment. A segment use k/v store for storing time series data.

type Shard

type Shard interface {
	// GetSegments returns segment list by interval type and time range, return nil if not match
	GetSegments(intervalType interval.Type, timeRange timeutil.TimeRange) []Segment
	// GetSeriesIDsFilter returns series index for searching series(tags)
	GetSeriesIDsFilter() index.SeriesIDsFilter
	// Write writes the metric-point into memory-database.
	Write(metric *pb.Metric) error
	// Close releases shard's resource, such as flush data, spawned goroutines etc.
	Close()
}

Shard is a horizontal partition of metrics for LinDB.

type TagsUID

type TagsUID interface {
	//GetOrCreateTagsID returns find the tags ID associated with given tags or create it.
	GetOrCreateTagsID(metricID uint32, tags string) (uint32, error)
	//GetTagNames return get all tag names within the metric name
	GetTagNames(metricID uint32, limit int16) map[string]struct{}
	//GetTagValueBitmap returns find bitmap associated with a given tag value
	GetTagValueBitmap(metricID uint32, tagName string, tagValue string) *roaring.Bitmap
	//SuggestTagValues returns  suggestions of tag values given a search prefix
	SuggestTagValues(metricID uint32, tagName string, tagValuePrefix string, limit uint16) map[string]struct{}
	//Flush represents forces a flush of in-memory data, and clear it
	Flush() error
}

TagsUID represents tags unique id under the metric name. Shard level sharing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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