prjpb

package
v0.0.0-...-51f9457 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

package prjinternal stores protos for event processing of ProjectManager.

Index

Constants

View Source
const (
	// PMTaskInterval is target frequency of executions of ManageProjectTask.
	//
	// See Dispatch() for details.
	PMTaskInterval = time.Second

	// MaxAcceptableDelay prevents TQ tasks which arrive too late from invoking PM.
	//
	// MaxAcceptableDelay / PMTaskInterval effectively limits # concurrent
	// invocations of PM on the same project that may happen due to task retries,
	// delays, and queue throttling.
	//
	// Do not set too low, as this may prevent actual PM invoking from happening at
	// all if the TQ is overloaded.
	MaxAcceptableDelay = 60 * time.Second

	ManageProjectTaskClass     = "manage-project"
	KickManageProjectTaskClass = "kick-" + ManageProjectTaskClass
	PurgeProjectCLTaskClass    = "purge-project-cl"
)

Variables

View Source
var (
	Status_name = map[int32]string{
		0: "STATUS_UNSPECIFIED",
		1: "STARTED",
		2: "STOPPING",
		3: "STOPPED",
	}
	Status_value = map[string]int32{
		"STATUS_UNSPECIFIED": 0,
		"STARTED":            1,
		"STOPPING":           2,
		"STOPPED":            3,
	}
)

Enum value maps for Status.

View Source
var (
	LogReason_name = map[int32]string{
		0: "LOG_REASON_UNSPECIFIED",
		1: "FYI_PERIODIC",
		2: "STATUS_CHANGED",
		3: "CONFIG_CHANGED",
		4: "DEBUG",
	}
	LogReason_value = map[string]int32{
		"LOG_REASON_UNSPECIFIED": 0,
		"FYI_PERIODIC":           1,
		"STATUS_CHANGED":         2,
		"CONFIG_CHANGED":         3,
		"DEBUG":                  4,
	}
)

Enum value maps for LogReason.

View Source
var (
	PCL_Status_name = map[int32]string{
		0: "PCL_STATUS_UNSPECIFIED",

		1: "UNKNOWN",
		2: "UNWATCHED",
		3: "DELETED",
	}
	PCL_Status_value = map[string]int32{
		"PCL_STATUS_UNSPECIFIED": 0,
		"OK":                     0,
		"UNKNOWN":                1,
		"UNWATCHED":              2,
		"DELETED":                3,
	}
)

Enum value maps for PCL_Status.

View Source
var File_go_chromium_org_luci_cv_internal_prjmanager_prjpb_events_proto protoreflect.FileDescriptor
View Source
var File_go_chromium_org_luci_cv_internal_prjmanager_prjpb_storage_proto protoreflect.FileDescriptor
View Source
var File_go_chromium_org_luci_cv_internal_prjmanager_prjpb_tasks_proto protoreflect.FileDescriptor

Functions

func FormatLogReasons

func FormatLogReasons(in []LogReason) string

FormatLogReasons produces "[HUMAN, READABLE]" string for a list of statuses.

func InstallMockDispatcher

func InstallMockDispatcher(ctx context.Context, f func(luciProject string, eta time.Time)) context.Context

InstallMockDispatcher is used in test to run tests emitting PM events without actually dispatching PM tasks.

See pmtest.MockDispatch().

func MakeCLsUpdated

func MakeCLsUpdated(cls []*changelist.CL) *changelist.CLUpdatedEvents

MakeCLsUpdated returns CLsUpdated given the CLs.

In each given CL, .ID and .EVersion must be set.

func SortPRuns

func SortPRuns(pruns []*PRun)

Types

type Component

