memdb

package
v1.37.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemDb

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

MemDb holds imported data in memory.

func NewMemDb

func NewMemDb() *MemDb

NewMemDb initialize a MemDb instance.

func (*MemDb) GetManifest

func (memDb *MemDb) GetManifest() *pb.MemdbConfig

GetManifest get the manifest data.

func (*MemDb) GetPlaceSvExistence added in v1.35.0

func (memDb *MemDb) GetPlaceSvExistence() map[string]map[string]int32

GetPlaceSvExistence get the place sv existence info

func (*MemDb) GetStatVars

func (memDb *MemDb) GetStatVars(places []string) ([]string, []string)

GetStatVars retrieves the stat vars from private import that have data for the given places.

func (*MemDb) GetSvg added in v1.35.0

func (memDb *MemDb) GetSvg() map[string]*pb.StatVarGroupNode

GetSvg get the svg data.

func (*MemDb) HasStatVar

func (memDb *MemDb) HasStatVar(statVar string) bool

HasStatVar checks if a stat var exists in the memory database.

func (*MemDb) IsEmpty

func (memDb *MemDb) IsEmpty() bool

IsEmpty checks if memory database has data.

func (*MemDb) LoadConfig added in v1.35.0

func (memDb *MemDb) LoadConfig(ctx context.Context, file string) error

LoadConfig loads the memdb config from file.

func (*MemDb) LoadFromGcs

func (memDb *MemDb) LoadFromGcs(ctx context.Context, bucket, prefix string) error

LoadFromGcs loads tmcf + csv files into memory database This should be called after LoadConfig() so config is already set.

func (*MemDb) ReadPointValue

func (memDb *MemDb) ReadPointValue(statVar, place, date string) (
	*pb.PointStat, *pb.StatMetadata,
)

ReadPointValue reads one observation point. If date is "", the latest observation is returned, otherwise, the observation corresponding to the given date is returned.

func (*MemDb) ReadSeries

func (memDb *MemDb) ReadSeries(statVar, place string) []*pb.Series

ReadSeries reads stat series from in-memory DB.

func (*MemDb) ReadStatDate added in v1.34.0

func (memDb *MemDb) ReadStatDate(statVar string) *pb.StatDateList

ReadStatDate reads observation date frequency for a given stat var.

Jump to

Keyboard shortcuts

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