serde

package
Version: v0.0.0-...-12ae2a3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package serde is the interface (and currently PostgreSQL implementaiton) for Serialization/Deserialization of data.

Index

Constants

This section is empty.

Variables

View Source
var PgSegmentWidth int = 200

Functions

func InitDb

func InitDb(connect_string, prefix string) (*pgvSerDe, error)

func NewMemSerDe

func NewMemSerDe() *memSerDe

Returns a SerDe which keeps everything in memory.

Types

type DataSourceSearcher

type DataSourceSearcher interface {
	// Return a list od DS ids based on the query. How the query works
	// is up to the serde, it can even ignore the argumen, but the
	// general idea was a key: regex list where the underlying engine
	// would return all DSs whose ident tags named key match the
	// regex. Remember to Close() the SearchResult in the end.
	Search(query SearchQuery) (SearchResult, error)
}

type DbAddresser

type DbAddresser interface {
	ListDbClientIps() ([]string, error) // Use the database to infer outside IPs of other connected clients
	MyDbAddr() (*string, error)
}

type DbDataSource

type DbDataSource struct {
	rrd.DataSourcer
	// contains filtered or unexported fields
}

func NewDbDataSource

func NewDbDataSource(id int64, ident Ident, seg, idx int64, ds rrd.DataSourcer) *DbDataSource

func (*DbDataSource) Copy

func (ds *DbDataSource) Copy() rrd.DataSourcer

func (*DbDataSource) Created

func (ds *DbDataSource) Created() bool

func (*DbDataSource) Id

func (ds *DbDataSource) Id() int64

func (*DbDataSource) Ident

func (ds *DbDataSource) Ident() Ident

func (*DbDataSource) Idx

func (ds *DbDataSource) Idx() int64

func (*DbDataSource) Seg

func (ds *DbDataSource) Seg() int64

type DbDataSourcer

type DbDataSourcer interface {
	rrd.DataSourcer
	Ident() Ident
	Id() int64
	Seg() int64
	Idx() int64
	Created() bool
}

type DbRoundRobinArchive

type DbRoundRobinArchive struct {
	rrd.RoundRobinArchiver
	// contains filtered or unexported fields
}

func (*DbRoundRobinArchive) BundleId

func (rra *DbRoundRobinArchive) BundleId() int64

func (*DbRoundRobinArchive) Copy

func (*DbRoundRobinArchive) Id

func (rra *DbRoundRobinArchive) Id() int64

func (*DbRoundRobinArchive) Idx

func (rra *DbRoundRobinArchive) Idx() int64

func (*DbRoundRobinArchive) Seg

func (rra *DbRoundRobinArchive) Seg() int64

func (*DbRoundRobinArchive) SlotRow

func (rra *DbRoundRobinArchive) SlotRow(slot int64) int64

SlotRow returns the row number given a slot number. This is mostly useful in serde implementations.

func (*DbRoundRobinArchive) Width

func (rra *DbRoundRobinArchive) Width() int64

type DbRoundRobinArchiver

type DbRoundRobinArchiver interface {
	rrd.RoundRobinArchiver
	Id() int64
	Width() int64
	SlotRow(slot int64) int64
	//DPsAsPGString(start, end int64) string
	//Pos() int64
	Seg() int64
	Idx() int64
	BundleId() int64
}

type DbSerDe

type DbSerDe interface {
	SerDe
	DbAddresser() DbAddresser
}

type EventListener

type EventListener interface {
	RegisterDeleteListener(func(Ident)) error
}

type Fetcher

type Fetcher interface {
	DataSourceSearcher
	// Fetch all the data sources (used to populate the cache on start)
	FetchDataSources() ([]rrd.DataSourcer, error)
	// Fetch or create a single DS. Passing a nil dsSpec disables creation.
	FetchOrCreateDataSource(ident Ident, dsSpec *rrd.DSSpec) (rrd.DataSourcer, error)
	// FetchSeries is responsible for presenting a DS as a
	// series.Series. This may include selecting the most suitable RRA
	// of the DS to satisfy span and resolution requested, as well as
	// setting up a database cursor which will be used to iterate over
	// the series.
	FetchSeries(ds rrd.DataSourcer, from, to time.Time, maxPoints int64) (series.Series, error)
}

type Flusher

type Flusher interface {
	FlushDataPoints(bunlde_id, seg, i int64, dps, vers map[int64]interface{}) (int, error)
	FlushDSStates(seg int64, lastupdate, value, duration map[int64]interface{}) (int, error)
	FlushRRAStates(bundle_id, seg int64, latests, value, duration map[int64]interface{}) (int, error)
}

type Ident

type Ident map[string]string

func (Ident) String

func (it Ident) String() string

type SearchQuery

type SearchQuery map[string]string

type SearchResult

type SearchResult interface {
	Next() bool
	Close() error
	Ident() Ident
}

An iterator, similar to sql.Rows.

type SerDe

type SerDe interface {
	Fetcher() Fetcher
	Flusher() Flusher
	EventListener() EventListener
}

Jump to

Keyboard shortcuts

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