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 ¶
View Source
var ( ErrDuplID = errors.New("duplicate ID found in updaters config") ErrUnknownUpdater = errors.New("unknown updater found in the config") ErrInvalidID = errors.New("invalid updater ID. It must contain only [a-zA-Z0-9-_]") )
Custom errors.
Functions ¶
Types ¶
type Config ¶
type Config[T any] struct { Instances []T `yaml:"updaters"` }
Config contains the configuration of updater(s).
type Instance ¶
type Instance struct { ID string `yaml:"id"` Updater string `yaml:"updater"` Web models.WebConfig `yaml:"web"` CLI models.CLIConfig `yaml:"cli"` Extra yaml.Node `yaml:"extra_config"` }
Instance contains the configuration of the given updater.
type UnitUpdater ¶
UnitUpdater implements the interface to update compute units from different updaters.
func New ¶ added in v0.2.0
func New(logger log.Logger) (*UnitUpdater, error)
New creates a new UnitUpdater.
func (UnitUpdater) Update ¶
func (u UnitUpdater) Update( ctx context.Context, startTime time.Time, endTime time.Time, clusterUnits []models.ClusterUnits, ) []models.ClusterUnits
Update implements updating units using registered updaters.
Click to show internal directories.
Click to hide internal directories.