refresher

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package refresher handles RefreshProjectConfigTask.

Each time it receives RefreshProjectConfigTask, it - fetches the latest project-scoped CV config for the project, - updates the stored project config if there is a config change, and - sends a config change notification to corresponding Project Manager.

Index

Constants

This section is empty.

Variables

View Source
var File_go_chromium_org_luci_cv_internal_configs_prjcfg_refresher_tasks_proto protoreflect.FileDescriptor

Functions

func DisableProject

func DisableProject(ctx context.Context, project string, notify NotifyCallback) error

DisableProject disables the given LUCI Project if it is currently enabled.

func UpdateProject

func UpdateProject(ctx context.Context, project string, notify NotifyCallback) error

UpdateProject imports the latest CV Config for a given LUCI Project from LUCI Config if the config in CV is outdated.

Types

type NotifyCallback

type NotifyCallback func(context.Context) error

NotifyCallback is called in a transaction context from UpdateProject and DisableProject. Used by configcron package.

type PM

type PM interface {
	Poke(ctx context.Context, luciProject string) error
	UpdateConfig(ctx context.Context, luciProject string) error
}

PM encapsulates Project Manager notified by the ConfigRefresher.

In production, this will be prjmanager.Notifier.

type QM

type QM interface {
	WritePolicy(ctx context.Context, project string) (*quotapb.PolicyConfigID, error)
}

QM manages run and tryjob quotas.

type RefreshProjectConfigTask

type RefreshProjectConfigTask struct {
	Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"`
	Disable bool   `protobuf:"varint,2,opt,name=disable,proto3" json:"disable,omitempty"`
	// contains filtered or unexported fields
}

RefreshProjectConfigTask is used to import latest CV config for a LUCI Project from LUCI Config or disable a LUCI Project if `disable` is true.

Queue: "refresh-project-config".

func (*RefreshProjectConfigTask) Descriptor deprecated

func (*RefreshProjectConfigTask) Descriptor() ([]byte, []int)

Deprecated: Use RefreshProjectConfigTask.ProtoReflect.Descriptor instead.

func (*RefreshProjectConfigTask) GetDisable

func (x *RefreshProjectConfigTask) GetDisable() bool

func (*RefreshProjectConfigTask) GetProject

func (x *RefreshProjectConfigTask) GetProject() string

func (*RefreshProjectConfigTask) ProtoMessage

func (*RefreshProjectConfigTask) ProtoMessage()

func (*RefreshProjectConfigTask) ProtoReflect

func (x *RefreshProjectConfigTask) ProtoReflect() protoreflect.Message

func (*RefreshProjectConfigTask) Reset

func (x *RefreshProjectConfigTask) Reset()

func (*RefreshProjectConfigTask) String

func (x *RefreshProjectConfigTask) String() string

type Refresher

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

Refresher handles RefreshProjectConfigTask.

func NewRefresher

func NewRefresher(tqd *tq.Dispatcher, pm PM, qm QM, env *common.Env) *Refresher

NewRefresher creates a new project config Refresher and registers its TQ tasks.

func (*Refresher) SubmitRefreshTasks

func (r *Refresher) SubmitRefreshTasks(ctx context.Context) error

SubmitRefreshTasks submits tasks that update config for LUCI projects or disable projects that do not have CV config in LUCI Config.

It's expected to be called by a cron.

Jump to

Keyboard shortcuts

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