go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/logdog/api/endpoints/coordinator/services/v1/service.proto (about)

     1  // Copyright 2016 The LUCI Authors. All rights reserved.
     2  // Use of this source code is governed under the Apache License, Version 2.0
     3  // that can be found in the LICENSE file.
     4  
     5  syntax = "proto3";
     6  
     7  package logdog;
     8  
     9  option go_package = "go.chromium.org/luci/logdog/api/endpoints/coordinator/services/v1;logdog";
    10  
    11  import "go.chromium.org/luci/logdog/api/endpoints/coordinator/services/v1/state.proto";
    12  import "go.chromium.org/luci/logdog/api/endpoints/coordinator/services/v1/tasks.proto";
    13  import "google/protobuf/duration.proto";
    14  import "google/protobuf/empty.proto";
    15  
    16  // Error is a projection of a gRPC error.
    17  //
    18  // NOTE: This and its helper functions may be useful more generally. Maybe
    19  // transplant this to a more general place such as "//grpc" if it ends up being
    20  // useful.
    21  message Error {
    22    // The gRPC code for this error.
    23    int32 grpc_code = 1;
    24    // Transient is true if this is a transient error.
    25    bool transient = 2;
    26    // An optional associated message.
    27    string msg = 3;
    28  }
    29  
    30  // RegisterStreamRequest is the set of caller-supplied data for the
    31  // RegisterStream Coordinator service endpoint.
    32  message RegisterStreamRequest {
    33    // The log stream's project.
    34    string project = 1;
    35    // The log stream's secret.
    36    bytes secret = 2;
    37  
    38    // The protobuf version string for this stream.
    39    string proto_version = 3;
    40    // The serialized LogStreamDescriptor protobuf for this stream.
    41    bytes desc = 4;
    42  
    43    // The stream's terminal index. If >= 0, the terminal index will be set
    44    // in the registration request, avoiding the need for an additional
    45    // termination RPC.
    46    int64 terminal_index = 5;
    47  }
    48  
    49  // The response message for the RegisterStream RPC.
    50  message RegisterStreamResponse {
    51    // The Coordinator ID of the log stream.
    52    string id = 1;
    53    // The state of the requested log stream.
    54    InternalLogStreamState state = 2;
    55  
    56    // Error is the error response.
    57    Error error = 3;
    58  }
    59  
    60  // LoadStreamRequest loads the current state of a log stream.
    61  message LoadStreamRequest {
    62    // The log stream's project.
    63    string project = 1;
    64    // The log stream's path Coordinator ID.
    65    string id = 2;
    66  
    67    // If true, include the log stream descriptor.
    68    bool desc = 3;
    69  }
    70  
    71  // The response message for the LoadStream RPC.
    72  message LoadStreamResponse {
    73    // The state of the requested log stream.
    74    InternalLogStreamState state = 1;
    75  
    76    // If requested, the serialized log stream descriptor. The protobuf version
    77    // of this descriptor will match the "proto_version" field in "state".
    78    bytes desc = 2;
    79  
    80    // The age of the log stream.
    81    google.protobuf.Duration age = 3;
    82  
    83    // The archival key of the log stream. If this key doesn't match the key in
    84    // the archival request, the request is superfluous and should be deleted.
    85    bytes archival_key = 4;
    86  }
    87  
    88  // TerminateStreamRequest is the set of caller-supplied data for the
    89  // TerminateStream service endpoint.
    90  message TerminateStreamRequest {
    91    // The log stream's project.
    92    string project = 1;
    93    // The log stream's path Coordinator ID.
    94    string id = 2;
    95    // The log stream's secret.
    96    bytes secret = 3;
    97  
    98    // The terminal index of the stream.
    99    int64 terminal_index = 4;
   100  }
   101  
   102  // ArchiveStreamRequest is the set of caller-supplied data for the ArchiveStream
   103  // service endpoint.
   104  message ArchiveStreamRequest {
   105    // The log stream's project.
   106    string project = 1;
   107    // The Coordinator ID of the log stream that was archived.
   108    string id = 2;
   109    // The number of log entries that were archived.
   110    int64 log_entry_count = 3;
   111    // The highest log stream index that was archived.
   112    int64 terminal_index = 4;
   113    // If not empty, there was an archival error.
   114    //
   115    // This field serves to indicate that an error occurred (being non-empty) and
   116    // to supply an value that will show up in the Coordinator ArchiveStream
   117    // endpoint logs.
   118    string error = 5;
   119  
   120    // The archive URL of the log stream's stream data.
   121    string stream_url = 10;
   122    // The size of the log stream's stream data.
   123    int64 stream_size = 11;
   124  
   125    // The archive URL of the log stream's index data.
   126    string index_url = 20;
   127    // The size of the log stream's index data.
   128    int64 index_size = 21;
   129  
   130    reserved "data_url", "data_size";
   131    reserved 30, 31;
   132  }
   133  
   134  // BatchRequest is a batch of individual requests to make to the Coordinator.
   135  message BatchRequest {
   136    // The collection of batched requests.
   137    message Entry {
   138      oneof value {
   139        RegisterStreamRequest register_stream = 1;
   140        LoadStreamRequest load_stream = 2;
   141        TerminateStreamRequest terminate_stream = 3;
   142        ArchiveStreamRequest archive_stream = 4;
   143      };
   144    }
   145    repeated Entry req = 1;
   146  }
   147  
   148  // BatchResponse is a response to a BatchRequest.
   149  message BatchResponse {
   150    // The collection of batched requests.
   151    //
   152    // Each entry corresponds to the BatchRequest entry with the specified index.
   153    //
   154    // Entry objects may appear out of order with their request indexes. Some
   155    // responses may also be missing, if the remote end could not provide them
   156    // due to constraints (e.g., size, time).
   157    message Entry {
   158      // The index in the BatchRequest for this entry.
   159      int32 index = 1;
   160  
   161      oneof value {
   162        Error err = 2;
   163  
   164        RegisterStreamResponse register_stream = 3;
   165        LoadStreamResponse load_stream = 4;
   166      };
   167    }
   168    repeated Entry resp = 1;
   169  }
   170  
   171  message LeaseRequest {
   172    int64 max_tasks = 1;
   173    google.protobuf.Duration lease_time = 2;
   174  }
   175  
   176  message LeaseResponse {
   177    // Tasks are tasks leased to the caller.  Only Project and Id are filled.
   178    repeated ArchiveTask tasks = 1;
   179  }
   180  
   181  message DeleteRequest {
   182    // Tasks are tasks the caller wants to delete.  Only Project and Id are required.
   183    repeated ArchiveTask tasks = 1;
   184  }
   185  
   186  // Services service is a LogDog Coordinator endpoint that interfaces with
   187  // LogDog processing services.
   188  service Services {
   189    // RegisterStream is an idempotent stream state register operation.
   190    rpc RegisterStream(RegisterStreamRequest) returns (RegisterStreamResponse);
   191  
   192    // LoadStream loads the current state of a log stream.
   193    rpc LoadStream(LoadStreamRequest) returns (LoadStreamResponse);
   194  
   195    // TerminateStream is an idempotent operation to update the stream's terminal
   196    // index.
   197    rpc TerminateStream(TerminateStreamRequest) returns (google.protobuf.Empty);
   198  
   199    // ArchiveStream is an idempotent operation to record a log stream's archival
   200    // parameters. It is used by the Archivist service upon successful stream
   201    // archival.
   202    rpc ArchiveStream(ArchiveStreamRequest) returns (google.protobuf.Empty);
   203  
   204    // Batch is a series of requests submitted in batch. It returns a
   205    // BatchResponse containing the same number of entries, with each entry index
   206    // corresponding to its request index.
   207    rpc Batch(BatchRequest) returns (BatchResponse);
   208  
   209    // TaskQueueLease is a passthrough to appengine's taskqueue.Lease.
   210    // TODO(hinoka): Remove this when https://cloud.google.com/tasks/ is out of Beta.
   211    rpc LeaseArchiveTasks(LeaseRequest) returns (LeaseResponse);
   212  
   213    // TaskQueueDeleteMulti is a passthrough to appengine's taskqueue.DeleteMulti
   214    // TODO(hinoka): Remove this when https://cloud.google.com/tasks/ is out of Beta.
   215    rpc DeleteArchiveTasks(DeleteRequest) returns (google.protobuf.Empty);
   216  }