store

package
v0.0.0-...-e121adf Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RETIRE_LIST_LEN  = 100
	EXPIRE_WRITE_LEN = 50
)
View Source
const (
	DB_FILE     = "deephealth.db"
	CREATE_STMT = `` /* 378-byte string literal not displayed */

	PANO_INSERT_STMT     = "INSERT INTO panorama(subject, observer, time, metrics) VALUES(?,?,?,?)"
	INFER_INSERT_STMT    = "INSERT INTO inference(subject, observers, time, metrics) VALUES(?,?,?,?)"
	REGISTER_INSERT_STMT = "INSERT INTO registration(handle, module, observer, time) VALUES(?,?,?,?)"
)
View Source
const (
	REPORT_IGNORED int = iota
	REPORT_ACCEPTED
	REPORT_FAILED
)
View Source
const (
	MaxReportPerView = 10 // maximum number of reports to store for a given view

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	CacheBase
	// contains filtered or unexported fields
}

func NewCache

func NewCache(ttl time.Duration) *Cache

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) Delete

func (c *Cache) Delete(key string)

func (*Cache) Get

func (c *Cache) Get(key string) interface{}

func (*Cache) Set

func (c *Cache) Set(key string, value interface{})

type CacheBase

type CacheBase struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type CacheItem

type CacheItem struct {
	Value interface{}
	// contains filtered or unexported fields
}

func (*CacheItem) Expired

func (i *CacheItem) Expired() bool

func (*CacheItem) TTL

func (i *CacheItem) TTL() time.Duration

type CacheList

type CacheList struct {
	CacheBase
	// contains filtered or unexported fields
}

func NewCacheList

func NewCacheList(ttl time.Duration, max_list_len int) *CacheList

func (*CacheList) Delete

func (c *CacheList) Delete(key string)

func (*CacheList) Empty

func (c *CacheList) Empty(key string)

func (*CacheList) Get

func (c *CacheList) Get(key string) []*CacheItem

func (*CacheList) Process

func (c *CacheList) Process(key string, fn func(*CacheItem) bool) int

func (*CacheList) Set

func (c *CacheList) Set(key string, value interface{})

type CacheListItem

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

type HealthDBStorage

type HealthDBStorage struct {
	DB   *sql.DB
	File string
	// contains filtered or unexported fields
}

func NewHealthDBStorage

func NewHealthDBStorage(file string) *HealthDBStorage

func (*HealthDBStorage) Close

func (self *HealthDBStorage) Close()

func (*HealthDBStorage) InsertInference

func (self *HealthDBStorage) InsertInference(inf *pb.Inference) error

func (*HealthDBStorage) InsertRegistration

func (self *HealthDBStorage) InsertRegistration(reg *dt.Registration) error

func (*HealthDBStorage) InsertReport

func (self *HealthDBStorage) InsertReport(report *pb.Report) error

func (*HealthDBStorage) Open

func (self *HealthDBStorage) Open() (*sql.DB, error)

func (*HealthDBStorage) ReadRegistrations

func (self *HealthDBStorage) ReadRegistrations() (map[uint64]*dt.Registration, uint64)

type HealthInferenceStorage

type HealthInferenceStorage struct {
	Results   InferMap
	Workbooks map[string]InferMap
	ReportCh  chan *pb.Report
	SubjectCh chan string
	// contains filtered or unexported fields
}

func NewHealthInferenceStorage

func NewHealthInferenceStorage(raw dt.HealthStorage, algo dd.InferenceAlgo) *HealthInferenceStorage

func (*HealthInferenceStorage) DumpInference

func (self *HealthInferenceStorage) DumpInference() map[string]*pb.Inference

func (*HealthInferenceStorage) GetInference

func (self *HealthInferenceStorage) GetInference(subject string) *pb.Inference

func (*HealthInferenceStorage) InferReport

func (self *HealthInferenceStorage) InferReport(report *pb.Report) (*pb.Inference, error)

func (*HealthInferenceStorage) InferReportAsync

func (self *HealthInferenceStorage) InferReportAsync(report *pb.Report) error

func (*HealthInferenceStorage) InferSubject

func (self *HealthInferenceStorage) InferSubject(subject string) (*pb.Inference, error)

func (*HealthInferenceStorage) InferSubjectAsync

func (self *HealthInferenceStorage) InferSubjectAsync(subject string) error

func (*HealthInferenceStorage) SetDB

func (self *HealthInferenceStorage) SetDB(db dt.HealthDB)

func (*HealthInferenceStorage) Start

func (self *HealthInferenceStorage) Start() error

func (*HealthInferenceStorage) Stop

func (self *HealthInferenceStorage) Stop() error

type InferMap

type InferMap map[string]*pb.Inference

type RawHealthStorage

type RawHealthStorage struct {
	Tenants   map[string]*dt.ConcurrentPanorama
	Watchlist map[string]time.Time
	// contains filtered or unexported fields
}

func NewRawHealthStorage

func NewRawHealthStorage(subjects ...string) *RawHealthStorage

func (*RawHealthStorage) AddReport

func (self *RawHealthStorage) AddReport(report *pb.Report, filter bool) (int, error)

func (*RawHealthStorage) AddSubject

func (self *RawHealthStorage) AddSubject(subject string) bool

func (*RawHealthStorage) Dump

func (self *RawHealthStorage) Dump()

func (*RawHealthStorage) DumpPanorama

func (self *RawHealthStorage) DumpPanorama() map[string]*pb.Panorama

func (*RawHealthStorage) GC

func (self *RawHealthStorage) GC(ttl time.Duration, relative bool) map[string]uint32

func (*RawHealthStorage) GetLatestReport

func (self *RawHealthStorage) GetLatestReport(subject string) *pb.Report

func (*RawHealthStorage) GetPanorama

func (self *RawHealthStorage) GetPanorama(subject string) *dt.ConcurrentPanorama

func (*RawHealthStorage) GetSubjects

func (self *RawHealthStorage) GetSubjects() map[string]time.Time

func (*RawHealthStorage) GetView

func (self *RawHealthStorage) GetView(observer string, subject string) *pb.View

func (*RawHealthStorage) RemoveSubject

func (self *RawHealthStorage) RemoveSubject(subject string, clean bool) bool

func (*RawHealthStorage) SetDB

func (self *RawHealthStorage) SetDB(db dt.HealthDB)

Jump to

Keyboard shortcuts

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