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
- func ClaimFinishedCQRun(ctx context.Context, fr *FinishedCQDRun, rid common.RunID) error
- type FinishedCQDRun
- type MigrationServer
- func (m *MigrationServer) FetchActiveRuns(ctx context.Context, req *migrationpb.FetchActiveRunsRequest) (resp *migrationpb.FetchActiveRunsResponse, err error)
- func (m *MigrationServer) FetchRunStatus(ctx context.Context, req *migrationpb.FetchRunStatusRequest) (resp *migrationpb.FetchRunStatusResponse, err error)
- func (m *MigrationServer) PostGerritMessage(ctx context.Context, req *migrationpb.PostGerritMessageRequest) (resp *migrationpb.PostGerritMessageResponse, err error)
- func (m *MigrationServer) ReportUsedNetrc(ctx context.Context, req *migrationpb.ReportUsedNetrcRequest) (resp *emptypb.Empty, err error)
- func (m *MigrationServer) ReportVerifiedRun(ctx context.Context, req *migrationpb.ReportVerifiedRunRequest) (resp *emptypb.Empty, err error)
- type RunNotifier
- type VerifiedCQDRun
Constants ¶
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 ¶
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 ¶
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 ¶
func (m *MigrationServer) FetchActiveRuns(ctx context.Context, req *migrationpb.FetchActiveRunsRequest) (resp *migrationpb.FetchActiveRunsResponse, err error)
FetchActiveRuns returns all RUNNING runs without VerifiedCQDRun records.
func (*MigrationServer) FetchRunStatus ¶
func (m *MigrationServer) FetchRunStatus(ctx context.Context, req *migrationpb.FetchRunStatusRequest) (resp *migrationpb.FetchRunStatusResponse, err error)
func (*MigrationServer) PostGerritMessage ¶
func (m *MigrationServer) PostGerritMessage(ctx context.Context, req *migrationpb.PostGerritMessageRequest) (resp *migrationpb.PostGerritMessageResponse, err error)
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. |