blob: 942d3f8ab5efcd065fd201f5be40e8150f4c24ff [file] [log] [blame]
// Copyright 2021 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package diagnostic;
option go_package = "go.chromium.org/luci/cv/api/diagnostic;diagnosticpb";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "go.chromium.org/luci/cv/internal/changelist/storage.proto";
import "go.chromium.org/luci/cv/internal/gerrit/poller/storage.proto";
import "go.chromium.org/luci/cv/internal/prjmanager/prjpb/storage.proto";
import "go.chromium.org/luci/cv/internal/prjmanager/prjpb/events.proto";
import "go.chromium.org/luci/cv/internal/run/eventpb/events.proto";
import "go.chromium.org/luci/cv/internal/run/storage.proto";
// Diagnostic service is CV maintainers only.
//
// CAN AND WILL CHANGE WITHOUT NOTICE IN BACKWARDS INCOMPATIBLE WAY.
service Diagnostic {
// GetProject returns current Project state.
rpc GetProject(GetProjectRequest) returns (GetProjectResponse);
// GetRun returns current Run state.
rpc GetRun(GetRunRequest) returns (GetRunResponse);
// GetCL returns current CL state.
rpc GetCL(GetCLRequest) returns (GetCLResponse);
// GetPoller returns current Poller state.
rpc GetPoller(GetPollerRequest) returns (GetPollerResponse);
// DeleteProjectEvents deletes all outstanding project events.
// Must be called with stopped TQs.
// TODO(tandrii): delete this Temporary API.
rpc DeleteProjectEvents(DeleteProjectEventsRequest) returns (DeleteProjectEventsResponse);
// RefreshProjectCLs refreshes all CLs currently tracked by PM.
rpc RefreshProjectCLs(RefreshProjectCLsRequest) returns (RefreshProjectCLsResponse);
// SendProjectEvent sends event to a PM.
rpc SendProjectEvent(SendProjectEventRequest) returns (google.protobuf.Empty);
// SendRunEvent sends event to a RM.
rpc SendRunEvent(SendRunEventRequest) returns (google.protobuf.Empty);
}
message GetProjectRequest {
string project = 1;
}
// GetProjectResponse provides non-atomic snapshot of a LUCI project.
//
// The project state and outstanding events come from different entities,
// read in parallel.
message GetProjectResponse {
cv.prjmanager.prjpb.PState state = 2;
repeated cv.prjmanager.prjpb.Event events = 3;
}
message GetRunRequest {
string run = 1;
}
// GetRunResponse provides non-atomic snapshot of a Run.
//
// The Run state and outstanding events come from different entities
// read in parallel.
message GetRunResponse {
// State. Next tag: 13.
string id = 1;
int64 eversion = 2;
string mode = 3;
cv.run.Status status = 4;
google.protobuf.Timestamp create_time = 5;
google.protobuf.Timestamp start_time = 6;
google.protobuf.Timestamp update_time = 7;
google.protobuf.Timestamp end_time = 8;
string owner = 9;
string config_group_id = 10;
repeated int64 cls = 11;
cv.run.Submission submission = 12;
// Events.
repeated cv.run.eventpb.Event events = 61;
}
message GetCLRequest{
// One of the following.
// Not using oneof because it's more congitive load to type for something
// meant as a debug API only.
int64 id = 1;
string external_id = 2;
string gerrit_url = 3;
}
// GetProjectResponse provides non-atomic snapshot of a project state.
//
// The config hash and status come from different DS entity than PState,
// and each event comes from its own entity and depends on yet another tombstone
// entity.
message GetCLResponse {
int64 id = 1;
int64 eversion = 2;
string external_id = 3;
cv.changelist.Snapshot snapshot = 4;
cv.changelist.ApplicableConfig applicable_config = 5;
cv.changelist.DependentMeta dependent_meta = 6;
repeated string incomplete_runs = 7;
}
message GetPollerRequest{
string project = 1;
}
message GetPollerResponse {
string project = 1;
int64 eversion = 2;
google.protobuf.Timestamp update_time = 3;
string config_hash = 4;
cv.gerrit.poller.SubPollers subpollers = 5;
}
message DeleteProjectEventsRequest {
string project = 1;
int32 limit = 2;
}
message DeleteProjectEventsResponse {
map<string, int64> events = 1;
}
message RefreshProjectCLsRequest {
string project = 1;
}
message RefreshProjectCLsResponse{
// Map from CL ID to the EVersion in Datastore before the refresh.
map<int64, int64> cl_versions = 1;
}
message SendProjectEventRequest {
string project = 1;
cv.prjmanager.prjpb.Event event = 2;
}
message SendRunEventRequest {
string run = 1;
cv.run.eventpb.Event event = 2;
}