type Component struct {

	// CL IDs of the tracked CLs in this component. Sorted.
	//
	// Each referenced CL must be in PState.PCLs list.
	// Each referenced CL may have deps not in this list if they are either
	// PCL.Status.UNKNOWN or PCL.Status.UNWATCHED.
	//
	// A referenced CL is normally watched by this LUCI project. In rare cases,
	// referenced CL is no longer watched by this LUCI project but is still kept
	// in a component because the CL is still a member of an incomplete Run in
	// this component. In this case, the CL's deps are no longer tracked.
	Clids []int64 `protobuf:"varint,1,rep,packed,name=clids,proto3" json:"clids,omitempty"`
	// Decision time is the earliest time when this component should be
	// re-evaluated.
	//
	// Can be set to far future meaning no need for re-evaluation without an
	// external event (e.g., CLUpdated or RunFinished).
	DecisionTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=decision_time,json=decisionTime,proto3" json:"decision_time,omitempty"`
	// Incomplete Runs working on CLs from this component.
	//
	// Sorted by Run's ID.
	Pruns []*PRun `protobuf:"bytes,3,rep,name=pruns,proto3" json:"pruns,omitempty"`
	// If true, this component must be triaged as soon as possible.
	TriageRequired bool `protobuf:"varint,11,opt,name=triage_required,json=triageRequired,proto3" json:"triage_required,omitempty"`
	// contains filtered or unexported fields
}

Component is a set of CLs related to each other.

func (*Component) COWPRuns

func (component *Component) COWPRuns(m func(*PRun) *PRun, toAdd []*PRun) ([]*PRun, bool)

COWPRuns copy-on-write modifies component's runs.

func (*Component) CloneShallow

func (c *Component) CloneShallow() *Component

CloneShallow creates a new shallow clone.

func (*Component) Descriptor deprecated

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

Deprecated: Use Component.ProtoReflect.Descriptor instead.

func (*Component) GetClids

func (x *Component) GetClids() []int64

func (*Component) GetDecisionTime

func (x *Component) GetDecisionTime() *timestamppb.Timestamp

func (*Component) GetPruns

func (x *Component) GetPruns() []*PRun

func (*Component) GetTriageRequired

func (x *Component) GetTriageRequired() bool

func (*Component) ProtoMessage

func (*Component) ProtoMessage()

func (*Component) ProtoReflect

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

func (*Component) Reset

func (x *Component) Reset()

func (*Component) String

func (x *Component) String() string

type Event

type Event struct {

	// Types that are assignable to Event:
	//	*Event_NewConfig
	//	*Event_Poke
	//	*Event_ClUpdated
	//	*Event_ClsUpdated
	//	*Event_RunCreated
	//	*Event_RunFinished
	//	*Event_PurgeCompleted
	Event isEvent_Event `protobuf_oneof:"event"`
	// contains filtered or unexported fields
}

Event is a container for all kinds of events a project manager can receive.

func (*Event) Descriptor deprecated

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

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetClUpdated

func (x *Event) GetClUpdated() *changelist.CLUpdatedEvent

func (*Event) GetClsUpdated

func (x *Event) GetClsUpdated() *changelist.CLUpdatedEvents

func (*Event) GetEvent

func (m *Event) GetEvent() isEvent_Event

func (*Event) GetNewConfig

func (x *Event) GetNewConfig() *NewConfig

func (*Event) GetPoke

func (x *Event) GetPoke() *Poke

func (*Event) GetPurgeCompleted

func (x *Event) GetPurgeCompleted() *PurgeCompleted

func (*Event) GetRunCreated

func (x *Event) GetRunCreated() *RunCreated

func (*Event) GetRunFinished

func (x *Event) GetRunFinished() *RunFinished

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

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

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type Event_ClUpdated

type Event_ClUpdated struct {
	// Deprecated. Use batch version only.
	ClUpdated *changelist.CLUpdatedEvent `protobuf:"bytes,3,opt,name=cl_updated,json=clUpdated,proto3,oneof"`
}

type Event_ClsUpdated

type Event_ClsUpdated struct {
	ClsUpdated *changelist.CLUpdatedEvents `protobuf:"bytes,7,opt,name=cls_updated,json=clsUpdated,proto3,oneof"`
}

type Event_NewConfig

type Event_NewConfig struct {
	NewConfig *NewConfig `protobuf:"bytes,1,opt,name=new_config,json=newConfig,proto3,oneof"`
}

type Event_Poke

type Event_Poke struct {
	Poke *Poke `protobuf:"bytes,2,opt,name=poke,proto3,oneof"`
}

type Event_PurgeCompleted

