input

package
v0.0.0-...-0119d12 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package input defines several different data inputs.

Index

Constants

View Source
const ScanRegionsLimit = 51200

Variables

View Source
var (
	ErrNS          = errorx.NewNamespace("error.keyvisual")
	ErrNSInput     = ErrNS.NewSubNamespace("input")
	ErrInvalidData = ErrNSInput.NewType("invalid_data")
)

Functions

func NewAPIPeriodicGetter

func NewAPIPeriodicGetter(pdClient *pd.Client) regionpkg.RegionsInfoGenerator

Types

type RegionInfo

type RegionInfo struct {
	ID              uint64 `json:"id"`
	StartKey        string `json:"start_key"`
	EndKey          string `json:"end_key"`
	WrittenBytes    uint64 `json:"written_bytes"`
	ReadBytes       uint64 `json:"read_bytes"`
	WrittenKeys     uint64 `json:"written_keys"`
	ReadKeys        uint64 `json:"read_keys"`
	ApproximateSize int64  `json:"approximate_size"`
	ApproximateKeys int64  `json:"approximate_keys"`
}

RegionInfo records detail region info for api usage.

type RegionsInfo

type RegionsInfo struct {
	Count   int           `json:"count"`
	Regions []*RegionInfo `json:"regions"`
}

RegionsInfo contains some regions with the detailed region info.

func (*RegionsInfo) GetKeys

func (rs *RegionsInfo) GetKeys() []string

func (*RegionsInfo) GetValues

func (rs *RegionsInfo) GetValues(tag regionpkg.StatTag) []uint64

func (*RegionsInfo) Len

func (rs *RegionsInfo) Len() int

type StatInput

type StatInput interface {
	GetStartTime() time.Time
	Background(ctx context.Context, stat *storage.Stat)
}

StatInput is the interface that different data inputs need to implement.

func FileInput

func FileInput(startTime, endTime time.Time) StatInput

FileInput reads files in the specified time range from the ./data directory.

func NewStatInput

func NewStatInput(provider *region.DataProvider) StatInput

func PeriodicInput

func PeriodicInput(periodicGetter region.RegionsInfoGenerator) StatInput

Jump to

Keyboard shortcuts

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