mirror of
https://github.com/googleforgames/open-match.git
synced 2025-03-28 17:56:35 +00:00
114 lines
3.7 KiB
Protocol Buffer
114 lines
3.7 KiB
Protocol Buffer
// Copyright 2019 Google LLC
|
|
//
|
|
// 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 openmatch;
|
|
option go_package = "open-match.dev/open-match/pkg/pb";
|
|
option csharp_namespace = "OpenMatch";
|
|
|
|
import "api/messages.proto";
|
|
import "google/api/annotations.proto";
|
|
import "protoc-gen-swagger/options/annotations.proto";
|
|
|
|
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
|
|
info: {
|
|
title: "Backend"
|
|
version: "1.0"
|
|
contact: {
|
|
name: "Open Match"
|
|
url: "https://open-match.dev"
|
|
email: "open-match-discuss@googlegroups.com"
|
|
}
|
|
license: {
|
|
name: "Apache 2.0 License"
|
|
url: "https://github.com/googleforgames/open-match/blob/master/LICENSE"
|
|
}
|
|
}
|
|
external_docs: {
|
|
url: "https://open-match.dev/site/docs/"
|
|
description: "Open Match Documentation"
|
|
}
|
|
schemes: HTTP
|
|
schemes: HTTPS
|
|
consumes: "application/json"
|
|
produces: "application/json"
|
|
responses: {
|
|
key: "404"
|
|
value: {
|
|
description: "Returned when the resource does not exist."
|
|
schema: { json_schema: { type: STRING } }
|
|
}
|
|
}
|
|
// TODO Add annotations for security_defintiions.
|
|
// See
|
|
// https://github.com/grpc-ecosystem/grpc-gateway/blob/master/examples/proto/examplepb/a_bit_of_everything.proto
|
|
};
|
|
|
|
// FunctionConfig specifies a MMF address and client type for Backend to establish connections with the MMF
|
|
message FunctionConfig {
|
|
string host = 1;
|
|
int32 port = 2;
|
|
Type type = 3;
|
|
enum Type {
|
|
GRPC = 0;
|
|
REST = 1;
|
|
}
|
|
}
|
|
|
|
message FetchMatchesRequest {
|
|
// FunctionConfig specifies a MMF address and client type for Backend to establish connections with the MMF
|
|
FunctionConfig config = 1;
|
|
|
|
// MatchProfiles that will be sent to thhe MMF specified in the FunctionConfig.
|
|
repeated MatchProfile profiles = 2;
|
|
}
|
|
|
|
message FetchMatchesResponse {
|
|
// A Match generated by the user-defined MMF with the specified MatchProfiles.
|
|
// A valid Match response will contain at least one ticket.
|
|
Match match = 1;
|
|
}
|
|
|
|
message AssignTicketsRequest {
|
|
// TicketIds is a list of strings representing Open Match generated Ids which apply to an Assignment.
|
|
repeated string ticket_ids = 1;
|
|
|
|
// An Assignment specifies game connection related information to be associated with the TicketIds.
|
|
Assignment assignment = 2;
|
|
}
|
|
|
|
message AssignTicketsResponse {}
|
|
|
|
// The Backent service implements APIs to generate matches and handle ticket assignments.
|
|
service Backend {
|
|
// FetchMatches triggers a MatchFunction with the specified MatchProfiles, while each MatchProfile
|
|
// returns a set of match proposals. FetchMatches method streams the results back to the caller.
|
|
// FetchMatches immediately returns an error if it encounters any execution failures.
|
|
// - If the synchronizer is enabled, FetchMatch will then call the synchronizer to deduplicate proposals with overlapped tickets.
|
|
rpc FetchMatches(FetchMatchesRequest) returns (stream FetchMatchesResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/backend/matches:fetch"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
// AssignTickets overwrites the Assignment field of the input TicketIds.
|
|
rpc AssignTickets(AssignTicketsRequest) returns (AssignTicketsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/backend/tickets:assign"
|
|
body: "*"
|
|
};
|
|
}
|
|
}
|