migration

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: 27 Imported by: 0

Documentation

Overview

Package migration implements migration API to be called by CQDaemon.

The package is meant to be deleted after migration to CV is over. TODO(cbrug/1141880): delete this package.

Index

Constants

View Source
const AllowGroup = "luci-cv-migration-crbug-1141880"

AllowGroup is a Chrome Infra Auth group, members of which are allowed to call migration API. It's hardcoded here because this code is temporary.

Variables

This section is empty.

Functions

func ClaimFinishedCQRun

func ClaimFinishedCQRun(ctx context.Context, fr *FinishedCQDRun, rid common.RunID) error

ClaimFinishedCQRun associates a FinishedCQDRun with a Run.

Types

type FinishedCQDRun

type FinishedCQDRun struct {

	// AttemptKey is the CQD ID of the Run.
	//
	// Once CV starts creating Runs, the CV's Run for the same Run will contain
	// the AttemptKey as a substring.
	AttemptKey string `gae:"$id"`
	// RunID may be set if CQD's Attempt has corresponding CV Run at the time of
	// saving of this entity.
	//
	// Although the CV RunID is also stored in the Payload, a separate field is
	// necessary for Datastore indexing.
	RunID common.RunID
	// RecordTime is when this entity was inserted.
	UpdateTime time.Time `gae:",noindex"`
	// Everything that CQD has sent.
	Payload *migrationpb.ReportedRun
	// contains filtered or unexported fields
}

FinishedCQDRun contains info about a finished Run reported by the CQDaemon.

To be removed after the first milestone is reached.

TODO(crbug/1227523): wipe all such entities.

func LoadFinishedCQDRun

func LoadFinishedCQDRun(ctx context.Context, rid common.RunID) (*FinishedCQDRun, error)

LoadFinishedCQDRun loads from Datastore a FinishedCQDRun.

Expects exactly 1 FinishedCQDRun to exist.

func LoadUnclaimedFinishedCQDRun

func LoadUnclaimedFinishedCQDRun(ctx context.Context, attemptKey string) (*FinishedCQDRun, error)

LoadUnclaimedFinishedCQDRun returns a FinishedCQDRun with matching attemptKey and not associatd with a Run or nil if such an entity doesn't exist.

type MigrationServer

type MigrationServer struct {
	RunNotifier RunNotifier
	GFactory    gerrit.ClientFactory

	migrationpb.UnimplementedMigrationServer
}

MigrationServer implements CQDaemon -> CV migration API.

func (*MigrationServer) FetchActiveRuns

FetchActiveRuns returns all RUNNING runs without VerifiedCQDRun records.

func (*MigrationServer) FetchRunStatus

func (*MigrationServer) PostGerritMessage

func (*MigrationServer) ReportUsedNetrc

func (m *MigrationServer) ReportUsedNetrc(ctx context.Context, req *migrationpb.ReportUsedNetrcRequest) (resp *emptypb.Empty, err error)

func (*MigrationServer) ReportVerifiedRun

func (m *MigrationServer) ReportVerifiedRun(ctx context.Context, req *migrationpb.ReportVerifiedRunRequest) (resp *emptypb.Empty, err error)

ReportVerifiedRun notifies CV of the Run CQDaemon has just finished verifying.

Only called iff run was given to CQDaemon by CV via FetchActiveRuns.

type RunNotifier

type RunNotifier interface {
	NotifyCQDVerificationCompleted(ctx context.Context, runID common.RunID) error
	NotifyCQDFinished(ctx context.Context, runID common.RunID) error
}

RunNotifier abstracts out dependency of MigrationServer on run.Notifier.

type VerifiedCQDRun

type VerifiedCQDRun struct {

	// ID is ID of this Run in CV.
	ID common.RunID `gae:"$id"`
	// Payload is what CQDaemon has reported.
	Payload *migrationpb.ReportVerifiedRunRequest
	// RecordTime is when this entity was inserted.
	UpdateTime time.Time `gae:",noindex"`
	// contains filtered or unexported fields
}

VerifiedCQDRun is the Run reported by CQDaemon after verification completes.

Directories

Path Synopsis
Package cqdfake implements fake CQDaemon for use in tests.
Package cqdfake implements fake CQDaemon for use in tests.
package migrationcfg contains config-related CQD migration funcs.
package migrationcfg contains config-related CQD migration funcs.

Jump to

Keyboard shortcuts

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