updater

package
v0.1.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package updater will provide an interface to update the unit stucts before inserting into DB

Users can implement their own logic to mutate units struct to manipulate each unit struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterUpdater

func RegisterUpdater(name string, isDefaultEnabled bool, factory func(logger log.Logger) (Updater, error))

RegisterUpdater registers updater struct into factories

Types

type UnitUpdater

type UnitUpdater struct {
	Names    []string
	Updaters []Updater
	Logger   log.Logger
}

UnitUpdater implements the interface to update compute units from different updaters.

func NewUnitUpdater

func NewUnitUpdater(logger log.Logger) (*UnitUpdater, error)

NewUnitUpdater creates a new UnitUpdater

func (UnitUpdater) Update

func (u UnitUpdater) Update(startTime time.Time, endTime time.Time, units []models.Unit) []models.Unit

Update implements updating units using registered updaters

type Updater

type Updater interface {
	Update(startTime time.Time, endTime time.Time, units []models.Unit) []models.Unit
}

Updater interface

func NewTSDBUpdater

func NewTSDBUpdater(logger log.Logger) (Updater, error)

NewTSDBUpdater create a new updater interface

Jump to

Keyboard shortcuts

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