memdb

package
v1.33.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 19 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.Manifest

GetManifest get the manifest data.

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) 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) LoadFromGcs

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

LoadFromGcs loads tmcf + csv files into memory database

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) SubscribeGcsUpdate

func (memDb *MemDb) SubscribeGcsUpdate(
	ctx context.Context,
	pubsubProject, pubsubTopic, subscriberPrefix string,
	bucket, folder string,
) error

SubscribeGcsUpdate subscribe GCS csv+tmcf change. When csv file is changed, reload the memdb

Jump to

Keyboard shortcuts

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