type Event_PurgeCompleted struct {
	PurgeCompleted *PurgeCompleted `protobuf:"bytes,6,opt,name=purge_completed,json=purgeCompleted,proto3,oneof"`
}

type Event_RunCreated

type Event_RunCreated struct {
	RunCreated *RunCreated `protobuf:"bytes,4,opt,name=run_created,json=runCreated,proto3,oneof"`
}

type Event_RunFinished

type Event_RunFinished struct {
	RunFinished *RunFinished `protobuf:"bytes,5,opt,name=run_finished,json=runFinished,proto3,oneof"`
}

type KickManageProjectTask

type KickManageProjectTask struct {
	LuciProject string                 `protobuf:"bytes,1,opt,name=luci_project,json=luciProject,proto3" json:"luci_project,omitempty"`
	Eta         *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=eta,proto3" json:"eta,omitempty"`
	// contains filtered or unexported fields
}

KickManageProjectTask starts a task to actually enqueue ManageProjectTask.

It exists in order to send a deduplicatable ManageProjectTask from a transaction.

Queue: "kick-manage-project".

func (*KickManageProjectTask) Descriptor deprecated

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

Deprecated: Use KickManageProjectTask.ProtoReflect.Descriptor instead.

func (*KickManageProjectTask) GetEta

func (*KickManageProjectTask) GetLuciProject

func (x *KickManageProjectTask) GetLuciProject() string

func (*KickManageProjectTask) ProtoMessage

func (*KickManageProjectTask) ProtoMessage()

func (*KickManageProjectTask) ProtoReflect

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

func (*KickManageProjectTask) Reset

func (x *KickManageProjectTask) Reset()

func (*KickManageProjectTask) String

func (x *KickManageProjectTask) String() string

type LogReason

type LogReason int32

LogReason records why a change to the project state was logged.

See ProjectLog entity.

const (
	LogReason_LOG_REASON_UNSPECIFIED LogReason = 0
	// Due to passage of time or number of versions.
	LogReason_FYI_PERIODIC   LogReason = 1
	LogReason_STATUS_CHANGED LogReason = 2
	LogReason_CONFIG_CHANGED LogReason = 3
	// On-demand save for debugging reasons, e.g. on caught panic.
	LogReason_DEBUG LogReason = 4
)

func SortAndDedupeLogReasons

func SortAndDedupeLogReasons(in []LogReason) []LogReason

SortAndDedupeLogReasons does what its name says without modifying input.

func (LogReason) Descriptor

func (LogReason) Descriptor() protoreflect.EnumDescriptor

func (LogReason) Enum

func (x LogReason) Enum() *LogReason

func (LogReason) EnumDescriptor deprecated

