db

package
v0.25.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAnyRecordFiles

func GetAnyRecordFiles(directory string, subdir bool) ([]string, error)

GetAnyRecordFiles gets all observation record files.

func GetRecordFiles

func GetRecordFiles(directory, prefix string, start, end time.Time) ([]string, error)

GetRecordFiles gets all observation record files.

func Int64Bytes

func Int64Bytes(value int64) []byte

func IntObsFromBytes

func IntObsFromBytes(value []byte) (*nwpd.IntObservation, error)

func IntObsToBytes

func IntObsToBytes(o *nwpd.IntObservation) ([]byte, error)

func IntObsToObservation

func IntObsToObservation(o *nwpd.IntObservation, idMap *StringIDMap) (*nwpd.Observation, error)

func IterateRecordFile

func IterateRecordFile(filename string, visitor ObservationVisitor) error

func NewObsWriter

func NewObsWriter(log logrus.FieldLogger, directory, prefix string, retentionHours int) (nwpd.ObservationWriter, error)

func ToIntObservation

func ToIntObservation(obs *nwpd.Observation, idMap *StringIDMap, persistor IntStringPersistor) (*nwpd.IntObservation, error)

Types

type IntString

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

func NewVarint2String

func NewVarint2String(key int64, value string) *IntString

func NewVarint2StringFromBytes

func NewVarint2StringFromBytes(key []byte, value []byte) *IntString

func (*IntString) Key

func (x *IntString) Key() int64

func (*IntString) KeyBytes

func (x *IntString) KeyBytes() []byte

func (*IntString) Value

func (x *IntString) Value() string

func (*IntString) ValueBytes

func (x *IntString) ValueBytes() []byte

type IntStringPersistor

type IntStringPersistor interface {
	Persist(obj *IntString) error
}

type ObservationVisitor

type ObservationVisitor func(obs *nwpd.Observation) error

type StringIDMap

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

func NewStringIDMap

func NewStringIDMap() *StringIDMap

func NewStringIDMapFromData

func NewStringIDMapFromData(data []*IntString) *StringIDMap

func (*StringIDMap) Append

func (m *StringIDMap) Append(item *IntString) error

func (*StringIDMap) GetKey

func (m *StringIDMap) GetKey(persistor IntStringPersistor, s string) (int64, error)

func (*StringIDMap) GetValue

func (m *StringIDMap) GetValue(id int64) (string, error)

Jump to

Keyboard shortcuts

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