agones.dev/agones@v1.53.0/proto/allocation/processor.proto (about)

     1  // Copyright 2025 Google LLC All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package allocation;
    18  option go_package = "./allocation";
    19  
    20  import "google/rpc/status.proto";
    21  import "proto/allocation/allocation.proto";
    22  
    23  // [Stage: Dev]
    24  // [FeatureFlag:ProcessorAllocator]
    25  // The Processor service is used to process batches of allocation requests
    26  // and is designed to be used in a pull model with gRPC streaming.
    27  service Processor {
    28    // StreamBatches processes a stream of ProcessorMessage requests and returns a stream of ProcessorMessage responses.
    29    rpc StreamBatches(stream ProcessorMessage) returns (stream ProcessorMessage);
    30  }
    31  
    32  // The ProcessorMessage is used to send and receive messages between the client and server.
    33  message ProcessorMessage {
    34    // The client ID is used to identify the client that is sending the message.
    35    string client_id = 1;
    36  
    37    // The payload is a oneof field that can contain either a PullRequest, Batch, or BatchResponse.
    38    oneof payload {
    39      // A PullRequest is used to request a batch of allocation requests.
    40      PullRequest pull = 2;
    41      // A BatchRequest is used to send a batch of allocation requests.
    42      BatchRequest batch_request = 3;
    43      // A BatchResponse is used to send a response to a batch of allocation requests.
    44      BatchResponse batch_response = 4;
    45    }
    46  }
    47  
    48  // A PullRequest is used to request a batch of allocation requests.
    49  message PullRequest {
    50    string message = 1;
    51  }
    52  
    53  // BatchRequest to encapsulate multiple allocation requests
    54  // This is used to send a batch of requests in a single gRPC call.
    55  message BatchRequest {
    56    // Unique batch ID for tracking
    57    string batch_id = 1;
    58    
    59    // List of allocation requests
    60    repeated RequestWrapper requests = 2;
    61  }
    62  
    63  // RequestWrapper to encapsulate individual allocation requests
    64  message RequestWrapper {
    65    // Unique request ID for tracking
    66    string request_id = 1;
    67    
    68    // The actual allocation request
    69    allocation.AllocationRequest request = 2;
    70  }
    71  
    72  // BatchResponse to encapsulate multiple allocation responses
    73  message BatchResponse {
    74    // Unique batch ID for tracking
    75    string batch_id = 1;
    76    
    77    // List of responses for each request in the batch
    78    repeated ResponseWrapper responses = 2;
    79  }
    80  
    81  // ResponseWrapper to encapsulate individual allocation responses
    82  message ResponseWrapper {
    83    // Unique request ID for tracking
    84    string request_id = 1;
    85    
    86    // The actual allocation response
    87    oneof result {
    88      // Successful response
    89      allocation.AllocationResponse response = 2;
    90      
    91      // Error response
    92      google.rpc.Status error = 3;
    93    }
    94  }