func (LogReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use LogReason.Descriptor instead.

func (LogReason) Number

func (x LogReason) Number() protoreflect.EnumNumber

func (LogReason) String

func (x LogReason) String() string

func (LogReason) Type

type LogReasons

type LogReasons struct {
	Reasons []LogReason `protobuf:"varint,1,rep,packed,name=reasons,proto3,enum=cv.internal.prjmanager.prjpb.LogReason" json:"reasons,omitempty"`
	// contains filtered or unexported fields
}

func (*LogReasons) Descriptor deprecated

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

Deprecated: Use LogReasons.ProtoReflect.Descriptor instead.

func (*LogReasons) GetReasons

func (x *LogReasons) GetReasons() []LogReason

func (*LogReasons) ProtoMessage

func (*LogReasons) ProtoMessage()

func (*LogReasons) ProtoReflect

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

func (*LogReasons) Reset

func (x *LogReasons) Reset()

func (*LogReasons) String

func (x *LogReasons) String() string

type ManageProjectTask

type ManageProjectTask struct {
	LuciProject string                 `protobuf:"bytes,1,opt,name=luci_project,json=luciProject,proto3" json:"luci_project,omitempty"`
	Eta         *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=eta,proto3" json:"eta,omitempty"`
	// contains filtered or unexported fields
}

ManageProjectTask sends a signal to ProjectManager to process events.

Always used with de-duplication and thus can't be created from a transaction.

Queue: "manage-project".

func (*ManageProjectTask) Descriptor deprecated

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

Deprecated: Use ManageProjectTask.ProtoReflect.Descriptor instead.

func (*ManageProjectTask) GetEta

func (*ManageProjectTask) GetLuciProject

func (x *ManageProjectTask) GetLuciProject() string

func (*ManageProjectTask) ProtoMessage

func (*ManageProjectTask) ProtoMessage()

func (*ManageProjectTask) ProtoReflect

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

func (*ManageProjectTask) Reset

func (x *ManageProjectTask) Reset()

func (*ManageProjectTask) String

func (x *ManageProjectTask) String() string

type NewConfig

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

NewConfig is sent to PM by Project Config updater upon saving newest config in datastore.

func (*NewConfig) Descriptor deprecated

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

Deprecated: Use NewConfig.ProtoReflect.Descriptor instead.

func (*NewConfig) ProtoMessage

func (*NewConfig) ProtoMessage()

func (*NewConfig) ProtoReflect

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

func (*NewConfig) Reset

func (x *NewConfig) Reset()

func (*NewConfig) String

func (x *NewConfig) String() string

type PCL

type PCL struct {
	Clid     int64      `protobuf:"varint,1,opt,name=clid,proto3" json:"clid,omitempty"`
	Eversion int64      `protobuf:"varint,2,opt,name=eversion,proto3" json:"eversion,omitempty"`
	Status   PCL_Status `protobuf:"varint,3,opt,name=status,proto3,enum=cv.internal.prjmanager.prjpb.PCL_Status" json:"status,omitempty"`
	// Indexes in PState.config_group_names identifying ConfigGroup which watches
	// this CL.
	//
	// Normally, contains exactly 1 index.
	// May have > 1 index, which means 2+ non-fallback config groups watch this
	// CL, which is not allowed and will be signalled to CV users.
	// TODO(tandrii): move >1 index case to be tracked via `errors` field.
	ConfigGroupIndexes []int32 `protobuf:"varint,4,rep,packed,name=config_group_indexes,json=configGroupIndexes,proto3" json:"config_group_indexes,omitempty"`
	// Deps refers to CLs in PState.PCLs which are dependencies of the PCL.
	Deps []*changelist.Dep `protobuf:"bytes,11,rep,name=deps,proto3" json:"deps,omitempty"`
	// Trigger is CQDaemon-compatible record of who/when triggered CQ on this CL.
	//
	// It may be nil, if CL is not triggered but nevertheless tracked as either:
	//  * a dependency of another CL.
	//  * previously triggered member of an incomplete Run, which is probably
	//    being finalized right now by its Run Manager.
	//
	// TODO(tandrii): don't store potentially long user's email,
	// which isn't necessary for PM decision making. It should be (re)-computed
	// based on CL snapshots at the time only when actual Run is actually being
	// created.
	Trigger *run.Trigger `protobuf:"bytes,12,opt,name=trigger,proto3" json:"trigger,omitempty"`
	// Submitted means CV isn't going to work on a CL, but CL is still tracked as
	// a dep of another CL or as a member of an incomplete Run (though the other
	// Run will probably finish soon).
	Submitted bool `protobuf:"varint,13,opt,name=submitted,proto3" json:"submitted,omitempty"`
	// If set, describes one or more problems with CL.
	Errors []*changelist.CLError `protobuf:"bytes,15,rep,name=errors,proto3" json:"errors,omitempty"`
	// contains filtered or unexported fields
}

PCL is a tracked CL.

func (*PCL) Descriptor deprecated

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

Deprecated: Use PCL.ProtoReflect.Descriptor instead.

func (*PCL) GetClid

func (x *PCL) GetClid() int64

func (*PCL) GetConfigGroupIndexes

func (x *PCL) GetConfigGroupIndexes() []int32

func (*PCL) GetDeps

func (x *PCL) GetDeps() []*changelist.Dep

func (*PCL) GetErrors

func (x *PCL) GetErrors() []*changelist.CLError

func (*PCL) GetEversion

func (x *PCL) GetEversion() int64

func (*PCL) GetStatus

func (x *PCL) GetStatus() PCL_Status

func (*PCL) GetSubmitted

func (x *PCL) GetSubmitted() bool

func (*PCL) GetTrigger

func (x *PCL) GetTrigger() *run.Trigger

func (*PCL) ProtoMessage

func (*PCL) ProtoMessage()

func (*PCL) ProtoReflect

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

func (*PCL) Reset

func (x *PCL) Reset()

func (*PCL) String

func (x *PCL) String() string

type PCL_Status

type PCL_Status int32
const (
	PCL_PCL_STATUS_UNSPECIFIED PCL_Status = 0
	// OK means CL metadata below is correct and CL is watched by this project.
	//
	// Value 0 is chosen such that it's not serialized, since this is the most
	// common state.
	PCL_OK PCL_Status = 0
	// UNKNOWN means Datastore CL entity doesn't have the info yet.
	PCL_UNKNOWN PCL_Status = 1
	// UNWATCHED means CL isn't watched by this LUCI project.
	PCL_UNWATCHED PCL_Status = 2
	// DELETED means CL's Datastore entity got deleted.
	//
	// This is used to temporary mark a PCL before deleting it entirely from
	// PState to avoid dangling references from components.
	PCL_DELETED PCL_Status = 3
)

func (PCL_Status) Descriptor

func (PCL_Status) Descriptor() protoreflect.EnumDescriptor

func (PCL_Status) Enum

func (x PCL_Status) Enum() *PCL_Status

func (PCL_Status) EnumDescriptor deprecated

func (PCL_Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use PCL_Status.Descriptor instead.

func (PCL_Status) Number

func (x PCL_Status) Number() protoreflect.EnumNumber

func (PCL_Status) String

func (x PCL_Status) String() string

func (PCL_Status) Type

type PRun

type PRun struct {

	// CV's Run ID.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// IDs of CLs involved. Sorted.
	//
	// Actual Run may orders its CLs in a different way.
	Clids []int64 `protobuf:"varint,2,rep,packed,name=clids,proto3" json:"clids,omitempty"`
	// contains filtered or unexported fields
}

PRun is an incomplete Run on which CV is currently working.

It is referenced by at most 1 component.

func MakePRun

func MakePRun(r *run.Run) *PRun

MakePRun creates a PRun given a Run.

func (*PRun) Descriptor deprecated

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

Deprecated: Use PRun.ProtoReflect.Descriptor instead.

func (*PRun) GetClids

func (x *PRun) GetClids() []int64

func (*PRun) GetId

func (x *PRun) GetId() string

func (*PRun) ProtoMessage

func (*PRun) ProtoMessage()

func (*PRun) ProtoReflect

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

func (*PRun) Reset

func (x *PRun) Reset()

func (*PRun) String

func (x *PRun) String() string

type PState

type PState struct {

	// Name of LUCI project.
	LuciProject string `protobuf:"bytes,1,opt,name=luci_project,json=luciProject,proto3" json:"luci_project,omitempty"`
	// Status of the Project.
	Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=cv.internal.prjmanager.prjpb.Status" json:"status,omitempty"`
	// Config hash pins specific project config version.
	ConfigHash string `protobuf:"bytes,3,opt,name=config_hash,json=configHash,proto3" json:"config_hash,omitempty"`
	// Config group names intern the names referenced in PCL entities to reduce
	// memory and at-rest footprint.
	//
	// See also https://en.wikipedia.org/wiki/String_interning.
	ConfigGroupNames []string `protobuf:"bytes,4,rep,name=config_group_names,json=configGroupNames,proto3" json:"config_group_names,omitempty"`
	// PCLs are currently tracked CLs.
	//
	// Includes deps which are of not yet known kind (because CL doesn't yet have
	// a snapshot) or unwatched.
	//
	// Sorted by CL ID.
	Pcls []*PCL `protobuf:"bytes,11,rep,name=pcls,proto3" json:"pcls,omitempty"`
	// Components are a partition of CLs in the list above.
	//
	// An active CL (watched or used to be watched and still member of a Run) may
	// belong to at most 1 component, while unwatched dep may be referenced by
	// several.
	Components []*Component `protobuf:"bytes,12,rep,name=components,proto3" json:"components,omitempty"`
	// PurgingCLs are CLs currently being purged.
	//
	// They are tracked in PState to avoid creating Runs with such CLs.
	//
	// A CL being purged does not necessarily have a corresponding PCL.
	// A PurgingCL is kept in PState until purging process stops, regardless of
	// successful or failed.
	//
	// See more in PurgingCL doc.
	//
	// Sorted by CL ID.
	PurgingCls []*PurgingCL `protobuf:"bytes,13,rep,name=purging_cls,json=purgingCls,proto3" json:"purging_cls,omitempty"`
	// If true, components partition must be redone as soon as possible.
	RepartitionRequired bool `protobuf:"varint,21,opt,name=repartition_required,json=repartitionRequired,proto3" json:"repartition_required,omitempty"`
	// PRuns which can't yet be added to any component but should be. Sorted by
	// Run ID.
	//
	// In response to OnRunCreated event, PM may append to this list new Runs if
	// either:
	//   * not all Run's CLs are already known to PM;
	//   * Run's CLs are currently partitioned into different components.
	//
	// Thus,
	//   * CLs referenced by these PRuns may not be tracked;
	//   * If this field is not empty, re-partioning may be required.
	CreatedPruns []*PRun `protobuf:"bytes,22,rep,name=created_pruns,json=createdPruns,proto3" json:"created_pruns,omitempty"`
	// If set, establishes when components should be re-evaluated.
	NextEvalTime *timestamppb.Timestamp `protobuf:"bytes,23,opt,name=next_eval_time,json=nextEvalTime,proto3" json:"next_eval_time,omitempty"`
	// contains filtered or unexported fields
}

PState is the PM state of a specific LUCI project.

Semantically, it's a collection of CLs somehow grouped into components (see Component message below), each of which may have several active (a.k.a. Incomplete) Runs valid at a specific project's config version.

Most CLs are watched by the LUCI project, but to assist with error reporting, it also tracks unwatched CLs if they are dependencies of some actually watched CLs.

func (*PState) COWComponents

func (p *PState) COWComponents(m func(*Component) *Component, toAdd []*Component) ([]*Component, bool)

COWComponents copy-on-write modifies components.

func (*PState) COWCreatedRuns

func (p *PState) COWCreatedRuns(m func(*PRun) *PRun, toAdd []*PRun) ([]*PRun, bool)

COWCreatedRuns copy-on-write modifies CreatedRuns.

func (*PState) COWPCLs

func (p *PState) COWPCLs(m func(*PCL) *PCL, toAdd []*PCL) ([]*PCL, bool)

COWPCLs copy-on-write modifies PCLs.

func (*PState) COWPurgingCLs

func (p *PState) COWPurgingCLs(m func(*PurgingCL) *PurgingCL, toAdd []*PurgingCL) ([]*PurgingCL, bool)

COWPurgingCLs copy-on-write modifies PurgingCLs.

func (*PState) Descriptor deprecated

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

Deprecated: Use PState.ProtoReflect.Descriptor instead.

func (*PState) GetComponents

func (x *PState) GetComponents() []*Component

func (*PState) GetConfigGroupNames

func (x *PState) GetConfigGroupNames() []string

func (*PState) GetConfigHash

func (x *PState) GetConfigHash() string

func (*PState) GetCreatedPruns

func (x *PState) GetCreatedPruns() []*PRun

func (*PState) GetLuciProject

func (x *PState) GetLuciProject() string

func (*PState) GetNextEvalTime

func (x *PState) GetNextEvalTime() *timestamppb.Timestamp

func (*PState) GetPcls

func (x *PState) GetPcls() []*PCL

func (*PState) GetPurgingCls

func (x *PState) GetPurgingCls() []*PurgingCL

func (*PState) GetRepartitionRequired

func (x *PState) GetRepartitionRequired() bool

func (*PState) GetStatus

func (x *PState) GetStatus() Status

func (*PState) IncompleteRuns

func (p *PState) IncompleteRuns() (ids common.RunIDs)

IncompleteRuns are IDs of Runs which aren't yet completed.

func (*PState) IterIncompleteRuns

func (p *PState) IterIncompleteRuns(callback func(r *PRun, c *Component) (stop bool))

IterIncompleteRuns executes callback on each tracked Run.

Callback is given a Component if Run is assigned to a component, or a nil Component if Run is part of `.CreatedRuns` not yet assigned to any component. Stops iteration if callback returns true.

func (*PState) ProtoMessage

func (*PState) ProtoMessage()

func (*PState) ProtoReflect

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

func (*PState) Reset

func (x *PState) Reset()

func (*PState) String

func (x *PState) String() string

type Poke

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

Poke is sent to PM by Project Config updater.

func (*Poke) Descriptor deprecated

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

Deprecated: Use Poke.ProtoReflect.Descriptor instead.

func (*Poke) ProtoMessage

func (*Poke) ProtoMessage()

func (*Poke) ProtoReflect

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

func (*Poke) Reset

func (x *Poke) Reset()

func (*Poke) String

func (x *Poke) String() string

type PurgeCLTask

type PurgeCLTask struct {
	LuciProject string                `protobuf:"bytes,1,opt,name=luci_project,json=luciProject,proto3" json:"luci_project,omitempty"`
	PurgingCl   *PurgingCL            `protobuf:"bytes,2,opt,name=purging_cl,json=purgingCl,proto3" json:"purging_cl,omitempty"`
	Trigger     *run.Trigger          `protobuf:"bytes,3,opt,name=trigger,proto3" json:"trigger,omitempty"`
	Reasons     []*changelist.CLError `protobuf:"bytes,5,rep,name=reasons,proto3" json:"reasons,omitempty"`
	// contains filtered or unexported fields
}

PurgeCLTask starts a task to purge a CL.

Queue: "purge-project-cl".

func (*PurgeCLTask) Descriptor deprecated

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

Deprecated: Use PurgeCLTask.ProtoReflect.Descriptor instead.

func (*PurgeCLTask) GetLuciProject

func (x *PurgeCLTask) GetLuciProject() string

func (*PurgeCLTask) GetPurgingCl

func (x *PurgeCLTask) GetPurgingCl() *PurgingCL

func (*PurgeCLTask) GetReasons

func (x *PurgeCLTask) GetReasons() []*changelist.CLError

func (*PurgeCLTask) GetTrigger

func (x *PurgeCLTask) GetTrigger() *run.Trigger

func (*PurgeCLTask) ProtoMessage

func (*PurgeCLTask) ProtoMessage()

func (*PurgeCLTask) ProtoReflect

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

func (*PurgeCLTask) Reset

func (x *PurgeCLTask) Reset()

func (*PurgeCLTask) String

func (x *PurgeCLTask) String() string

type PurgeCompleted

type PurgeCompleted struct {

	// Operation ID suffices to identify a purge.
	OperationId string `protobuf:"bytes,1,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
	// contains filtered or unexported fields
}

PurgingCompleted is sent to PM by TQ task purging a CL.

See storage.proto:PurgingCL doc.

There is no status of the purge because it's the CL state that matters, hence success or failure will reach PM via CLUpdatedEvent.

func (*PurgeCompleted) Descriptor deprecated

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

Deprecated: Use PurgeCompleted.ProtoReflect.Descriptor instead.

func (*PurgeCompleted) GetOperationId

func (x *PurgeCompleted) GetOperationId() string

func (*PurgeCompleted) ProtoMessage

func (*PurgeCompleted) ProtoMessage()

func (*PurgeCompleted) ProtoReflect

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

func (*PurgeCompleted) Reset

func (x *PurgeCompleted) Reset()

func (*PurgeCompleted) String

func (x *PurgeCompleted) String() string

type PurgingCL

type PurgingCL struct {

	// CL ID which is being purged.
	Clid int64 `protobuf:"varint,1,opt,name=clid,proto3" json:"clid,omitempty"`
	// Operation ID is a unique within a project identifier of a purge operation
	// to use in PurgeCompleted events.
	OperationId string `protobuf:"bytes,2,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
	// Deadline is obeyed by the purging TQ task.
	//
	// TQ task SHOULD not modify a CL (e.g. via Gerrit RPCs) beyond this point.
	// This is merely best effort, as an RPC to external system initiated before
	// this deadline may still complete after it.
	//
	// If PM doesn't receive PurgeCompleted event before this deadline + some grace
	// period, PM will consider purge operation expired and it'll be removed from
	// PState.
	Deadline *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=deadline,proto3" json:"deadline,omitempty"`
	// contains filtered or unexported fields
}

PurgingCL represents purging of a CL due to some problem.

The purging process is initiated during PM state mutation while atomically adding a TQ task to perform the actual purge.

Purging itself constitutes removing whatever triggered CV on a CL as well as posting the reason for purging to the user.

Individual CLs are purged independently, even if CLs are related.

Upon TQ task completion, the task handler notifies PM back via an PurgeCompleted event. For fail-safe reasons, there is a deadline to perform the purge. PM keeps the PurgingCL in PState until either deadline is reached OR PurgeCompleted event is received.

func (*PurgingCL) Descriptor deprecated

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

Deprecated: Use PurgingCL.ProtoReflect.Descriptor instead.

func (*PurgingCL) GetClid

func (x *PurgingCL) GetClid() int64

func (*PurgingCL) GetDeadline

func (x *PurgingCL) GetDeadline() *timestamppb.Timestamp

func (*PurgingCL) GetOperationId

func (x *PurgingCL) GetOperationId() string

func (*PurgingCL) ProtoMessage

func (*PurgingCL) ProtoMessage()

func (*PurgingCL) ProtoReflect

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

func (*PurgingCL) Reset

func (x *PurgingCL) Reset()

func (*PurgingCL) String

func (x *PurgingCL) String() string

type RunCreated

type RunCreated struct {
	RunId string `protobuf:"bytes,1,opt,name=run_id,json=runId,proto3" json:"run_id,omitempty"`
	// contains filtered or unexported fields
}

RunCreated is sent to PM by either itself or API-based Run creation.

func (*RunCreated) Descriptor deprecated

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

Deprecated: Use RunCreated.ProtoReflect.Descriptor instead.

func (*RunCreated) GetRunId

func (x *RunCreated) GetRunId() string

func (*RunCreated) ProtoMessage

func (*RunCreated) ProtoMessage()

func (*RunCreated) ProtoReflect

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

func (*RunCreated) Reset

func (x *RunCreated) Reset()

func (*RunCreated) String

func (x *RunCreated) String() string

type RunFinished

type RunFinished struct {
	RunId string `protobuf:"bytes,1,opt,name=run_id,json=runId,proto3" json:"run_id,omitempty"`
	// contains filtered or unexported fields
}

RunFinished is sent to PM by Run Manager after or atomically with changing Run's status to a final status.

func (*RunFinished) Descriptor deprecated

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

Deprecated: Use RunFinished.ProtoReflect.Descriptor instead.

func (*RunFinished) GetRunId

func (x *RunFinished) GetRunId() string

func (*RunFinished) ProtoMessage

func (*RunFinished) ProtoMessage()

func (*RunFinished) ProtoReflect

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

func (*RunFinished) Reset

func (x *RunFinished) Reset()

func (*RunFinished) String

func (x *RunFinished) String() string

type Status

type Status int32
const (
	Status_STATUS_UNSPECIFIED Status = 0
	Status_STARTED            Status = 1
	Status_STOPPING           Status = 2
	Status_STOPPED            Status = 3
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type TasksBinding

type TasksBinding struct {
	ManageProject     tq.TaskClassRef
	KickManageProject tq.TaskClassRef
	PurgeProjectCL    tq.TaskClassRef
	TQDispatcher      *tq.Dispatcher
}

TasksBinding binds Project Manager tasks to a TQ Dispatcher.

This struct exists to separate task creation and handling, which in turns avoids circular dependency.

func Register

func Register(tqd *tq.Dispatcher) TasksBinding

func (TasksBinding) Dispatch

func (tr TasksBinding) Dispatch(ctx context.Context, luciProject string, eta time.Time) error

Dispatch ensures invocation of ProjectManager via ManageProjectTask.

ProjectManager will be invoked at approximately no earlier than both: * eta time * next possible.

To avoid actually dispatching TQ tasks in tests, use pmtest.MockDispatch().

Jump to

Keyboard shortcuts

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