diff --git a/build/includes/sdk.mk b/build/includes/sdk.mk index 974b4d8757..12fc261e19 100644 --- a/build/includes/sdk.mk +++ b/build/includes/sdk.mk @@ -35,7 +35,6 @@ SDK_FOLDER ?= go COMMAND ?= gen SDK_IMAGE_TAG=$(build_sdk_prefix)$(SDK_FOLDER):$(build_sdk_version) DEFAULT_CONFORMANCE_TESTS = ready,allocate,setlabel,setannotation,gameserver,health,shutdown,watch,reserve -ALPHA_CONFORMANCE_TESTS = getplayercapacity,setplayercapacity,playerconnect,playerdisconnect,getplayercount,isplayerconnected,getconnectedplayers # TODO: Move Counter and List tests into DEFAULT_CONFORMANCE_TESTS once the they are written for all SDKs COUNTS_AND_LISTS_TESTS = getcounter,updatecounter,setcountcounter,setcapacitycounter,getlist,updatelist,addlistvalue,removelistvalue @@ -176,39 +175,27 @@ run-sdk-conformance-test-node: run-sdk-conformance-test-go: # run with on-by-default (Beta) feature flags enabled $(MAKE) run-sdk-conformance-test SDK_FOLDER=go GRPC_PORT=9001 HTTP_PORT=9101 TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS) - # run with Alpha and Beta feature flags enabled - $(MAKE) run-sdk-conformance-test SDK_FOLDER=go GRPC_PORT=9001 HTTP_PORT=9101 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS) run-sdk-conformance-test-rust: # run without feature flags $(MAKE) run-sdk-conformance-test SDK_FOLDER=rust GRPC_PORT=9004 HTTP_PORT=9104 # run without feature flags and with RUN_ASYNC=true DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS) -e RUN_ASYNC=true" $(MAKE) run-sdk-conformance-test SDK_FOLDER=rust GRPC_PORT=9004 HTTP_PORT=9104 - # run with feature flags enabled - $(MAKE) run-sdk-conformance-test SDK_FOLDER=rust GRPC_PORT=9004 HTTP_PORT=9104 FEATURE_GATES=PlayerTracking=true TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS) - # run with feature flags enabled and with RUN_ASYNC=true - DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS) -e RUN_ASYNC=true" $(MAKE) run-sdk-conformance-test SDK_FOLDER=rust GRPC_PORT=9004 HTTP_PORT=9104 FEATURE_GATES=PlayerTracking=true TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS) run-sdk-conformance-test-csharp: # run with Beta feature flags enabled $(MAKE) run-sdk-conformance-test SDK_FOLDER=csharp GRPC_PORT=9005 HTTP_PORT=9105 FEATURE_GATES=$(BETA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS) - # run with Alpha feature flags enabled - $(MAKE) run-sdk-conformance-test SDK_FOLDER=csharp GRPC_PORT=9005 HTTP_PORT=9105 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS) run-sdk-conformance-test-rest: # (note: the restapi folder doesn't use GRPC_PORT but run-sdk-conformance-no-build defaults it, so we supply a unique value here) # run with Beta feature flags enabled $(MAKE) run-sdk-conformance-test SDK_FOLDER=restapi GRPC_PORT=9050 HTTP_PORT=9150 FEATURE_GATES=$(BETA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS) - # run with Alpha feature flags enabled - $(MAKE) run-sdk-conformance-test SDK_FOLDER=restapi GRPC_PORT=9050 HTTP_PORT=9150 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS) $(MAKE) run-sdk-command COMMAND=clean SDK_FOLDER=restapi run-sdk-conformance-test-python: # run with Beta feature flags enabled $(MAKE) run-sdk-conformance-test SDK_FOLDER=python GRPC_PORT=9006 HTTP_PORT=9106 FEATURE_GATES=$(BETA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS) - # run with Alpha feature flags enabled - $(MAKE) run-sdk-conformance-test SDK_FOLDER=python GRPC_PORT=9006 HTTP_PORT=9106 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS) # Run a conformance test for all SDKs supported run-sdk-conformance-tests: run-sdk-conformance-test-node run-sdk-conformance-test-go run-sdk-conformance-test-rust run-sdk-conformance-test-rest run-sdk-conformance-test-cpp run-sdk-conformance-test-csharp run-sdk-conformance-test-python diff --git a/cmd/sdk-server/main.go b/cmd/sdk-server/main.go index 9fad7ed617..729d3a856c 100644 --- a/cmd/sdk-server/main.go +++ b/cmd/sdk-server/main.go @@ -261,10 +261,6 @@ func runGateway(ctx context.Context, grpcEndpoint string, mux *gwruntime.ServeMu logger.WithError(err).Fatal("Could not register sdk grpc-gateway") } - if err := sdkalpha.RegisterSDKHandler(ctx, mux, conn); err != nil { - logger.WithError(err).Fatal("Could not register alpha sdk grpc-gateway") - } - if err := sdkbeta.RegisterSDKHandler(ctx, mux, conn); err != nil { logger.WithError(err).Fatal("Could not register beta sdk grpc-gateway") } diff --git a/examples/gameserverallocation-deprecated.yaml b/examples/gameserverallocation-deprecated.yaml index b61a6de4d4..3444645bd2 100644 --- a/examples/gameserverallocation-deprecated.yaml +++ b/examples/gameserverallocation-deprecated.yaml @@ -39,15 +39,8 @@ spec: - {key: tier, operator: In, values: [cache]} # Specifies which State is the filter to be used when attempting to retrieve a GameServer # via Allocation. Defaults to "Ready". The only other option is "Allocated", which can be used in conjunction with - # label/annotation/player selectors to retrieve an already Allocated GameServer. + # label/annotation selectors to retrieve an already Allocated GameServer. gameServerState: Ready - # [Stage:Alpha] - # [FeatureFlag:PlayerAllocationFilter] - # Provides a filter on minimum and maximum values for player capacity when retrieving a GameServer - # through Allocation. Defaults to no limits. - players: - minAvailable: 0 - maxAvailable: 99 # Deprecated, use selectors instead. # ordered list of preferred allocations out of the `required` set. # If the first selector is not matched, the selection attempts the second selector, and so on. diff --git a/examples/nodejs-simple/README.md b/examples/nodejs-simple/README.md index 3817489e14..e19224c6a5 100644 --- a/examples/nodejs-simple/README.md +++ b/examples/nodejs-simple/README.md @@ -12,10 +12,6 @@ It will: - After the shutdown duration (default 60 seconds), shut the server down - Parse options to get help or set the shutdown timeout duration -If alpha features are enabled it will additionally: -- Set and get the player capacity (this is not enforced) -- Add, get and remove players, and test if they are present - To learn how to deploy this example service to GKE, please see the tutorial [Build and Run a Simple Gameserver (node.js)](https://agones.dev/site/docs/tutorials/simple-gameserver-nodejs/). ## Building @@ -81,15 +77,3 @@ $ make args="--timeout=0" run $ docker run --network=host us-docker.pkg.dev/agones-images/examples/nodejs-simple-server:0.10 --timeout=0 $ npm start -- --timeout=0 ``` - -To enable alpha features ensure the feature gate is enabled: -```bash -$ cd ../../build; make run-sdk-conformance-local TIMEOUT=120 FEATURE_GATES="PlayerTracking=true" TESTS=ready,watch,health,gameserver -``` - -Then enable the alpha suite: -``` -$ make args="--alpha" run -$ docker run --network=host us-docker.pkg.dev/agones-images/examples/nodejs-simple-server:0.10 --alpha -$ npm start -- --alpha -``` diff --git a/examples/nodejs-simple/src/index.js b/examples/nodejs-simple/src/index.js index ffa730d9f2..f51f529dc6 100644 --- a/examples/nodejs-simple/src/index.js +++ b/examples/nodejs-simple/src/index.js @@ -18,7 +18,7 @@ const {setTimeout} = require('timers/promises'); const DEFAULT_TIMEOUT = 60; const MAX_TIMEOUT = 2147483; -const connect = async (timeout, enableAlpha, enableBeta) => { +const connect = async (timeout, enableBeta) => { let agonesSDK = new AgonesSDK(); let lifetimeInterval; @@ -44,11 +44,6 @@ const connect = async (timeout, enableAlpha, enableBeta) => { state: ${result.status.state} labels: ${result.objectMeta.labelsMap.join(' & ')} annotations: ${result.objectMeta.annotationsMap.join(' & ')}`; - if (enableAlpha) { - output += ` - players: ${result.status.players.count}/${result.status.players.capacity} [${result.status.players.idsList}]`; - } - console.log(output); }, (error) => { console.error('Watch ERROR', error); clearInterval(healthInterval); @@ -77,11 +72,6 @@ const connect = async (timeout, enableAlpha, enableBeta) => { await agonesSDK.reserve(10); await setTimeout(15000); - if (enableAlpha) { - console.log('Running alpha suite'); - await runAlphaSuite(agonesSDK); - } - if (enableBeta) { console.log('Running beta suite'); await runBetaSuite(agonesSDK); @@ -117,61 +107,6 @@ const connect = async (timeout, enableAlpha, enableBeta) => { } }; -const runAlphaSuite = async (agonesSDK) => { - await setTimeout(5000); - console.log('Setting capacity'); - await agonesSDK.alpha.setPlayerCapacity(64); - - await setTimeout(5000); - console.log('Getting capacity'); - let result = await agonesSDK.alpha.getPlayerCapacity(); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Connecting a player'); - result = await agonesSDK.alpha.playerConnect('firstPlayerID'); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Connecting a duplicate player'); - result = await agonesSDK.alpha.playerConnect('firstPlayerID'); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Connecting another player'); - await agonesSDK.alpha.playerConnect('secondPlayerID'); - - await setTimeout(5000); - console.log('Getting player count'); - result = await agonesSDK.alpha.getPlayerCount(); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Finding if firstPlayerID connected'); - result = await agonesSDK.alpha.isPlayerConnected('firstPlayerID'); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Getting connected players'); - result = await agonesSDK.alpha.getConnectedPlayers(); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Disconnecting a player'); - result = await agonesSDK.alpha.playerDisconnect('firstPlayerID'); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Disconnecting the same player'); - result = await agonesSDK.alpha.playerDisconnect('firstPlayerID'); - console.log(`result: ${result}`); - - await setTimeout(5000); - console.log('Setting counter capacity'); - result = await agonesSDK.alpha.setCounterCapacity('testCounter', 10); - console.log(`result: ${result}`); -}; - const runBetaSuite = async (agonesSDK) => { let result; @@ -236,7 +171,6 @@ const runBetaSuite = async (agonesSDK) => { let args = process.argv.slice(2); let timeout = DEFAULT_TIMEOUT; -let enableAlpha = false; let enableBeta = false; for (let arg of args) { @@ -246,7 +180,6 @@ for (let arg of args) { Options: --timeout=...\t\tshutdown timeout in seconds. Use 0 to never shut down - --alpha\t\t\tenable alpha features --beta\t\t\tenable beta features`); return; } @@ -264,10 +197,6 @@ Options: } } - if (argName === '--alpha') { - console.log('Enabling alpha features!'); - enableAlpha = true; - } if (argName === '--beta') { console.log('Enabling beta features!'); @@ -275,4 +204,4 @@ Options: } } -connect(timeout, enableAlpha, enableBeta); +connect(timeout,enableBeta); diff --git a/examples/simple-game-server/handlers.go b/examples/simple-game-server/handlers.go index 85081eea6f..ad431d8d84 100644 --- a/examples/simple-game-server/handlers.go +++ b/examples/simple-game-server/handlers.go @@ -41,12 +41,6 @@ var responseMap = map[string]responseHandler{ "LABEL": handleLabel, "CRASH": handleCrash, "ANNOTATION": handleAnnotation, - "PLAYER_CAPACITY": handlePlayerCapacity, - "PLAYER_CONNECT": handlePlayerConnect, - "PLAYER_DISCONNECT": handlePlayerDisconnect, - "PLAYER_CONNECTED": handlePlayerConnected, - "GET_PLAYERS": handleGetPlayers, - "PLAYER_COUNT": handlePlayerCount, "GET_COUNTER_COUNT": handleGetCounterCount, "INCREMENT_COUNTER": handleIncrementCounter, "DECREMENT_COUNTER": handleDecrementCounter, @@ -212,107 +206,6 @@ func handleAnnotation(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (resp return } -// handlePlayerCapacity sets the player capacity to the given value -// or returns the current player capacity as a string -func handlePlayerCapacity(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (response string, addACK bool, responseError error) { - response, addACK = defaultReply(parts) - switch len(parts) { - case 1: - log.Print("Getting Player Capacity") - capacity, err := s.Alpha().GetPlayerCapacity() - if err != nil { - log.Fatalf("could not get capacity: %v", err) - } - response = strconv.FormatInt(capacity, 10) + "\n" - addACK = false - case 2: - if cap, err := strconv.Atoi(parts[1]); err != nil { - response = fmt.Sprintf("%s", err) - responseError = err - } else { - log.Printf("Setting Player Capacity to %d", int64(cap)) - if err := s.Alpha().SetPlayerCapacity(int64(cap)); err != nil { - log.Fatalf("could not set capacity: %v", err) - } - } - default: - response = "Invalid PLAYER_CAPACITY, should have 0 or 1 arguments" - responseError = fmt.Errorf("Invalid PLAYER_CAPACITY, should have 0 or 1 arguments") - } - return -} - -// handlePlayerConnect connects a given player -func handlePlayerConnect(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (response string, addACK bool, responseError error) { - response, addACK = defaultReply(parts) - if len(parts) < 2 { - response = "Invalid PLAYER_CONNECT, should have 1 argument" - responseError = fmt.Errorf("Invalid PLAYER_CONNECT, should have 1 argument") - return - } - log.Printf("Connecting Player: %s", parts[1]) - if _, err := s.Alpha().PlayerConnect(parts[1]); err != nil { - log.Fatalf("could not connect player: %v", err) - } - return -} - -// handlePlayerDisconnect disconnects a given player -func handlePlayerDisconnect(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (response string, addACK bool, responseError error) { - response, addACK = defaultReply(parts) - if len(parts) < 2 { - response = "Invalid PLAYER_DISCONNECT, should have 1 argument" - responseError = fmt.Errorf("Invalid PLAYER_DISCONNECT, should have 1 argument") - return - } - log.Printf("Disconnecting Player: %s", parts[1]) - if _, err := s.Alpha().PlayerDisconnect(parts[1]); err != nil { - log.Fatalf("could not disconnect player: %v", err) - } - return -} - -// handlePlayerConnected returns a bool as a string if a player is connected -func handlePlayerConnected(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (response string, addACK bool, responseError error) { - if len(parts) < 2 { - response = "Invalid PLAYER_CONNECTED, should have 1 argument" - responseError = fmt.Errorf("Invalid PLAYER_CONNECTED, should have 1 argument") - return - } - log.Printf("Checking if player %s is connected", parts[1]) - connected, err := s.Alpha().IsPlayerConnected(parts[1]) - if err != nil { - log.Fatalf("could not retrieve if player is connected: %v", err) - } - response = strconv.FormatBool(connected) + "\n" - addACK = false - return -} - -// handleGetPlayers returns a comma delimited list of connected players -func handleGetPlayers(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (response string, addACK bool, responseError error) { - log.Print("Retrieving connected player list") - list, err := s.Alpha().GetConnectedPlayers() - if err != nil { - log.Fatalf("could not retrieve connected players: %s", err) - } - response = strings.Join(list, ",") + "\n" - addACK = false - return -} - -// handlePlayerCount returns the count of connected players as a string -func handlePlayerCount(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (response string, addACK bool, responseError error) { - log.Print("Retrieving connected player count") - count, err := s.Alpha().GetPlayerCount() - if err != nil { - log.Fatalf("could not retrieve player count: %s", err) - } - response = strconv.FormatInt(count, 10) + "\n" - addACK = false - return -} - // handleGetCounterCount returns the Count of the given Counter as a string func handleGetCounterCount(s *sdk.SDK, parts []string, _ ...context.CancelFunc) (response string, addACK bool, responseError error) { if len(parts) < 2 { diff --git a/examples/supertuxkart/main.go b/examples/supertuxkart/main.go index 599a8e8b0e..e3187b0b65 100644 --- a/examples/supertuxkart/main.go +++ b/examples/supertuxkart/main.go @@ -38,9 +38,6 @@ func main() { log.SetPrefix("[wrapper] ") input := flag.String("i", "", "the command and arguments to execute the server binary") - // Since player tracking is not on by default, it is behind this flag. - // If it is off, still log messages about players, but don't actually call the player tracking functions. - enablePlayerTracking := flag.Bool("player-tracking", false, "If true, player tracking will be enabled.") flag.Parse() log.Println("Connecting to Agones with the SDK") @@ -49,12 +46,6 @@ func main() { log.Fatalf("could not connect to SDK: %v", err) } - if *enablePlayerTracking { - if err = s.Alpha().SetPlayerCapacity(8); err != nil { - log.Fatalf("could not set play count: %v", err) - } - } - log.Println("Starting health checking") go doHealth(s) @@ -121,27 +112,11 @@ func main() { log.Print("could not determine player") break } - if *enablePlayerTracking { - result, err := s.Alpha().PlayerConnect(*player) - if err != nil { - log.Print(err) - } else { - log.Print(result) - } - } case "PLAYERLEAVE": if player == nil { log.Print("could not determine player") break } - if *enablePlayerTracking { - result, err := s.Alpha().PlayerDisconnect(*player) - if err != nil { - log.Print(err) - } else { - log.Print(result) - } - } case "SHUTDOWN": if err := s.Shutdown(); err != nil { log.Fatal(err) diff --git a/pkg/sdk/alpha/alpha.pb.go b/pkg/sdk/alpha/alpha.pb.go index d3282c81d8..0862039d0a 100644 --- a/pkg/sdk/alpha/alpha.pb.go +++ b/pkg/sdk/alpha/alpha.pb.go @@ -37,10 +37,8 @@ package alpha import ( reflect "reflect" - sync "sync" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" - _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) @@ -52,353 +50,27 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// I am Empty -type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Empty) Reset() { - *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Empty) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Empty) ProtoMessage() {} - -func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Empty.ProtoReflect.Descriptor instead. -func (*Empty) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{0} -} - -// Store a count variable. -type Count struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` -} - -func (x *Count) Reset() { - *x = Count{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Count) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Count) ProtoMessage() {} - -func (x *Count) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Count.ProtoReflect.Descriptor instead. -func (*Count) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{1} -} - -func (x *Count) GetCount() int64 { - if x != nil { - return x.Count - } - return 0 -} - -// Store a boolean result -type Bool struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Bool bool `protobuf:"varint,1,opt,name=bool,proto3" json:"bool,omitempty"` -} - -func (x *Bool) Reset() { - *x = Bool{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Bool) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Bool) ProtoMessage() {} - -func (x *Bool) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Bool.ProtoReflect.Descriptor instead. -func (*Bool) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{2} -} - -func (x *Bool) GetBool() bool { - if x != nil { - return x.Bool - } - return false -} - -// The unique identifier for a given player. -type PlayerID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PlayerID string `protobuf:"bytes,1,opt,name=playerID,proto3" json:"playerID,omitempty"` -} - -func (x *PlayerID) Reset() { - *x = PlayerID{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PlayerID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PlayerID) ProtoMessage() {} - -func (x *PlayerID) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PlayerID.ProtoReflect.Descriptor instead. -func (*PlayerID) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{3} -} - -func (x *PlayerID) GetPlayerID() string { - if x != nil { - return x.PlayerID - } - return "" -} - -// List of Player IDs -type PlayerIDList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - List []string `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` -} - -func (x *PlayerIDList) Reset() { - *x = PlayerIDList{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PlayerIDList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PlayerIDList) ProtoMessage() {} - -func (x *PlayerIDList) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PlayerIDList.ProtoReflect.Descriptor instead. -func (*PlayerIDList) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{4} -} - -func (x *PlayerIDList) GetList() []string { - if x != nil { - return x.List - } - return nil -} - var File_alpha_proto protoreflect.FileDescriptor var file_alpha_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1d, 0x0a, 0x05, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x04, 0x42, 0x6f, 0x6f, - 0x6c, 0x12, 0x21, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, - 0x0d, 0x92, 0x41, 0x0a, 0xa2, 0x02, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x04, - 0x62, 0x6f, 0x6f, 0x6c, 0x22, 0x26, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x22, 0x22, 0x0a, 0x0c, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, - 0x32, 0xa9, 0x06, 0x0a, 0x03, 0x53, 0x44, 0x4b, 0x12, 0x6d, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x67, 0x6f, 0x6e, - 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, - 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x73, 0x0a, 0x10, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x67, - 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, - 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x22, - 0x18, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x70, 0x0a, 0x11, - 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, - 0x79, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, - 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x1b, - 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x1b, 0x1a, 0x16, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x6d, - 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, - 0x69, 0x74, 0x79, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, - 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x1e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, - 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x61, - 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x15, 0x12, 0x13, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x7b, 0x0a, 0x11, 0x49, 0x73, 0x50, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, 0x61, 0x67, - 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, - 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, - 0x22, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x49, 0x44, 0x7d, 0x12, 0x77, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, - 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x22, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, - 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x50, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x1f, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x42, 0x53, 0x5a, 0x07, - 0x2e, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x92, 0x41, 0x47, 0x12, 0x1e, 0x0a, 0x0b, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2a, 0x01, 0x01, 0x32, 0x10, 0x61, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, - 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, - 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_alpha_proto_rawDescOnce sync.Once - file_alpha_proto_rawDescData = file_alpha_proto_rawDesc -) - -func file_alpha_proto_rawDescGZIP() []byte { - file_alpha_proto_rawDescOnce.Do(func() { - file_alpha_proto_rawDescData = protoimpl.X.CompressGZIP(file_alpha_proto_rawDescData) - }) - return file_alpha_proto_rawDescData -} - -var file_alpha_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_alpha_proto_goTypes = []interface{}{ - (*Empty)(nil), // 0: agones.dev.sdk.alpha.Empty - (*Count)(nil), // 1: agones.dev.sdk.alpha.Count - (*Bool)(nil), // 2: agones.dev.sdk.alpha.Bool - (*PlayerID)(nil), // 3: agones.dev.sdk.alpha.PlayerID - (*PlayerIDList)(nil), // 4: agones.dev.sdk.alpha.PlayerIDList -} + 0x70, 0x68, 0x61, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x32, 0x05, 0x0a, 0x03, 0x53, 0x44, 0x4b, 0x42, 0x53, 0x5a, 0x07, 0x2e, 0x2f, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x92, 0x41, 0x47, 0x12, 0x1e, 0x0a, 0x0b, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2a, 0x01, 0x01, 0x32, 0x10, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_alpha_proto_goTypes = []interface{}{} var file_alpha_proto_depIdxs = []int32{ - 3, // 0: agones.dev.sdk.alpha.SDK.PlayerConnect:input_type -> agones.dev.sdk.alpha.PlayerID - 3, // 1: agones.dev.sdk.alpha.SDK.PlayerDisconnect:input_type -> agones.dev.sdk.alpha.PlayerID - 1, // 2: agones.dev.sdk.alpha.SDK.SetPlayerCapacity:input_type -> agones.dev.sdk.alpha.Count - 0, // 3: agones.dev.sdk.alpha.SDK.GetPlayerCapacity:input_type -> agones.dev.sdk.alpha.Empty - 0, // 4: agones.dev.sdk.alpha.SDK.GetPlayerCount:input_type -> agones.dev.sdk.alpha.Empty - 3, // 5: agones.dev.sdk.alpha.SDK.IsPlayerConnected:input_type -> agones.dev.sdk.alpha.PlayerID - 0, // 6: agones.dev.sdk.alpha.SDK.GetConnectedPlayers:input_type -> agones.dev.sdk.alpha.Empty - 2, // 7: agones.dev.sdk.alpha.SDK.PlayerConnect:output_type -> agones.dev.sdk.alpha.Bool - 2, // 8: agones.dev.sdk.alpha.SDK.PlayerDisconnect:output_type -> agones.dev.sdk.alpha.Bool - 0, // 9: agones.dev.sdk.alpha.SDK.SetPlayerCapacity:output_type -> agones.dev.sdk.alpha.Empty - 1, // 10: agones.dev.sdk.alpha.SDK.GetPlayerCapacity:output_type -> agones.dev.sdk.alpha.Count - 1, // 11: agones.dev.sdk.alpha.SDK.GetPlayerCount:output_type -> agones.dev.sdk.alpha.Count - 2, // 12: agones.dev.sdk.alpha.SDK.IsPlayerConnected:output_type -> agones.dev.sdk.alpha.Bool - 4, // 13: agones.dev.sdk.alpha.SDK.GetConnectedPlayers:output_type -> agones.dev.sdk.alpha.PlayerIDList - 7, // [7:14] is the sub-list for method output_type - 0, // [0:7] is the sub-list for method input_type + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -409,81 +81,18 @@ func file_alpha_proto_init() { if File_alpha_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_alpha_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Count); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Bool); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PlayerID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PlayerIDList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_alpha_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 0, NumExtensions: 0, NumServices: 1, }, GoTypes: file_alpha_proto_goTypes, DependencyIndexes: file_alpha_proto_depIdxs, - MessageInfos: file_alpha_proto_msgTypes, }.Build() File_alpha_proto = out.File file_alpha_proto_rawDesc = nil diff --git a/pkg/sdk/alpha/alpha.pb.gw.go b/pkg/sdk/alpha/alpha.pb.gw.go deleted file mode 100644 index 5759a3f345..0000000000 --- a/pkg/sdk/alpha/alpha.pb.gw.go +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: alpha.proto - -/* -Package alpha is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package alpha - -import ( - "context" - "errors" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = errors.New - _ = runtime.String - _ = utilities.NewDoubleArray - _ = metadata.Join -) - -func request_SDK_PlayerConnect_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq PlayerID - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.PlayerConnect(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SDK_PlayerConnect_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq PlayerID - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.PlayerConnect(ctx, &protoReq) - return msg, metadata, err -} - -func request_SDK_PlayerDisconnect_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq PlayerID - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.PlayerDisconnect(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SDK_PlayerDisconnect_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq PlayerID - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.PlayerDisconnect(ctx, &protoReq) - return msg, metadata, err -} - -func request_SDK_SetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Count - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.SetPlayerCapacity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SDK_SetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Count - metadata runtime.ServerMetadata - ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.SetPlayerCapacity(ctx, &protoReq) - return msg, metadata, err -} - -func request_SDK_GetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Empty - metadata runtime.ServerMetadata - ) - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.GetPlayerCapacity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SDK_GetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Empty - metadata runtime.ServerMetadata - ) - msg, err := server.GetPlayerCapacity(ctx, &protoReq) - return msg, metadata, err -} - -func request_SDK_GetPlayerCount_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Empty - metadata runtime.ServerMetadata - ) - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.GetPlayerCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SDK_GetPlayerCount_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Empty - metadata runtime.ServerMetadata - ) - msg, err := server.GetPlayerCount(ctx, &protoReq) - return msg, metadata, err -} - -func request_SDK_IsPlayerConnected_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq PlayerID - metadata runtime.ServerMetadata - err error - ) - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - val, ok := pathParams["playerID"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "playerID") - } - protoReq.PlayerID, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "playerID", err) - } - msg, err := client.IsPlayerConnected(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SDK_IsPlayerConnected_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq PlayerID - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["playerID"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "playerID") - } - protoReq.PlayerID, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "playerID", err) - } - msg, err := server.IsPlayerConnected(ctx, &protoReq) - return msg, metadata, err -} - -func request_SDK_GetConnectedPlayers_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Empty - metadata runtime.ServerMetadata - ) - if req.Body != nil { - _, _ = io.Copy(io.Discard, req.Body) - } - msg, err := client.GetConnectedPlayers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_SDK_GetConnectedPlayers_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq Empty - metadata runtime.ServerMetadata - ) - msg, err := server.GetConnectedPlayers(ctx, &protoReq) - return msg, metadata, err -} - -// RegisterSDKHandlerServer registers the http handlers for service SDK to "mux". -// UnaryRPC :call SDKServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSDKHandlerFromEndpoint instead. -// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. -func RegisterSDKHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SDKServer) error { - mux.Handle(http.MethodPost, pattern_SDK_PlayerConnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerConnect", runtime.WithHTTPPathPattern("/alpha/player/connect")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_PlayerConnect_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_PlayerConnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_SDK_PlayerDisconnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerDisconnect", runtime.WithHTTPPathPattern("/alpha/player/disconnect")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_PlayerDisconnect_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_PlayerDisconnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPut, pattern_SDK_SetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_SetPlayerCapacity_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_SetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_GetPlayerCapacity_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_GetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCount", runtime.WithHTTPPathPattern("/alpha/player/count")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_GetPlayerCount_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_GetPlayerCount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_IsPlayerConnected_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/IsPlayerConnected", runtime.WithHTTPPathPattern("/alpha/player/connected/{playerID}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_IsPlayerConnected_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_IsPlayerConnected_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_GetConnectedPlayers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers", runtime.WithHTTPPathPattern("/alpha/player/connected")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_GetConnectedPlayers_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_GetConnectedPlayers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - - return nil -} - -// RegisterSDKHandlerFromEndpoint is same as RegisterSDKHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterSDKHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.NewClient(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - return RegisterSDKHandler(ctx, mux, conn) -} - -// RegisterSDKHandler registers the http handlers for service SDK to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterSDKHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterSDKHandlerClient(ctx, mux, NewSDKClient(conn)) -} - -// RegisterSDKHandlerClient registers the http handlers for service SDK -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SDKClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SDKClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "SDKClient" to call the correct interceptors. This client ignores the HTTP middlewares. -func RegisterSDKHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SDKClient) error { - mux.Handle(http.MethodPost, pattern_SDK_PlayerConnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerConnect", runtime.WithHTTPPathPattern("/alpha/player/connect")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_PlayerConnect_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_PlayerConnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPost, pattern_SDK_PlayerDisconnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerDisconnect", runtime.WithHTTPPathPattern("/alpha/player/disconnect")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_PlayerDisconnect_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_PlayerDisconnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodPut, pattern_SDK_SetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_SetPlayerCapacity_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_SetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_GetPlayerCapacity_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_GetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCount", runtime.WithHTTPPathPattern("/alpha/player/count")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_GetPlayerCount_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_GetPlayerCount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_IsPlayerConnected_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/IsPlayerConnected", runtime.WithHTTPPathPattern("/alpha/player/connected/{playerID}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_IsPlayerConnected_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_IsPlayerConnected_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - mux.Handle(http.MethodGet, pattern_SDK_GetConnectedPlayers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers", runtime.WithHTTPPathPattern("/alpha/player/connected")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_GetConnectedPlayers_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - forward_SDK_GetConnectedPlayers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) - return nil -} - -var ( - pattern_SDK_PlayerConnect_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "connect"}, "")) - pattern_SDK_PlayerDisconnect_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "disconnect"}, "")) - pattern_SDK_SetPlayerCapacity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "capacity"}, "")) - pattern_SDK_GetPlayerCapacity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "capacity"}, "")) - pattern_SDK_GetPlayerCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "count"}, "")) - pattern_SDK_IsPlayerConnected_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"alpha", "player", "connected", "playerID"}, "")) - pattern_SDK_GetConnectedPlayers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "connected"}, "")) -) - -var ( - forward_SDK_PlayerConnect_0 = runtime.ForwardResponseMessage - forward_SDK_PlayerDisconnect_0 = runtime.ForwardResponseMessage - forward_SDK_SetPlayerCapacity_0 = runtime.ForwardResponseMessage - forward_SDK_GetPlayerCapacity_0 = runtime.ForwardResponseMessage - forward_SDK_GetPlayerCount_0 = runtime.ForwardResponseMessage - forward_SDK_IsPlayerConnected_0 = runtime.ForwardResponseMessage - forward_SDK_GetConnectedPlayers_0 = runtime.ForwardResponseMessage -) diff --git a/pkg/sdk/alpha/alpha_grpc.pb.go b/pkg/sdk/alpha/alpha_grpc.pb.go index 0959635c82..50c6abea87 100644 --- a/pkg/sdk/alpha/alpha_grpc.pb.go +++ b/pkg/sdk/alpha/alpha_grpc.pb.go @@ -22,11 +22,7 @@ package alpha import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file @@ -38,59 +34,6 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SDKClient interface { - // PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the - // list of connected playerIDs. - // - // If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of - // connected playerIDs will be left unchanged. - // - // An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for - // the server has been reached. The playerID will not be added to the list of playerIDs. - // - // Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count - // through the Kubernetes API, as indeterminate results will occur. - PlayerConnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) - // Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the - // playerID value exists within the list. - // - // If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list - // will be left unchanged. - // - // Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count - // through the Kubernetes API, as indeterminate results will occur. - PlayerDisconnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) - // Update the GameServer.Status.Players.Capacity value with a new capacity. - SetPlayerCapacity(ctx context.Context, in *Count, opts ...grpc.CallOption) (*Empty, error) - // Retrieves the current player capacity. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - GetPlayerCapacity(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error) - // Retrieves the current player count. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - GetPlayerCount(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error) - // Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. - IsPlayerConnected(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) - // Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - GetConnectedPlayers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PlayerIDList, error) } type sDKClient struct { @@ -101,154 +44,16 @@ func NewSDKClient(cc grpc.ClientConnInterface) SDKClient { return &sDKClient{cc} } -func (c *sDKClient) PlayerConnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) { - out := new(Bool) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/PlayerConnect", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) PlayerDisconnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) { - out := new(Bool) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/PlayerDisconnect", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) SetPlayerCapacity(ctx context.Context, in *Count, opts ...grpc.CallOption) (*Empty, error) { - out := new(Empty) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) GetPlayerCapacity(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error) { - out := new(Count) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) GetPlayerCount(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error) { - out := new(Count) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetPlayerCount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) IsPlayerConnected(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) { - out := new(Bool) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/IsPlayerConnected", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) GetConnectedPlayers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PlayerIDList, error) { - out := new(PlayerIDList) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // SDKServer is the server API for SDK service. // All implementations should embed UnimplementedSDKServer // for forward compatibility type SDKServer interface { - // PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the - // list of connected playerIDs. - // - // If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of - // connected playerIDs will be left unchanged. - // - // An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for - // the server has been reached. The playerID will not be added to the list of playerIDs. - // - // Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count - // through the Kubernetes API, as indeterminate results will occur. - PlayerConnect(context.Context, *PlayerID) (*Bool, error) - // Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the - // playerID value exists within the list. - // - // If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list - // will be left unchanged. - // - // Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count - // through the Kubernetes API, as indeterminate results will occur. - PlayerDisconnect(context.Context, *PlayerID) (*Bool, error) - // Update the GameServer.Status.Players.Capacity value with a new capacity. - SetPlayerCapacity(context.Context, *Count) (*Empty, error) - // Retrieves the current player capacity. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - GetPlayerCapacity(context.Context, *Empty) (*Count, error) - // Retrieves the current player count. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - GetPlayerCount(context.Context, *Empty) (*Count, error) - // Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. - IsPlayerConnected(context.Context, *PlayerID) (*Bool, error) - // Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - GetConnectedPlayers(context.Context, *Empty) (*PlayerIDList, error) } // UnimplementedSDKServer should be embedded to have forward compatible implementations. type UnimplementedSDKServer struct { } -func (UnimplementedSDKServer) PlayerConnect(context.Context, *PlayerID) (*Bool, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlayerConnect not implemented") -} -func (UnimplementedSDKServer) PlayerDisconnect(context.Context, *PlayerID) (*Bool, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlayerDisconnect not implemented") -} -func (UnimplementedSDKServer) SetPlayerCapacity(context.Context, *Count) (*Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetPlayerCapacity not implemented") -} -func (UnimplementedSDKServer) GetPlayerCapacity(context.Context, *Empty) (*Count, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPlayerCapacity not implemented") -} -func (UnimplementedSDKServer) GetPlayerCount(context.Context, *Empty) (*Count, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPlayerCount not implemented") -} -func (UnimplementedSDKServer) IsPlayerConnected(context.Context, *PlayerID) (*Bool, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsPlayerConnected not implemented") -} -func (UnimplementedSDKServer) GetConnectedPlayers(context.Context, *Empty) (*PlayerIDList, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetConnectedPlayers not implemented") -} - // UnsafeSDKServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SDKServer will // result in compilation errors. @@ -260,168 +65,13 @@ func RegisterSDKServer(s grpc.ServiceRegistrar, srv SDKServer) { s.RegisterService(&SDK_ServiceDesc, srv) } -func _SDK_PlayerConnect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlayerID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).PlayerConnect(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/PlayerConnect", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).PlayerConnect(ctx, req.(*PlayerID)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_PlayerDisconnect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlayerID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).PlayerDisconnect(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/PlayerDisconnect", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).PlayerDisconnect(ctx, req.(*PlayerID)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_SetPlayerCapacity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Count) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).SetPlayerCapacity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).SetPlayerCapacity(ctx, req.(*Count)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_GetPlayerCapacity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).GetPlayerCapacity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).GetPlayerCapacity(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_GetPlayerCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).GetPlayerCount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/GetPlayerCount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).GetPlayerCount(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_IsPlayerConnected_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlayerID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).IsPlayerConnected(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/IsPlayerConnected", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).IsPlayerConnected(ctx, req.(*PlayerID)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_GetConnectedPlayers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).GetConnectedPlayers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).GetConnectedPlayers(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - // SDK_ServiceDesc is the grpc.ServiceDesc for SDK service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var SDK_ServiceDesc = grpc.ServiceDesc{ ServiceName: "agones.dev.sdk.alpha.SDK", HandlerType: (*SDKServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "PlayerConnect", - Handler: _SDK_PlayerConnect_Handler, - }, - { - MethodName: "PlayerDisconnect", - Handler: _SDK_PlayerDisconnect_Handler, - }, - { - MethodName: "SetPlayerCapacity", - Handler: _SDK_SetPlayerCapacity_Handler, - }, - { - MethodName: "GetPlayerCapacity", - Handler: _SDK_GetPlayerCapacity_Handler, - }, - { - MethodName: "GetPlayerCount", - Handler: _SDK_GetPlayerCount_Handler, - }, - { - MethodName: "IsPlayerConnected", - Handler: _SDK_IsPlayerConnected_Handler, - }, - { - MethodName: "GetConnectedPlayers", - Handler: _SDK_GetConnectedPlayers_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "alpha.proto", + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "alpha.proto", } diff --git a/pkg/sdk/sdk.pb.go b/pkg/sdk/sdk.pb.go index 7f5377228f..42b870b715 100644 --- a/pkg/sdk/sdk.pb.go +++ b/pkg/sdk/sdk.pb.go @@ -431,9 +431,6 @@ type GameServer_Status struct { Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` Addresses []*GameServer_Status_Address `protobuf:"bytes,7,rep,name=addresses,proto3" json:"addresses,omitempty"` Ports []*GameServer_Status_Port `protobuf:"bytes,3,rep,name=ports,proto3" json:"ports,omitempty"` - // [Stage:Alpha] - // [FeatureFlag:PlayerTracking] - Players *GameServer_Status_PlayerStatus `protobuf:"bytes,4,opt,name=players,proto3" json:"players,omitempty"` // [Stage:Beta] // [FeatureFlag:CountsAndLists] Counters map[string]*GameServer_Status_CounterStatus `protobuf:"bytes,5,rep,name=counters,proto3" json:"counters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -502,13 +499,6 @@ func (x *GameServer_Status) GetPorts() []*GameServer_Status_Port { return nil } -func (x *GameServer_Status) GetPlayers() *GameServer_Status_PlayerStatus { - if x != nil { - return x.Players - } - return nil -} - func (x *GameServer_Status) GetCounters() map[string]*GameServer_Status_CounterStatus { if x != nil { return x.Counters @@ -704,71 +694,6 @@ func (x *GameServer_Status_Port) GetPort() int32 { return 0 } -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -type GameServer_Status_PlayerStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` - Capacity int64 `protobuf:"varint,2,opt,name=capacity,proto3" json:"capacity,omitempty"` - Ids []string `protobuf:"bytes,3,rep,name=ids,proto3" json:"ids,omitempty"` -} - -func (x *GameServer_Status_PlayerStatus) Reset() { - *x = GameServer_Status_PlayerStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_sdk_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GameServer_Status_PlayerStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GameServer_Status_PlayerStatus) ProtoMessage() {} - -func (x *GameServer_Status_PlayerStatus) ProtoReflect() protoreflect.Message { - mi := &file_sdk_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GameServer_Status_PlayerStatus.ProtoReflect.Descriptor instead. -func (*GameServer_Status_PlayerStatus) Descriptor() ([]byte, []int) { - return file_sdk_proto_rawDescGZIP(), []int{3, 2, 2} -} - -func (x *GameServer_Status_PlayerStatus) GetCount() int64 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *GameServer_Status_PlayerStatus) GetCapacity() int64 { - if x != nil { - return x.Capacity - } - return 0 -} - -func (x *GameServer_Status_PlayerStatus) GetIds() []string { - if x != nil { - return x.Ids - } - return nil -} - // [Stage:Beta] // [FeatureFlag:CountsAndLists] type GameServer_Status_CounterStatus struct { @@ -783,7 +708,7 @@ type GameServer_Status_CounterStatus struct { func (x *GameServer_Status_CounterStatus) Reset() { *x = GameServer_Status_CounterStatus{} if protoimpl.UnsafeEnabled { - mi := &file_sdk_proto_msgTypes[13] + mi := &file_sdk_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -796,7 +721,7 @@ func (x *GameServer_Status_CounterStatus) String() string { func (*GameServer_Status_CounterStatus) ProtoMessage() {} func (x *GameServer_Status_CounterStatus) ProtoReflect() protoreflect.Message { - mi := &file_sdk_proto_msgTypes[13] + mi := &file_sdk_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -809,7 +734,7 @@ func (x *GameServer_Status_CounterStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use GameServer_Status_CounterStatus.ProtoReflect.Descriptor instead. func (*GameServer_Status_CounterStatus) Descriptor() ([]byte, []int) { - return file_sdk_proto_rawDescGZIP(), []int{3, 2, 3} + return file_sdk_proto_rawDescGZIP(), []int{3, 2, 2} } func (x *GameServer_Status_CounterStatus) GetCount() int64 { @@ -840,7 +765,7 @@ type GameServer_Status_ListStatus struct { func (x *GameServer_Status_ListStatus) Reset() { *x = GameServer_Status_ListStatus{} if protoimpl.UnsafeEnabled { - mi := &file_sdk_proto_msgTypes[14] + mi := &file_sdk_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -853,7 +778,7 @@ func (x *GameServer_Status_ListStatus) String() string { func (*GameServer_Status_ListStatus) ProtoMessage() {} func (x *GameServer_Status_ListStatus) ProtoReflect() protoreflect.Message { - mi := &file_sdk_proto_msgTypes[14] + mi := &file_sdk_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -866,7 +791,7 @@ func (x *GameServer_Status_ListStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use GameServer_Status_ListStatus.ProtoReflect.Descriptor instead. func (*GameServer_Status_ListStatus) Descriptor() ([]byte, []int) { - return file_sdk_proto_rawDescGZIP(), []int{3, 2, 4} + return file_sdk_proto_rawDescGZIP(), []int{3, 2, 3} } func (x *GameServer_Status_ListStatus) GetCapacity() int64 { @@ -898,7 +823,7 @@ var file_sdk_proto_rawDesc = []byte{ 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x24, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x9c, 0x0f, 0x0a, + 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x8d, 0x0e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, @@ -961,7 +886,7 @@ var file_sdk_proto_rawDesc = []byte{ 0x6c, 0x64, 0x12, 0x32, 0x0a, 0x15, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x53, - 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x1a, 0xb2, 0x07, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x1a, 0xa3, 0x06, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, @@ -973,108 +898,99 @@ var file_sdk_proto_rawDesc = []byte{ 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x50, 0x6f, 0x72, - 0x74, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x48, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x61, 0x67, 0x6f, 0x6e, + 0x74, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x4b, 0x0a, 0x08, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x61, 0x67, 0x6f, + 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x42, 0x0a, 0x05, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x05, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x1a, 0x37, 0x0a, 0x07, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x1a, 0x2e, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, + 0x72, 0x74, 0x1a, 0x41, 0x0a, 0x0d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, + 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, + 0x61, 0x63, 0x69, 0x74, 0x79, 0x1a, 0x40, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x6c, 0x0a, 0x0d, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x45, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x73, 0x12, 0x4b, 0x0a, 0x08, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x66, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x42, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x42, 0x0a, 0x05, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x4a, 0x04, 0x08, + 0x04, 0x10, 0x05, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x32, 0x86, 0x06, 0x0a, + 0x03, 0x53, 0x44, 0x4b, 0x12, 0x48, 0x0a, 0x05, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12, 0x15, 0x2e, + 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x11, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x65, 0x61, 0x64, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x4e, + 0x0a, 0x08, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, + 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, + 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, + 0x22, 0x09, 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x4e, + 0x0a, 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, + 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, + 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, + 0x22, 0x09, 0x2f, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x4c, + 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, + 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x07, + 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x3a, 0x01, 0x2a, 0x28, 0x01, 0x12, 0x57, 0x0a, 0x0d, + 0x47, 0x65, 0x74, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x15, 0x2e, + 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x61, 0x0a, 0x0f, 0x57, 0x61, 0x74, 0x63, 0x68, 0x47, 0x61, + 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, + 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, + 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x19, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x67, 0x61, 0x6d, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x30, 0x01, 0x12, 0x57, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, - 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6c, 0x69, - 0x73, 0x74, 0x73, 0x1a, 0x37, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x2e, 0x0a, 0x04, - 0x50, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x52, 0x0a, 0x0c, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, - 0x1a, 0x41, 0x0a, 0x0d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, - 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, - 0x69, 0x74, 0x79, 0x1a, 0x40, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x6c, 0x0a, 0x0d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x45, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, - 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x1a, 0x66, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x42, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, - 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x86, 0x06, 0x0a, 0x03, - 0x53, 0x44, 0x4b, 0x12, 0x48, 0x0a, 0x05, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12, 0x15, 0x2e, 0x61, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x1a, 0x0f, 0x2f, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x3a, 0x01, + 0x2a, 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x73, 0x64, 0x6b, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x65, 0x61, 0x64, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x4e, 0x0a, - 0x08, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, + 0x70, 0x74, 0x79, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x1a, 0x14, 0x2f, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x12, + 0x18, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, + 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, - 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, - 0x09, 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x4e, 0x0a, - 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, - 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, - 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, - 0x09, 0x2f, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x3a, 0x01, 0x2a, 0x12, 0x4c, 0x0a, - 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, - 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, - 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x07, 0x2f, - 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x3a, 0x01, 0x2a, 0x28, 0x01, 0x12, 0x57, 0x0a, 0x0d, 0x47, - 0x65, 0x74, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x61, - 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, - 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x12, 0x61, 0x0a, 0x0f, 0x57, 0x61, 0x74, 0x63, 0x68, 0x47, 0x61, 0x6d, - 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, - 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, - 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, - 0x47, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x13, 0x12, 0x11, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x30, 0x01, 0x12, 0x57, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x15, 0x2e, - 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x1a, 0x0f, 0x2f, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x3a, 0x01, 0x2a, - 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, - 0x64, 0x6b, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x15, 0x2e, 0x61, 0x67, - 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x1a, 0x14, 0x2f, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x12, 0x18, - 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, - 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, - 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x22, 0x08, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x3a, 0x01, 0x2a, 0x42, 0x4f, 0x5a, 0x05, 0x2e, 0x2f, 0x73, 0x64, 0x6b, 0x92, 0x41, 0x45, - 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x64, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2a, 0x01, - 0x01, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, - 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x22, 0x08, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x3a, 0x01, 0x2a, 0x42, 0x4f, 0x5a, 0x05, 0x2e, 0x2f, 0x73, 0x64, 0x6b, 0x92, 0x41, + 0x45, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x64, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2a, + 0x01, 0x01, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1089,7 +1005,7 @@ func file_sdk_proto_rawDescGZIP() []byte { return file_sdk_proto_rawDescData } -var file_sdk_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_sdk_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_sdk_proto_goTypes = []interface{}{ (*Empty)(nil), // 0: agones.dev.sdk.Empty (*KeyValue)(nil), // 1: agones.dev.sdk.KeyValue @@ -1103,11 +1019,10 @@ var file_sdk_proto_goTypes = []interface{}{ (*GameServer_Spec_Health)(nil), // 9: agones.dev.sdk.GameServer.Spec.Health (*GameServer_Status_Address)(nil), // 10: agones.dev.sdk.GameServer.Status.Address (*GameServer_Status_Port)(nil), // 11: agones.dev.sdk.GameServer.Status.Port - (*GameServer_Status_PlayerStatus)(nil), // 12: agones.dev.sdk.GameServer.Status.PlayerStatus - (*GameServer_Status_CounterStatus)(nil), // 13: agones.dev.sdk.GameServer.Status.CounterStatus - (*GameServer_Status_ListStatus)(nil), // 14: agones.dev.sdk.GameServer.Status.ListStatus - nil, // 15: agones.dev.sdk.GameServer.Status.CountersEntry - nil, // 16: agones.dev.sdk.GameServer.Status.ListsEntry + (*GameServer_Status_CounterStatus)(nil), // 12: agones.dev.sdk.GameServer.Status.CounterStatus + (*GameServer_Status_ListStatus)(nil), // 13: agones.dev.sdk.GameServer.Status.ListStatus + nil, // 14: agones.dev.sdk.GameServer.Status.CountersEntry + nil, // 15: agones.dev.sdk.GameServer.Status.ListsEntry } var file_sdk_proto_depIdxs = []int32{ 4, // 0: agones.dev.sdk.GameServer.object_meta:type_name -> agones.dev.sdk.GameServer.ObjectMeta @@ -1118,34 +1033,33 @@ var file_sdk_proto_depIdxs = []int32{ 9, // 5: agones.dev.sdk.GameServer.Spec.health:type_name -> agones.dev.sdk.GameServer.Spec.Health 10, // 6: agones.dev.sdk.GameServer.Status.addresses:type_name -> agones.dev.sdk.GameServer.Status.Address 11, // 7: agones.dev.sdk.GameServer.Status.ports:type_name -> agones.dev.sdk.GameServer.Status.Port - 12, // 8: agones.dev.sdk.GameServer.Status.players:type_name -> agones.dev.sdk.GameServer.Status.PlayerStatus - 15, // 9: agones.dev.sdk.GameServer.Status.counters:type_name -> agones.dev.sdk.GameServer.Status.CountersEntry - 16, // 10: agones.dev.sdk.GameServer.Status.lists:type_name -> agones.dev.sdk.GameServer.Status.ListsEntry - 13, // 11: agones.dev.sdk.GameServer.Status.CountersEntry.value:type_name -> agones.dev.sdk.GameServer.Status.CounterStatus - 14, // 12: agones.dev.sdk.GameServer.Status.ListsEntry.value:type_name -> agones.dev.sdk.GameServer.Status.ListStatus - 0, // 13: agones.dev.sdk.SDK.Ready:input_type -> agones.dev.sdk.Empty - 0, // 14: agones.dev.sdk.SDK.Allocate:input_type -> agones.dev.sdk.Empty - 0, // 15: agones.dev.sdk.SDK.Shutdown:input_type -> agones.dev.sdk.Empty - 0, // 16: agones.dev.sdk.SDK.Health:input_type -> agones.dev.sdk.Empty - 0, // 17: agones.dev.sdk.SDK.GetGameServer:input_type -> agones.dev.sdk.Empty - 0, // 18: agones.dev.sdk.SDK.WatchGameServer:input_type -> agones.dev.sdk.Empty - 1, // 19: agones.dev.sdk.SDK.SetLabel:input_type -> agones.dev.sdk.KeyValue - 1, // 20: agones.dev.sdk.SDK.SetAnnotation:input_type -> agones.dev.sdk.KeyValue - 2, // 21: agones.dev.sdk.SDK.Reserve:input_type -> agones.dev.sdk.Duration - 0, // 22: agones.dev.sdk.SDK.Ready:output_type -> agones.dev.sdk.Empty - 0, // 23: agones.dev.sdk.SDK.Allocate:output_type -> agones.dev.sdk.Empty - 0, // 24: agones.dev.sdk.SDK.Shutdown:output_type -> agones.dev.sdk.Empty - 0, // 25: agones.dev.sdk.SDK.Health:output_type -> agones.dev.sdk.Empty - 3, // 26: agones.dev.sdk.SDK.GetGameServer:output_type -> agones.dev.sdk.GameServer - 3, // 27: agones.dev.sdk.SDK.WatchGameServer:output_type -> agones.dev.sdk.GameServer - 0, // 28: agones.dev.sdk.SDK.SetLabel:output_type -> agones.dev.sdk.Empty - 0, // 29: agones.dev.sdk.SDK.SetAnnotation:output_type -> agones.dev.sdk.Empty - 0, // 30: agones.dev.sdk.SDK.Reserve:output_type -> agones.dev.sdk.Empty - 22, // [22:31] is the sub-list for method output_type - 13, // [13:22] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 14, // 8: agones.dev.sdk.GameServer.Status.counters:type_name -> agones.dev.sdk.GameServer.Status.CountersEntry + 15, // 9: agones.dev.sdk.GameServer.Status.lists:type_name -> agones.dev.sdk.GameServer.Status.ListsEntry + 12, // 10: agones.dev.sdk.GameServer.Status.CountersEntry.value:type_name -> agones.dev.sdk.GameServer.Status.CounterStatus + 13, // 11: agones.dev.sdk.GameServer.Status.ListsEntry.value:type_name -> agones.dev.sdk.GameServer.Status.ListStatus + 0, // 12: agones.dev.sdk.SDK.Ready:input_type -> agones.dev.sdk.Empty + 0, // 13: agones.dev.sdk.SDK.Allocate:input_type -> agones.dev.sdk.Empty + 0, // 14: agones.dev.sdk.SDK.Shutdown:input_type -> agones.dev.sdk.Empty + 0, // 15: agones.dev.sdk.SDK.Health:input_type -> agones.dev.sdk.Empty + 0, // 16: agones.dev.sdk.SDK.GetGameServer:input_type -> agones.dev.sdk.Empty + 0, // 17: agones.dev.sdk.SDK.WatchGameServer:input_type -> agones.dev.sdk.Empty + 1, // 18: agones.dev.sdk.SDK.SetLabel:input_type -> agones.dev.sdk.KeyValue + 1, // 19: agones.dev.sdk.SDK.SetAnnotation:input_type -> agones.dev.sdk.KeyValue + 2, // 20: agones.dev.sdk.SDK.Reserve:input_type -> agones.dev.sdk.Duration + 0, // 21: agones.dev.sdk.SDK.Ready:output_type -> agones.dev.sdk.Empty + 0, // 22: agones.dev.sdk.SDK.Allocate:output_type -> agones.dev.sdk.Empty + 0, // 23: agones.dev.sdk.SDK.Shutdown:output_type -> agones.dev.sdk.Empty + 0, // 24: agones.dev.sdk.SDK.Health:output_type -> agones.dev.sdk.Empty + 3, // 25: agones.dev.sdk.SDK.GetGameServer:output_type -> agones.dev.sdk.GameServer + 3, // 26: agones.dev.sdk.SDK.WatchGameServer:output_type -> agones.dev.sdk.GameServer + 0, // 27: agones.dev.sdk.SDK.SetLabel:output_type -> agones.dev.sdk.Empty + 0, // 28: agones.dev.sdk.SDK.SetAnnotation:output_type -> agones.dev.sdk.Empty + 0, // 29: agones.dev.sdk.SDK.Reserve:output_type -> agones.dev.sdk.Empty + 21, // [21:30] is the sub-list for method output_type + 12, // [12:21] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_sdk_proto_init() } @@ -1275,18 +1189,6 @@ func file_sdk_proto_init() { } } file_sdk_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GameServer_Status_PlayerStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_sdk_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GameServer_Status_CounterStatus); i { case 0: return &v.state @@ -1298,7 +1200,7 @@ func file_sdk_proto_init() { return nil } } - file_sdk_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_sdk_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GameServer_Status_ListStatus); i { case 0: return &v.state @@ -1317,7 +1219,7 @@ func file_sdk_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_sdk_proto_rawDesc, NumEnums: 0, - NumMessages: 17, + NumMessages: 16, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/sdkserver/localsdk.go b/pkg/sdkserver/localsdk.go index 45a4b968fb..c174cc0766 100644 --- a/pkg/sdkserver/localsdk.go +++ b/pkg/sdkserver/localsdk.go @@ -34,15 +34,13 @@ import ( agonesv1 "agones.dev/agones/pkg/apis/agones/v1" "agones.dev/agones/pkg/sdk" - "agones.dev/agones/pkg/sdk/alpha" "agones.dev/agones/pkg/sdk/beta" "agones.dev/agones/pkg/util/runtime" ) var ( - _ sdk.SDKServer = &LocalSDKServer{} - _ alpha.SDKServer = &LocalSDKServer{} - _ beta.SDKServer = &LocalSDKServer{} + _ sdk.SDKServer = &LocalSDKServer{} + _ beta.SDKServer = &LocalSDKServer{} ) func defaultGs() *sdk.GameServer { @@ -152,9 +150,6 @@ func NewLocalSDKServer(filePath string, testSdkName string) (*LocalSDKServer, er l.logger.WithError(err).WithField("filePath", filePath).Error("error adding watcher") } } - if runtime.FeatureEnabled(runtime.FeaturePlayerTracking) && l.gs.Status.Players == nil { - l.gs.Status.Players = &sdk.GameServer_Status_PlayerStatus{} - } if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { if l.gs.Status.Counters == nil { @@ -226,16 +221,6 @@ func (l *LocalSDKServer) recordRequestWithValue(request string, value string, ob fieldVal = strconv.FormatInt(l.gs.ObjectMeta.CreationTimestamp, 10) case "UID": fieldVal = l.gs.ObjectMeta.Uid - case "PlayerCapacity": - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return - } - fieldVal = strconv.FormatInt(l.gs.Status.Players.Capacity, 10) - case "PlayerIDs": - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return - } - fieldVal = strings.Join(l.gs.Status.Players.Ids, ",") default: l.logger.Error("unexpected Field to compare") } @@ -423,191 +408,6 @@ func (l *LocalSDKServer) stopReserveTimer() { l.gsReserveDuration = nil } -// PlayerConnect should be called when a player connects. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (l *LocalSDKServer) PlayerConnect(_ context.Context, id *alpha.PlayerID) (*alpha.Bool, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return &alpha.Bool{Bool: false}, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - l.logger.WithField("playerID", id.PlayerID).Info("Player Connected") - l.gsMutex.Lock() - defer l.gsMutex.Unlock() - - if l.gs.Status.Players == nil { - l.gs.Status.Players = &sdk.GameServer_Status_PlayerStatus{} - } - - // the player is already connected, return false. - for _, playerID := range l.gs.Status.Players.Ids { - if playerID == id.PlayerID { - return &alpha.Bool{Bool: false}, nil - } - } - - if l.gs.Status.Players.Count >= l.gs.Status.Players.Capacity { - return &alpha.Bool{Bool: false}, errors.New("Players are already at capacity") - } - - l.gs.Status.Players.Ids = append(l.gs.Status.Players.Ids, id.PlayerID) - l.gs.Status.Players.Count = int64(len(l.gs.Status.Players.Ids)) - - l.update <- struct{}{} - l.recordRequestWithValue("playerconnect", "1234", "PlayerIDs") - return &alpha.Bool{Bool: true}, nil -} - -// PlayerDisconnect should be called when a player disconnects. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (l *LocalSDKServer) PlayerDisconnect(_ context.Context, id *alpha.PlayerID) (*alpha.Bool, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return &alpha.Bool{Bool: false}, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - l.logger.WithField("playerID", id.PlayerID).Info("Player Disconnected") - l.gsMutex.Lock() - defer l.gsMutex.Unlock() - - if l.gs.Status.Players == nil { - l.gs.Status.Players = &sdk.GameServer_Status_PlayerStatus{} - } - - found := -1 - for i, playerID := range l.gs.Status.Players.Ids { - if playerID == id.PlayerID { - found = i - break - } - } - if found == -1 { - return &alpha.Bool{Bool: false}, nil - } - - l.gs.Status.Players.Ids = append(l.gs.Status.Players.Ids[:found], l.gs.Status.Players.Ids[found+1:]...) - l.gs.Status.Players.Count = int64(len(l.gs.Status.Players.Ids)) - - l.update <- struct{}{} - l.recordRequestWithValue("playerdisconnect", "", "PlayerIDs") - return &alpha.Bool{Bool: true}, nil -} - -// IsPlayerConnected returns if the playerID is currently connected to the GameServer. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (l *LocalSDKServer) IsPlayerConnected(_ context.Context, id *alpha.PlayerID) (*alpha.Bool, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return &alpha.Bool{Bool: false}, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - - result := &alpha.Bool{Bool: false} - l.logger.WithField("playerID", id.PlayerID).Info("Is a Player Connected?") - l.gsMutex.Lock() - defer l.gsMutex.Unlock() - - l.recordRequestWithValue("isplayerconnected", id.PlayerID, "PlayerIDs") - - if l.gs.Status.Players == nil { - return result, nil - } - - for _, playerID := range l.gs.Status.Players.Ids { - if id.PlayerID == playerID { - result.Bool = true - break - } - } - - return result, nil -} - -// GetConnectedPlayers returns the list of the currently connected player ids. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (l *LocalSDKServer) GetConnectedPlayers(_ context.Context, _ *alpha.Empty) (*alpha.PlayerIDList, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - l.logger.Info("Getting Connected Players") - - result := &alpha.PlayerIDList{List: []string{}} - - l.gsMutex.Lock() - defer l.gsMutex.Unlock() - l.recordRequest("getconnectedplayers") - - if l.gs.Status.Players == nil { - return result, nil - } - result.List = l.gs.Status.Players.Ids - return result, nil -} - -// GetPlayerCount returns the current player count. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (l *LocalSDKServer) GetPlayerCount(_ context.Context, _ *alpha.Empty) (*alpha.Count, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - l.logger.Info("Getting Player Count") - l.recordRequest("getplayercount") - l.gsMutex.RLock() - defer l.gsMutex.RUnlock() - - result := &alpha.Count{} - if l.gs.Status.Players != nil { - result.Count = l.gs.Status.Players.Count - } - - return result, nil -} - -// SetPlayerCapacity to change the game server's player capacity. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (l *LocalSDKServer) SetPlayerCapacity(_ context.Context, count *alpha.Count) (*alpha.Empty, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - - l.logger.WithField("capacity", count.Count).Info("Setting Player Capacity") - l.gsMutex.Lock() - defer l.gsMutex.Unlock() - - if l.gs.Status.Players == nil { - l.gs.Status.Players = &sdk.GameServer_Status_PlayerStatus{} - } - - l.gs.Status.Players.Capacity = count.Count - - l.update <- struct{}{} - l.recordRequestWithValue("setplayercapacity", strconv.FormatInt(count.Count, 10), "PlayerCapacity") - return &alpha.Empty{}, nil -} - -// GetPlayerCapacity returns the current player capacity. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (l *LocalSDKServer) GetPlayerCapacity(_ context.Context, _ *alpha.Empty) (*alpha.Count, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - l.logger.Info("Getting Player Capacity") - l.recordRequest("getplayercapacity") - l.gsMutex.RLock() - defer l.gsMutex.RUnlock() - - // SDK.GetPlayerCapacity() has a contract of always return a number, - // so if we're nil, then let's always return a value, and - // remove lots of special cases upstream. - result := &alpha.Count{} - if l.gs.Status.Players != nil { - result.Count = l.gs.Status.Players.Capacity - } - - return result, nil -} - // GetCounter returns a Counter. Returns not found if the counter does not exist. // [Stage:Beta] // [FeatureFlag:CountsAndLists] diff --git a/pkg/sdkserver/localsdk_test.go b/pkg/sdkserver/localsdk_test.go index 5ac035b8c7..94b2285109 100644 --- a/pkg/sdkserver/localsdk_test.go +++ b/pkg/sdkserver/localsdk_test.go @@ -19,7 +19,6 @@ import ( "encoding/json" "fmt" "os" - "strconv" "sync" "testing" "time" @@ -36,7 +35,6 @@ import ( agonesv1 "agones.dev/agones/pkg/apis/agones/v1" "agones.dev/agones/pkg/sdk" - "agones.dev/agones/pkg/sdk/alpha" "agones.dev/agones/pkg/sdk/beta" "agones.dev/agones/pkg/util/runtime" ) @@ -321,294 +319,6 @@ func TestLocalSDKServerWatchGameServer(t *testing.T) { }) } -func TestLocalSDKServerPlayerCapacity(t *testing.T) { - t.Parallel() - - runtime.FeatureTestMutex.Lock() - defer runtime.FeatureTestMutex.Unlock() - require.NoError(t, runtime.ParseFeatures(string(runtime.FeaturePlayerTracking)+"=true")) - - fixture := &agonesv1.GameServer{ObjectMeta: metav1.ObjectMeta{Name: "stuff"}} - - e := &alpha.Empty{} - path, err := gsToTmpFile(fixture) - assert.NoError(t, err) - l, err := NewLocalSDKServer(path, "") - assert.Nil(t, err) - - stream := newGameServerMockStream() - go func() { - err := l.WatchGameServer(&sdk.Empty{}, stream) - assert.Nil(t, err) - }() - assertInitialWatchUpdate(t, stream) - - // wait for watching to begin - err = wait.PollUntilContextTimeout(context.Background(), time.Second, 10*time.Second, true, func(_ context.Context) (bool, error) { - found := false - l.updateObservers.Range(func(_, _ interface{}) bool { - found = true - return false - }) - return found, nil - }) - assert.NoError(t, err) - - c, err := l.GetPlayerCapacity(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, int64(0), c.Count) - - _, err = l.SetPlayerCapacity(context.Background(), &alpha.Count{Count: 10}) - assert.NoError(t, err) - - select { - case msg := <-stream.msgs: - assert.Equal(t, int64(10), msg.Status.Players.Capacity) - case <-time.After(10 * time.Second): - assert.Fail(t, "timeout getting watch") - } - - c, err = l.GetPlayerCapacity(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, int64(10), c.Count) - - gs, err := l.GetGameServer(context.Background(), &sdk.Empty{}) - assert.NoError(t, err) - assert.Equal(t, int64(10), gs.Status.Players.Capacity) -} - -func TestLocalSDKServerPlayerConnectAndDisconnectWithoutPlayerTracking(t *testing.T) { - t.Parallel() - runtime.FeatureTestMutex.Lock() - defer runtime.FeatureTestMutex.Unlock() - - require.NoError(t, runtime.ParseFeatures(string(runtime.FeaturePlayerTracking)+"=false")) - - l, err := NewLocalSDKServer("", "") - assert.Nil(t, err) - - e := &alpha.Empty{} - capacity, err := l.GetPlayerCapacity(context.Background(), e) - assert.Nil(t, capacity) - assert.Error(t, err) - - count, err := l.GetPlayerCount(context.Background(), e) - assert.Error(t, err) - assert.Nil(t, count) - - list, err := l.GetConnectedPlayers(context.Background(), e) - assert.Error(t, err) - assert.Nil(t, list) - - id := &alpha.PlayerID{PlayerID: "test-player"} - - ok, err := l.PlayerConnect(context.Background(), id) - assert.Error(t, err) - assert.False(t, ok.Bool) - - ok, err = l.IsPlayerConnected(context.Background(), id) - assert.Error(t, err) - assert.False(t, ok.Bool) - - ok, err = l.PlayerDisconnect(context.Background(), id) - assert.Error(t, err) - assert.False(t, ok.Bool) -} - -func TestLocalSDKServerPlayerConnectAndDisconnect(t *testing.T) { - t.Parallel() - - runtime.FeatureTestMutex.Lock() - defer runtime.FeatureTestMutex.Unlock() - require.NoError(t, runtime.ParseFeatures(string(runtime.FeaturePlayerTracking)+"=true")) - - gs := func() *agonesv1.GameServer { - return &agonesv1.GameServer{ - ObjectMeta: metav1.ObjectMeta{Name: "stuff"}, - Status: agonesv1.GameServerStatus{ - Players: &agonesv1.PlayerStatus{ - Capacity: 1, - }, - }} - } - - e := &alpha.Empty{} - - fixtures := map[string]struct { - testMode bool - gs *agonesv1.GameServer - useFile bool - }{ - "test mode on, gs with Status.Players": { - testMode: true, - gs: gs(), - useFile: true, - }, - "test mode off, gs with Status.Players": { - testMode: false, - gs: gs(), - useFile: true, - }, - "test mode on, gs without Status.Players": { - testMode: true, - useFile: true, - }, - "test mode off, gs without Status.Players": { - testMode: false, - useFile: true, - }, - "test mode on, no filePath": { - testMode: true, - useFile: false, - }, - "test mode off, no filePath": { - testMode: false, - useFile: false, - }, - } - - for k, v := range fixtures { - t.Run(k, func(t *testing.T) { - var l *LocalSDKServer - var err error - if v.useFile { - path, pathErr := gsToTmpFile(v.gs) - assert.NoError(t, pathErr) - l, err = NewLocalSDKServer(path, "") - } else { - l, err = NewLocalSDKServer("", "") - } - assert.Nil(t, err) - l.SetTestMode(v.testMode) - - stream := newGameServerMockStream() - go func() { - err := l.WatchGameServer(&sdk.Empty{}, stream) - assert.Nil(t, err) - }() - assertInitialWatchUpdate(t, stream) - - // wait for watching to begin - err = wait.PollUntilContextTimeout(context.Background(), time.Second, 10*time.Second, true, func(_ context.Context) (bool, error) { - found := false - l.updateObservers.Range(func(_, _ interface{}) bool { - found = true - return false - }) - return found, nil - }) - assert.NoError(t, err) - - if !v.useFile || v.gs == nil { - _, err := l.SetPlayerCapacity(context.Background(), &alpha.Count{ - Count: 1, - }) - assert.NoError(t, err) - expected := &sdk.GameServer_Status_PlayerStatus{ - Capacity: 1, - } - assertWatchUpdate(t, stream, expected, func(gs *sdk.GameServer) interface{} { - return gs.Status.Players - }) - } - - id := &alpha.PlayerID{PlayerID: "one"} - ok, err := l.IsPlayerConnected(context.Background(), id) - assert.NoError(t, err) - if assert.NotNil(t, ok) { - assert.False(t, ok.Bool, "player should not be connected") - } - - count, err := l.GetPlayerCount(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, int64(0), count.Count) - - list, err := l.GetConnectedPlayers(context.Background(), e) - assert.NoError(t, err) - assert.Empty(t, list.List) - - // connect a player - ok, err = l.PlayerConnect(context.Background(), id) - assert.NoError(t, err) - assert.True(t, ok.Bool, "Player should not exist yet") - - count, err = l.GetPlayerCount(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, int64(1), count.Count) - - expected := &sdk.GameServer_Status_PlayerStatus{ - Count: 1, - Capacity: 1, - Ids: []string{id.PlayerID}, - } - assertWatchUpdate(t, stream, expected, func(gs *sdk.GameServer) interface{} { - return gs.Status.Players - }) - - ok, err = l.IsPlayerConnected(context.Background(), id) - assert.NoError(t, err) - assert.True(t, ok.Bool, "player should be connected") - - list, err = l.GetConnectedPlayers(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, []string{id.PlayerID}, list.List) - - // add same player - ok, err = l.PlayerConnect(context.Background(), id) - assert.NoError(t, err) - assert.False(t, ok.Bool, "Player already exists") - - count, err = l.GetPlayerCount(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, int64(1), count.Count) - assertNoWatchUpdate(t, stream) - - list, err = l.GetConnectedPlayers(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, []string{id.PlayerID}, list.List) - - // should return an error if we try to add another, since we're at capacity - nopePlayer := &alpha.PlayerID{PlayerID: "nope"} - _, err = l.PlayerConnect(context.Background(), nopePlayer) - assert.EqualError(t, err, "Players are already at capacity") - - ok, err = l.IsPlayerConnected(context.Background(), nopePlayer) - assert.NoError(t, err) - assert.False(t, ok.Bool) - - // disconnect a player - ok, err = l.PlayerDisconnect(context.Background(), id) - assert.NoError(t, err) - assert.True(t, ok.Bool, "Player should be removed") - count, err = l.GetPlayerCount(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, int64(0), count.Count) - - expected = &sdk.GameServer_Status_PlayerStatus{ - Count: 0, - Capacity: 1, - Ids: []string{}, - } - assertWatchUpdate(t, stream, expected, func(gs *sdk.GameServer) interface{} { - return gs.Status.Players - }) - - list, err = l.GetConnectedPlayers(context.Background(), e) - assert.NoError(t, err) - assert.Empty(t, list.List) - - // remove same player - ok, err = l.PlayerDisconnect(context.Background(), id) - assert.NoError(t, err) - assert.False(t, ok.Bool, "Player already be gone") - count, err = l.GetPlayerCount(context.Background(), e) - assert.NoError(t, err) - assert.Equal(t, int64(0), count.Count) - assertNoWatchUpdate(t, stream) - }) - } -} - func TestLocalSDKServerGetCounter(t *testing.T) { t.Parallel() @@ -1357,26 +1067,6 @@ func TestSDKConformanceFunctionality(t *testing.T) { assert.True(t, b, "we should receive strings from all go routines %v %v", l.expectedSequence, l.requestSequence) } -func TestAlphaSDKConformanceFunctionality(t *testing.T) { - t.Parallel() - lStable, err := NewLocalSDKServer("", "") - assert.Nil(t, err) - v := int64(0) - lStable.recordRequestWithValue("setplayercapacity", strconv.FormatInt(v, 10), "PlayerCapacity") - lStable.recordRequestWithValue("isplayerconnected", "", "PlayerIDs") - - runtime.FeatureTestMutex.Lock() - defer runtime.FeatureTestMutex.Unlock() - - require.NoError(t, runtime.ParseFeatures(string(runtime.FeaturePlayerTracking)+"=true")) - l, err := NewLocalSDKServer("", "") - assert.Nil(t, err) - l.testMode = true - l.recordRequestWithValue("setplayercapacity", strconv.FormatInt(v, 10), "PlayerCapacity") - l.recordRequestWithValue("isplayerconnected", "", "PlayerIDs") - -} - func gsToTmpFile(gs *agonesv1.GameServer) (string, error) { file, err := os.CreateTemp(os.TempDir(), "gameserver-") if err != nil { diff --git a/pkg/sdkserver/sdk.go b/pkg/sdkserver/sdk.go index ee0b375879..77f74fc005 100644 --- a/pkg/sdkserver/sdk.go +++ b/pkg/sdkserver/sdk.go @@ -75,16 +75,6 @@ func convert(gs *agonesv1.GameServer) *sdk.GameServer { result.Status.Ports = append(result.Status.Ports, grpcPort) } - if runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - if gs.Status.Players != nil { - result.Status.Players = &sdk.GameServer_Status_PlayerStatus{ - Count: gs.Status.Players.Count, - Capacity: gs.Status.Players.Capacity, - Ids: gs.Status.Players.IDs, - } - } - } - if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { if gs.Status.Counters != nil { counters := make(map[string]*sdk.GameServer_Status_CounterStatus, len(gs.Status.Counters)) diff --git a/pkg/sdkserver/sdk_test.go b/pkg/sdkserver/sdk_test.go index bbd96041ab..bae197f149 100644 --- a/pkg/sdkserver/sdk_test.go +++ b/pkg/sdkserver/sdk_test.go @@ -80,35 +80,6 @@ func TestConvert(t *testing.T) { } } - t.Run(string(runtime.FeaturePlayerTracking)+" disabled", func(t *testing.T) { - runtime.FeatureTestMutex.Lock() - defer runtime.FeatureTestMutex.Unlock() - require.NoError(t, runtime.ParseFeatures("")) - - gs := fixture.DeepCopy() - - sdkGs := convert(gs) - eq(t, fixture, sdkGs) - assert.Zero(t, sdkGs.ObjectMeta.DeletionTimestamp) - assert.Nil(t, sdkGs.Status.Players) - }) - - t.Run(string(runtime.FeaturePlayerTracking)+" enabled", func(t *testing.T) { - runtime.FeatureTestMutex.Lock() - defer runtime.FeatureTestMutex.Unlock() - require.NoError(t, runtime.ParseFeatures(string(runtime.FeaturePlayerTracking)+"=true")) - - gs := fixture.DeepCopy() - gs.Status.Players = &agonesv1.PlayerStatus{Capacity: 10, Count: 5, IDs: []string{"one", "two"}} - - sdkGs := convert(gs) - eq(t, fixture, sdkGs) - assert.Zero(t, sdkGs.ObjectMeta.DeletionTimestamp) - assert.Equal(t, gs.Status.Players.Capacity, sdkGs.Status.Players.Capacity) - assert.Equal(t, gs.Status.Players.Count, sdkGs.Status.Players.Count) - assert.Equal(t, gs.Status.Players.IDs, sdkGs.Status.Players.Ids) - }) - t.Run(string(runtime.FeatureCountsAndLists)+" disabled", func(t *testing.T) { runtime.FeatureTestMutex.Lock() defer runtime.FeatureTestMutex.Unlock() diff --git a/pkg/sdkserver/sdkserver.go b/pkg/sdkserver/sdkserver.go index 007c78b870..65a027eda1 100644 --- a/pkg/sdkserver/sdkserver.go +++ b/pkg/sdkserver/sdkserver.go @@ -32,7 +32,6 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" - apiequality "k8s.io/apimachinery/pkg/api/equality" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" @@ -54,7 +53,6 @@ import ( listersv1 "agones.dev/agones/pkg/client/listers/agones/v1" "agones.dev/agones/pkg/gameserverallocations" "agones.dev/agones/pkg/sdk" - "agones.dev/agones/pkg/sdk/alpha" "agones.dev/agones/pkg/sdk/beta" "agones.dev/agones/pkg/util/logfields" "agones.dev/agones/pkg/util/runtime" @@ -70,20 +68,17 @@ var ( ) const ( - updateState Operation = "updateState" - updateLabel Operation = "updateLabel" - updateAnnotation Operation = "updateAnnotation" - updatePlayerCapacity Operation = "updatePlayerCapacity" - updateConnectedPlayers Operation = "updateConnectedPlayers" - updateCounters Operation = "updateCounters" - updateLists Operation = "updateLists" - updatePeriod time.Duration = time.Second + updateState Operation = "updateState" + updateLabel Operation = "updateLabel" + updateAnnotation Operation = "updateAnnotation" + updateCounters Operation = "updateCounters" + updateLists Operation = "updateLists" + updatePeriod time.Duration = time.Second ) var ( - _ sdk.SDKServer = &SDKServer{} - _ alpha.SDKServer = &SDKServer{} - _ beta.SDKServer = &SDKServer{} + _ sdk.SDKServer = &SDKServer{} + _ beta.SDKServer = &SDKServer{} ) type counterUpdateRequest struct { @@ -140,7 +135,6 @@ type SDKServer struct { gsWaitForSync sync.WaitGroup reserveTimer *time.Timer gsReserveDuration *time.Duration - gsPlayerCapacity int64 gsConnectedPlayers []string gsCounterUpdates map[string]counterUpdateRequest gsListUpdates map[string]listUpdateRequest @@ -269,16 +263,6 @@ func (s *SDKServer) Run(ctx context.Context) error { s.gsUpdateMutex.Unlock() } - // populate player tracking values - if runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - s.gsUpdateMutex.Lock() - if gs.Status.Players != nil { - s.gsPlayerCapacity = gs.Status.Players.Capacity - s.gsConnectedPlayers = gs.Status.Players.IDs - } - s.gsUpdateMutex.Unlock() - } - // then start the http endpoints s.logger.Debug("Starting SDKServer http health check...") go func() { @@ -342,10 +326,6 @@ func (s *SDKServer) syncGameServer(ctx context.Context, key string) error { return s.updateLabels(ctx) case updateAnnotation: return s.updateAnnotations(ctx) - case updatePlayerCapacity: - return s.updatePlayerCapacity(ctx) - case updateConnectedPlayers: - return s.updateConnectedPlayers(ctx) case updateCounters: return s.updateCounter(ctx) case updateLists: @@ -718,142 +698,6 @@ func (s *SDKServer) stopReserveTimer() { s.gsReserveDuration = nil } -// PlayerConnect should be called when a player connects. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (s *SDKServer) PlayerConnect(_ context.Context, id *alpha.PlayerID) (*alpha.Bool, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return &alpha.Bool{Bool: false}, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.logger.WithField("playerID", id.PlayerID).Debug("Player Connected") - - s.gsUpdateMutex.Lock() - defer s.gsUpdateMutex.Unlock() - - // the player is already connected, return false. - for _, playerID := range s.gsConnectedPlayers { - if playerID == id.PlayerID { - return &alpha.Bool{Bool: false}, nil - } - } - - if int64(len(s.gsConnectedPlayers)) >= s.gsPlayerCapacity { - return &alpha.Bool{Bool: false}, errors.New("players are already at capacity") - } - - // let's retain the original order, as it should be a smaller patch on data change - s.gsConnectedPlayers = append(s.gsConnectedPlayers, id.PlayerID) - s.workerqueue.EnqueueAfter(cache.ExplicitKey(string(updateConnectedPlayers)), updatePeriod) - - return &alpha.Bool{Bool: true}, nil -} - -// PlayerDisconnect should be called when a player disconnects. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (s *SDKServer) PlayerDisconnect(_ context.Context, id *alpha.PlayerID) (*alpha.Bool, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return &alpha.Bool{Bool: false}, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.logger.WithField("playerID", id.PlayerID).Debug("Player Disconnected") - - s.gsUpdateMutex.Lock() - defer s.gsUpdateMutex.Unlock() - - found := -1 - for i, playerID := range s.gsConnectedPlayers { - if playerID == id.PlayerID { - found = i - break - } - } - if found == -1 { - return &alpha.Bool{Bool: false}, nil - } - - // let's retain the original order, as it should be a smaller patch on data change - s.gsConnectedPlayers = append(s.gsConnectedPlayers[:found], s.gsConnectedPlayers[found+1:]...) - s.workerqueue.EnqueueAfter(cache.ExplicitKey(string(updateConnectedPlayers)), updatePeriod) - - return &alpha.Bool{Bool: true}, nil -} - -// IsPlayerConnected returns if the playerID is currently connected to the GameServer. -// This is always accurate, even if the value hasn’t been updated to the GameServer status yet. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (s *SDKServer) IsPlayerConnected(_ context.Context, id *alpha.PlayerID) (*alpha.Bool, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return &alpha.Bool{Bool: false}, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.gsUpdateMutex.RLock() - defer s.gsUpdateMutex.RUnlock() - - result := &alpha.Bool{Bool: false} - - for _, playerID := range s.gsConnectedPlayers { - if playerID == id.PlayerID { - result.Bool = true - break - } - } - - return result, nil -} - -// GetConnectedPlayers returns the list of the currently connected player ids. -// This is always accurate, even if the value hasn’t been updated to the GameServer status yet. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (s *SDKServer) GetConnectedPlayers(_ context.Context, _ *alpha.Empty) (*alpha.PlayerIDList, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.gsUpdateMutex.RLock() - defer s.gsUpdateMutex.RUnlock() - - return &alpha.PlayerIDList{List: s.gsConnectedPlayers}, nil -} - -// GetPlayerCount returns the current player count. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (s *SDKServer) GetPlayerCount(_ context.Context, _ *alpha.Empty) (*alpha.Count, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.gsUpdateMutex.RLock() - defer s.gsUpdateMutex.RUnlock() - return &alpha.Count{Count: int64(len(s.gsConnectedPlayers))}, nil -} - -// SetPlayerCapacity to change the game server's player capacity. -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (s *SDKServer) SetPlayerCapacity(_ context.Context, count *alpha.Count) (*alpha.Empty, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.gsUpdateMutex.Lock() - s.gsPlayerCapacity = count.Count - s.gsUpdateMutex.Unlock() - s.workerqueue.Enqueue(cache.ExplicitKey(string(updatePlayerCapacity))) - - return &alpha.Empty{}, nil -} - -// GetPlayerCapacity returns the current player capacity, as set by SDK.SetPlayerCapacity() -// [Stage:Alpha] -// [FeatureFlag:PlayerTracking] -func (s *SDKServer) GetPlayerCapacity(_ context.Context, _ *alpha.Empty) (*alpha.Count, error) { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return nil, errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.gsUpdateMutex.RLock() - defer s.gsUpdateMutex.RUnlock() - return &alpha.Count{Count: s.gsPlayerCapacity}, nil -} - // GetCounter returns a Counter. Returns error if the counter does not exist. // [Stage:Beta] // [FeatureFlag:CountsAndLists] @@ -1502,64 +1346,6 @@ func (s *SDKServer) healthy() bool { return s.healthFailureCount < s.health.FailureThreshold } -// updatePlayerCapacity updates the Player Capacity field in the GameServer's Status. -func (s *SDKServer) updatePlayerCapacity(ctx context.Context) error { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - s.logger.WithField("capacity", s.gsPlayerCapacity).Debug("updating player capacity") - gs, err := s.gameServer() - if err != nil { - return err - } - - gsCopy := gs.DeepCopy() - - s.gsUpdateMutex.RLock() - gsCopy.Status.Players.Capacity = s.gsPlayerCapacity - s.gsUpdateMutex.RUnlock() - - gs, err = s.patchGameServer(ctx, gs, gsCopy) - if err == nil { - s.recorder.Event(gs, corev1.EventTypeNormal, "PlayerCapacity", fmt.Sprintf("Set to %d", gs.Status.Players.Capacity)) - } - - return err -} - -// updateConnectedPlayers updates the Player IDs and Count fields in the GameServer's Status. -func (s *SDKServer) updateConnectedPlayers(ctx context.Context) error { - if !runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - return errors.Errorf("%s not enabled", runtime.FeaturePlayerTracking) - } - gs, err := s.gameServer() - if err != nil { - return err - } - - gsCopy := gs.DeepCopy() - same := false - s.gsUpdateMutex.RLock() - s.logger.WithField("playerIDs", s.gsConnectedPlayers).Debug("updating connected players") - same = apiequality.Semantic.DeepEqual(gsCopy.Status.Players.IDs, s.gsConnectedPlayers) - gsCopy.Status.Players.IDs = s.gsConnectedPlayers - gsCopy.Status.Players.Count = int64(len(s.gsConnectedPlayers)) - s.gsUpdateMutex.RUnlock() - // if there is no change, then don't update - // since it's possible this could fire quite a lot, let's reduce the - // amount of requests as much as possible. - if same { - return nil - } - - gs, err = s.patchGameServer(ctx, gs, gsCopy) - if err == nil { - s.recorder.Event(gs, corev1.EventTypeNormal, "PlayerCount", fmt.Sprintf("Set to %d", gs.Status.Players.Count)) - } - - return err -} - // NewSDKServerContext returns a Context that cancels when SIGTERM or os.Interrupt // is received and the GameServer's Status is shutdown func (s *SDKServer) NewSDKServerContext(ctx context.Context) context.Context { diff --git a/pkg/sdkserver/sdkserver_test.go b/pkg/sdkserver/sdkserver_test.go index 866cbde09e..072fb7a8a9 100644 --- a/pkg/sdkserver/sdkserver_test.go +++ b/pkg/sdkserver/sdkserver_test.go @@ -18,7 +18,6 @@ import ( "context" "encoding/json" "net/http" - "strconv" "strings" "sync" "testing" @@ -30,7 +29,6 @@ import ( agonesv1 "agones.dev/agones/pkg/apis/agones/v1" "agones.dev/agones/pkg/gameserverallocations" "agones.dev/agones/pkg/sdk" - "agones.dev/agones/pkg/sdk/alpha" "agones.dev/agones/pkg/sdk/beta" agtesting "agones.dev/agones/pkg/testing" agruntime "agones.dev/agones/pkg/util/runtime" @@ -1923,341 +1921,6 @@ func TestDeleteValues(t *testing.T) { assert.Equal(t, len(list)-len(toDeleteMap), len(newList)) } -func TestSDKServerPlayerCapacity(t *testing.T) { - t.Parallel() - agruntime.FeatureTestMutex.Lock() - defer agruntime.FeatureTestMutex.Unlock() - - err := agruntime.ParseFeatures(string(agruntime.FeaturePlayerTracking) + "=true") - require.NoError(t, err, "Can not parse FeaturePlayerTracking feature") - - m := agtesting.NewMocks() - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - sc, err := defaultSidecar(m) - require.NoError(t, err) - - gs := agonesv1.GameServer{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", Namespace: "default", ResourceVersion: "0", - }, - Spec: agonesv1.GameServerSpec{ - SdkServer: agonesv1.SdkServer{ - LogLevel: "Debug", - }, - Players: &agonesv1.PlayersSpec{ - InitialCapacity: 10, - }, - }, - } - gs.ApplyDefaults() - - m.AgonesClient.AddReactor("list", "gameservers", func(_ k8stesting.Action) (bool, runtime.Object, error) { - return true, &agonesv1.GameServerList{Items: []agonesv1.GameServer{*gs.DeepCopy()}}, nil - }) - - updated := make(chan int64, 10) - m.AgonesClient.AddReactor("patch", "gameservers", func(action k8stesting.Action) (bool, runtime.Object, error) { - - gsCopy := patchGameServer(t, action, &gs) - - updated <- gsCopy.Status.Players.Capacity - return true, gsCopy, nil - }) - - assert.NoError(t, sc.WaitForConnection(ctx)) - sc.informerFactory.Start(ctx.Done()) - assert.True(t, cache.WaitForCacheSync(ctx.Done(), sc.gameServerSynced)) - - go func() { - err = sc.Run(ctx) - assert.NoError(t, err) - }() - - // check initial value comes through - - // async, so check after a period - err = wait.PollUntilContextTimeout(context.Background(), time.Second, 10*time.Second, true, func(_ context.Context) (bool, error) { - count, err := sc.GetPlayerCapacity(context.Background(), &alpha.Empty{}) - return count.Count == 10, err - }) - assert.NoError(t, err) - - // on update from the SDK, the value is available from GetPlayerCapacity - _, err = sc.SetPlayerCapacity(context.Background(), &alpha.Count{Count: 20}) - assert.NoError(t, err) - - count, err := sc.GetPlayerCapacity(context.Background(), &alpha.Empty{}) - require.NoError(t, err) - assert.Equal(t, int64(20), count.Count) - - // on an update, confirm that the update hits the K8s api - select { - case value := <-updated: - assert.Equal(t, int64(20), value) - case <-time.After(time.Minute): - assert.Fail(t, "Should have been patched") - } - - agtesting.AssertEventContains(t, m.FakeRecorder.Events, "PlayerCapacity Set to 20") -} - -func TestSDKServerPlayerConnectAndDisconnectWithoutPlayerTracking(t *testing.T) { - t.Parallel() - agruntime.FeatureTestMutex.Lock() - defer agruntime.FeatureTestMutex.Unlock() - - err := agruntime.ParseFeatures(string(agruntime.FeaturePlayerTracking) + "=false") - require.NoError(t, err, "Can not parse FeaturePlayerTracking feature") - - fixture := &agonesv1.GameServer{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", - Namespace: "default", - }, - Status: agonesv1.GameServerStatus{ - State: agonesv1.GameServerStateReady, - }, - } - - m := agtesting.NewMocks() - m.AgonesClient.AddReactor("list", "gameservers", func(_ k8stesting.Action) (bool, runtime.Object, error) { - return true, &agonesv1.GameServerList{Items: []agonesv1.GameServer{*fixture}}, nil - }) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - sc, err := defaultSidecar(m) - require.NoError(t, err) - - assert.NoError(t, sc.WaitForConnection(ctx)) - sc.informerFactory.Start(ctx.Done()) - assert.True(t, cache.WaitForCacheSync(ctx.Done(), sc.gameServerSynced)) - - go func() { - err = sc.Run(ctx) - assert.NoError(t, err) - }() - - // check initial value comes through - // async, so check after a period - e := &alpha.Empty{} - err = wait.PollUntilContextTimeout(context.Background(), time.Second, 10*time.Second, true, func(_ context.Context) (bool, error) { - count, err := sc.GetPlayerCapacity(context.Background(), e) - - assert.Nil(t, count) - return false, err - }) - assert.Error(t, err) - - count, err := sc.GetPlayerCount(context.Background(), e) - require.Error(t, err) - assert.Nil(t, count) - - list, err := sc.GetConnectedPlayers(context.Background(), e) - require.Error(t, err) - assert.Nil(t, list) - - id := &alpha.PlayerID{PlayerID: "test-player"} - - ok, err := sc.PlayerConnect(context.Background(), id) - require.Error(t, err) - assert.False(t, ok.Bool) - - ok, err = sc.IsPlayerConnected(context.Background(), id) - require.Error(t, err) - assert.False(t, ok.Bool) - - ok, err = sc.PlayerDisconnect(context.Background(), id) - require.Error(t, err) - assert.False(t, ok.Bool) -} - -func TestSDKServerPlayerConnectAndDisconnect(t *testing.T) { - t.Parallel() - agruntime.FeatureTestMutex.Lock() - defer agruntime.FeatureTestMutex.Unlock() - - err := agruntime.ParseFeatures(string(agruntime.FeaturePlayerTracking) + "=true") - require.NoError(t, err, "Can not parse FeaturePlayerTracking feature") - - m := agtesting.NewMocks() - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - sc, err := defaultSidecar(m) - require.NoError(t, err) - - capacity := int64(3) - gs := agonesv1.GameServer{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test", Namespace: "default", ResourceVersion: "0", - }, - Spec: agonesv1.GameServerSpec{ - SdkServer: agonesv1.SdkServer{ - LogLevel: "Debug", - }, - // this is here to give us a reference, so we know when sc.Run() has completed. - Players: &agonesv1.PlayersSpec{ - InitialCapacity: capacity, - }, - }, - } - gs.ApplyDefaults() - - m.AgonesClient.AddReactor("list", "gameservers", func(_ k8stesting.Action) (bool, runtime.Object, error) { - return true, &agonesv1.GameServerList{Items: []agonesv1.GameServer{*gs.DeepCopy()}}, nil - }) - - updated := make(chan *agonesv1.PlayerStatus, 10) - m.AgonesClient.AddReactor("patch", "gameservers", func(action k8stesting.Action) (bool, runtime.Object, error) { - gsCopy := patchGameServer(t, action, &gs) - updated <- gsCopy.Status.Players - return true, gsCopy, nil - }) - - assert.NoError(t, sc.WaitForConnection(ctx)) - sc.informerFactory.Start(ctx.Done()) - assert.True(t, cache.WaitForCacheSync(ctx.Done(), sc.gameServerSynced)) - - go func() { - err = sc.Run(ctx) - assert.NoError(t, err) - }() - - // check initial value comes through - // async, so check after a period - e := &alpha.Empty{} - err = wait.PollUntilContextTimeout(context.Background(), time.Second, 10*time.Second, true, func(_ context.Context) (bool, error) { - count, err := sc.GetPlayerCapacity(context.Background(), e) - return count.Count == capacity, err - }) - assert.NoError(t, err) - - count, err := sc.GetPlayerCount(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, int64(0), count.Count) - - list, err := sc.GetConnectedPlayers(context.Background(), e) - require.NoError(t, err) - assert.Empty(t, list.List) - - ok, err := sc.IsPlayerConnected(context.Background(), &alpha.PlayerID{PlayerID: "1"}) - require.NoError(t, err) - assert.False(t, ok.Bool, "no player connected yet") - - // sdk value should always be correct, even if we send more than one update per second. - for i := int64(0); i < capacity; i++ { - token := strconv.FormatInt(i, 10) - id := &alpha.PlayerID{PlayerID: token} - ok, err := sc.PlayerConnect(context.Background(), id) - require.NoError(t, err) - assert.True(t, ok.Bool, "Player "+token+" should not yet be connected") - - ok, err = sc.IsPlayerConnected(context.Background(), id) - require.NoError(t, err) - assert.True(t, ok.Bool, "Player "+token+" should be connected") - } - count, err = sc.GetPlayerCount(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, capacity, count.Count) - - list, err = sc.GetConnectedPlayers(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, []string{"0", "1", "2"}, list.List) - - // on an update, confirm that the update hits the K8s api, only once - select { - case value := <-updated: - assert.Equal(t, capacity, value.Count) - assert.Equal(t, []string{"0", "1", "2"}, value.IDs) - case <-time.After(5 * time.Second): - assert.Fail(t, "Should have been updated") - } - agtesting.AssertEventContains(t, m.FakeRecorder.Events, "PlayerCount Set to 3") - - // confirm there was only one update - select { - case <-updated: - assert.Fail(t, "There should be only one update for the player connections") - case <-time.After(2 * time.Second): - } - - // should return an error if we try and add another, since we're at capacity - nopePlayer := &alpha.PlayerID{PlayerID: "nope"} - _, err = sc.PlayerConnect(context.Background(), nopePlayer) - assert.EqualError(t, err, "players are already at capacity") - - // sdk value should always be correct, even if we send more than one update per second. - // let's leave one player behind - for i := int64(0); i < capacity-1; i++ { - token := strconv.FormatInt(i, 10) - id := &alpha.PlayerID{PlayerID: token} - ok, err := sc.PlayerDisconnect(context.Background(), id) - require.NoError(t, err) - assert.Truef(t, ok.Bool, "Player %s should be disconnected", token) - - ok, err = sc.IsPlayerConnected(context.Background(), id) - require.NoError(t, err) - assert.Falsef(t, ok.Bool, "Player %s should be connected", token) - } - count, err = sc.GetPlayerCount(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, int64(1), count.Count) - - list, err = sc.GetConnectedPlayers(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, []string{"2"}, list.List) - - // on an update, confirm that the update hits the K8s api, only once - select { - case value := <-updated: - assert.Equal(t, int64(1), value.Count) - assert.Equal(t, []string{"2"}, value.IDs) - case <-time.After(5 * time.Second): - assert.Fail(t, "Should have been updated") - } - agtesting.AssertEventContains(t, m.FakeRecorder.Events, "PlayerCount Set to 1") - - // confirm there was only one update - select { - case <-updated: - assert.Fail(t, "There should be only one update for the player disconnections") - case <-time.After(2 * time.Second): - } - - // last player is still there - ok, err = sc.IsPlayerConnected(context.Background(), &alpha.PlayerID{PlayerID: "2"}) - require.NoError(t, err) - assert.True(t, ok.Bool, "Player 2 should be connected") - - // finally, check idempotency of connect and disconnect - id := &alpha.PlayerID{PlayerID: "2"} // only one left behind - ok, err = sc.PlayerConnect(context.Background(), id) - require.NoError(t, err) - assert.False(t, ok.Bool, "Player 2 should already be connected") - count, err = sc.GetPlayerCount(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, int64(1), count.Count) - - // no longer there. - id.PlayerID = "0" - ok, err = sc.PlayerDisconnect(context.Background(), id) - require.NoError(t, err) - assert.False(t, ok.Bool, "Player 2 should already be disconnected") - count, err = sc.GetPlayerCount(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, int64(1), count.Count) - - agtesting.AssertNoEvent(t, m.FakeRecorder.Events) - - list, err = sc.GetConnectedPlayers(context.Background(), e) - require.NoError(t, err) - assert.Equal(t, []string{"2"}, list.List) -} - func TestSDKServerGracefulTerminationInterrupt(t *testing.T) { t.Parallel() agruntime.FeatureTestMutex.Lock() diff --git a/pkg/util/runtime/features.go b/pkg/util/runtime/features.go index 4d681f5955..c455dd35e2 100644 --- a/pkg/util/runtime/features.go +++ b/pkg/util/runtime/features.go @@ -39,7 +39,7 @@ const ( // FeaturePortPolicyNone is a feature flag to allow setting Port Policy to None. FeaturePortPolicyNone Feature = "PortPolicyNone" - + // FeaturePortRanges is a feature flag to enable/disable specific port ranges. FeaturePortRanges Feature = "PortRanges" diff --git a/proto/sdk/alpha/alpha.proto b/proto/sdk/alpha/alpha.proto index fb75ed5ae0..1fce55051a 100644 --- a/proto/sdk/alpha/alpha.proto +++ b/proto/sdk/alpha/alpha.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package agones.dev.sdk.alpha; option go_package = "./alpha"; -import "google/api/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { @@ -31,119 +30,5 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { }; // SDK service to be used in the GameServer SDK to the Pod Sidecar. -service SDK { - // PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the - // list of connected playerIDs. - // - // If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of - // connected playerIDs will be left unchanged. - // - // An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for - // the server has been reached. The playerID will not be added to the list of playerIDs. - // - // Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count - // through the Kubernetes API, as indeterminate results will occur. - rpc PlayerConnect (PlayerID) returns (Bool) { - option (google.api.http) = { - post: "/alpha/player/connect" - body: "*" - }; - } +service SDK {} - // Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the - // playerID value exists within the list. - // - // If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list - // will be left unchanged. - // - // Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count - // through the Kubernetes API, as indeterminate results will occur. - rpc PlayerDisconnect (PlayerID) returns (Bool) { - option (google.api.http) = { - post: "/alpha/player/disconnect" - body: "*" - }; - } - - // Update the GameServer.Status.Players.Capacity value with a new capacity. - rpc SetPlayerCapacity (Count) returns (Empty) { - option (google.api.http) = { - put: "/alpha/player/capacity" - body: "*" - }; - } - - // Retrieves the current player capacity. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetPlayerCapacity (Empty) returns (Count) { - option (google.api.http) = { - get: "/alpha/player/capacity" - }; - } - - // Retrieves the current player count. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetPlayerCount (Empty) returns (Count) { - option (google.api.http) = { - get: "/alpha/player/count" - }; - } - - // Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. - rpc IsPlayerConnected (PlayerID) returns (Bool) { - option (google.api.http) = { - get: "/alpha/player/connected/{playerID}" - }; - } - - // Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetConnectedPlayers(Empty) returns (PlayerIDList) { - option (google.api.http) = { - get: "/alpha/player/connected" - }; - } -} - -// I am Empty -message Empty { -} - -// Store a count variable. -message Count { - int64 count = 1; -} - -// Store a boolean result -message Bool { - bool bool = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {format: "boolean"}]; -} - -// The unique identifier for a given player. -message PlayerID { - string playerID = 1; -} - -// List of Player IDs -message PlayerIDList { - repeated string list = 1; -} diff --git a/proto/sdk/sdk.proto b/proto/sdk/sdk.proto index 7b08d1163f..0e7b541887 100644 --- a/proto/sdk/sdk.proto +++ b/proto/sdk/sdk.proto @@ -150,6 +150,9 @@ message GameServer { } message Status { + reserved 4; + reserved "players"; + message Address { string type = 1; string address = 2; @@ -159,13 +162,6 @@ message GameServer { string name = 1; int32 port = 2; } - // [Stage:Alpha] - // [FeatureFlag:PlayerTracking] - message PlayerStatus { - int64 count = 1; - int64 capacity = 2; - repeated string ids = 3; - } // [Stage:Beta] // [FeatureFlag:CountsAndLists] @@ -186,10 +182,6 @@ message GameServer { repeated Address addresses = 7; repeated Port ports = 3; - // [Stage:Alpha] - // [FeatureFlag:PlayerTracking] - PlayerStatus players = 4; - // [Stage:Beta] // [FeatureFlag:CountsAndLists] map counters = 5; diff --git a/sdks/cpp/include/agones/sdk.pb.h b/sdks/cpp/include/agones/sdk.pb.h index 084480afb3..2699f3b47d 100644 --- a/sdks/cpp/include/agones/sdk.pb.h +++ b/sdks/cpp/include/agones/sdk.pb.h @@ -133,10 +133,6 @@ class GameServer_Status_ListsEntry_DoNotUse; struct GameServer_Status_ListsEntry_DoNotUseDefaultTypeInternal; AGONES_EXPORT extern GameServer_Status_ListsEntry_DoNotUseDefaultTypeInternal _GameServer_Status_ListsEntry_DoNotUse_default_instance_; AGONES_EXPORT extern const ::google::protobuf::internal::ClassDataFull GameServer_Status_ListsEntry_DoNotUse_class_data_; -class GameServer_Status_PlayerStatus; -struct GameServer_Status_PlayerStatusDefaultTypeInternal; -AGONES_EXPORT extern GameServer_Status_PlayerStatusDefaultTypeInternal _GameServer_Status_PlayerStatus_default_instance_; -AGONES_EXPORT extern const ::google::protobuf::internal::ClassDataFull GameServer_Status_PlayerStatus_class_data_; class GameServer_Status_Port; struct GameServer_Status_PortDefaultTypeInternal; AGONES_EXPORT extern GameServer_Status_PortDefaultTypeInternal _GameServer_Status_Port_default_instance_; @@ -583,233 +579,6 @@ class AGONES_EXPORT GameServer_Status_Port final : public ::google::protobuf::Me AGONES_EXPORT extern const ::google::protobuf::internal::ClassDataFull GameServer_Status_Port_class_data_; // ------------------------------------------------------------------- -class AGONES_EXPORT GameServer_Status_PlayerStatus final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:agones.dev.sdk.GameServer.Status.PlayerStatus) */ { - public: - inline GameServer_Status_PlayerStatus() : GameServer_Status_PlayerStatus(nullptr) {} - ~GameServer_Status_PlayerStatus() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(GameServer_Status_PlayerStatus* PROTOBUF_NONNULL msg, std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(GameServer_Status_PlayerStatus)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR GameServer_Status_PlayerStatus(::google::protobuf::internal::ConstantInitialized); - - inline GameServer_Status_PlayerStatus(const GameServer_Status_PlayerStatus& from) : GameServer_Status_PlayerStatus(nullptr, from) {} - inline GameServer_Status_PlayerStatus(GameServer_Status_PlayerStatus&& from) noexcept - : GameServer_Status_PlayerStatus(nullptr, ::std::move(from)) {} - inline GameServer_Status_PlayerStatus& operator=(const GameServer_Status_PlayerStatus& from) { - CopyFrom(from); - return *this; - } - inline GameServer_Status_PlayerStatus& operator=(GameServer_Status_PlayerStatus&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const GameServer_Status_PlayerStatus& default_instance() { - return *reinterpret_cast( - &_GameServer_Status_PlayerStatus_default_instance_); - } - static constexpr int kIndexInFileMessages = 10; - friend void swap(GameServer_Status_PlayerStatus& a, GameServer_Status_PlayerStatus& b) { a.Swap(&b); } - inline void Swap(GameServer_Status_PlayerStatus* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(GameServer_Status_PlayerStatus* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - GameServer_Status_PlayerStatus* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const GameServer_Status_PlayerStatus& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const GameServer_Status_PlayerStatus& from) { GameServer_Status_PlayerStatus::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(GameServer_Status_PlayerStatus* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "agones.dev.sdk.GameServer.Status.PlayerStatus"; } - - protected: - explicit GameServer_Status_PlayerStatus(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - GameServer_Status_PlayerStatus(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const GameServer_Status_PlayerStatus& from); - GameServer_Status_PlayerStatus( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, GameServer_Status_PlayerStatus&& from) noexcept - : GameServer_Status_PlayerStatus(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kIdsFieldNumber = 3, - kCountFieldNumber = 1, - kCapacityFieldNumber = 2, - }; - // repeated string ids = 3; - int ids_size() const; - private: - int _internal_ids_size() const; - - public: - void clear_ids() ; - const ::std::string& ids(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_ids(int index); - template - void set_ids(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_ids(); - template - void add_ids(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& ids() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_ids(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_ids() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_ids(); - - public: - // int64 count = 1; - void clear_count() ; - ::int64_t count() const; - void set_count(::int64_t value); - - private: - ::int64_t _internal_count() const; - void _internal_set_count(::int64_t value); - - public: - // int64 capacity = 2; - void clear_capacity() ; - ::int64_t capacity() const; - void set_capacity(::int64_t value); - - private: - ::int64_t _internal_capacity() const; - void _internal_set_capacity(::int64_t value); - - public: - // @@protoc_insertion_point(class_scope:agones.dev.sdk.GameServer.Status.PlayerStatus) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 3, - 0, 57, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const GameServer_Status_PlayerStatus& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField<::std::string> ids_; - ::int64_t count_; - ::int64_t capacity_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_sdk_2eproto; -}; - -AGONES_EXPORT extern const ::google::protobuf::internal::ClassDataFull GameServer_Status_PlayerStatus_class_data_; -// ------------------------------------------------------------------- - class AGONES_EXPORT GameServer_Status_ListStatus final : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:agones.dev.sdk.GameServer.Status.ListStatus) */ { public: @@ -865,7 +634,7 @@ class AGONES_EXPORT GameServer_Status_ListStatus final : public ::google::protob return *reinterpret_cast( &_GameServer_Status_ListStatus_default_instance_); } - static constexpr int kIndexInFileMessages = 12; + static constexpr int kIndexInFileMessages = 11; friend void swap(GameServer_Status_ListStatus& a, GameServer_Status_ListStatus& b) { a.Swap(&b); } inline void Swap(GameServer_Status_ListStatus* PROTOBUF_NONNULL other) { if (other == this) return; @@ -1080,7 +849,7 @@ class AGONES_EXPORT GameServer_Status_CounterStatus final : public ::google::pro return *reinterpret_cast( &_GameServer_Status_CounterStatus_default_instance_); } - static constexpr int kIndexInFileMessages = 11; + static constexpr int kIndexInFileMessages = 10; friend void swap(GameServer_Status_CounterStatus& a, GameServer_Status_CounterStatus& b) { a.Swap(&b); } inline void Swap(GameServer_Status_CounterStatus* PROTOBUF_NONNULL other) { if (other == this) return; @@ -2736,7 +2505,7 @@ class AGONES_EXPORT GameServer_Status final : public ::google::protobuf::Message return *reinterpret_cast( &_GameServer_Status_default_instance_); } - static constexpr int kIndexInFileMessages = 15; + static constexpr int kIndexInFileMessages = 14; friend void swap(GameServer_Status& a, GameServer_Status& b) { a.Swap(&b); } inline void Swap(GameServer_Status* PROTOBUF_NONNULL other) { if (other == this) return; @@ -2823,7 +2592,6 @@ class AGONES_EXPORT GameServer_Status final : public ::google::protobuf::Message // nested types ---------------------------------------------------- using Address = GameServer_Status_Address; using Port = GameServer_Status_Port; - using PlayerStatus = GameServer_Status_PlayerStatus; using CounterStatus = GameServer_Status_CounterStatus; using ListStatus = GameServer_Status_ListStatus; @@ -2835,7 +2603,6 @@ class AGONES_EXPORT GameServer_Status final : public ::google::protobuf::Message kAddressesFieldNumber = 7, kStateFieldNumber = 1, kAddressFieldNumber = 2, - kPlayersFieldNumber = 4, }; // repeated .agones.dev.sdk.GameServer.Status.Port ports = 3; int ports_size() const; @@ -2930,28 +2697,13 @@ class AGONES_EXPORT GameServer_Status final : public ::google::protobuf::Message PROTOBUF_ALWAYS_INLINE void _internal_set_address(const ::std::string& value); ::std::string* PROTOBUF_NONNULL _internal_mutable_address(); - public: - // .agones.dev.sdk.GameServer.Status.PlayerStatus players = 4; - bool has_players() const; - void clear_players() ; - const ::agones::dev::sdk::GameServer_Status_PlayerStatus& players() const; - [[nodiscard]] ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE release_players(); - ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NONNULL mutable_players(); - void set_allocated_players(::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_players(::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE value); - ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE unsafe_arena_release_players(); - - private: - const ::agones::dev::sdk::GameServer_Status_PlayerStatus& _internal_players() const; - ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NONNULL _internal_mutable_players(); - public: // @@protoc_insertion_point(class_scope:agones.dev.sdk.GameServer.Status) private: class _Internal; friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<3, 7, - 7, 66, + static const ::google::protobuf::internal::TcParseTable<3, 6, + 6, 66, 2> _table_; @@ -2984,7 +2736,6 @@ class AGONES_EXPORT GameServer_Status final : public ::google::protobuf::Message ::google::protobuf::RepeatedPtrField< ::agones::dev::sdk::GameServer_Status_Address > addresses_; ::google::protobuf::internal::ArenaStringPtr state_; ::google::protobuf::internal::ArenaStringPtr address_; - ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE players_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -3049,7 +2800,7 @@ class AGONES_EXPORT GameServer final : public ::google::protobuf::Message return *reinterpret_cast( &_GameServer_default_instance_); } - static constexpr int kIndexInFileMessages = 16; + static constexpr int kIndexInFileMessages = 15; friend void swap(GameServer& a, GameServer& b) { a.Swap(&b); } inline void Swap(GameServer* PROTOBUF_NONNULL other) { if (other == this) return; @@ -4233,122 +3984,6 @@ inline void GameServer_Status_Port::_internal_set_port(::int32_t value) { // ------------------------------------------------------------------- -// GameServer_Status_PlayerStatus - -// int64 count = 1; -inline void GameServer_Status_PlayerStatus::clear_count() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.count_ = ::int64_t{0}; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline ::int64_t GameServer_Status_PlayerStatus::count() const { - // @@protoc_insertion_point(field_get:agones.dev.sdk.GameServer.Status.PlayerStatus.count) - return _internal_count(); -} -inline void GameServer_Status_PlayerStatus::set_count(::int64_t value) { - _internal_set_count(value); - _impl_._has_bits_[0] |= 0x00000001u; - // @@protoc_insertion_point(field_set:agones.dev.sdk.GameServer.Status.PlayerStatus.count) -} -inline ::int64_t GameServer_Status_PlayerStatus::_internal_count() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.count_; -} -inline void GameServer_Status_PlayerStatus::_internal_set_count(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.count_ = value; -} - -// int64 capacity = 2; -inline void GameServer_Status_PlayerStatus::clear_capacity() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.capacity_ = ::int64_t{0}; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline ::int64_t GameServer_Status_PlayerStatus::capacity() const { - // @@protoc_insertion_point(field_get:agones.dev.sdk.GameServer.Status.PlayerStatus.capacity) - return _internal_capacity(); -} -inline void GameServer_Status_PlayerStatus::set_capacity(::int64_t value) { - _internal_set_capacity(value); - _impl_._has_bits_[0] |= 0x00000002u; - // @@protoc_insertion_point(field_set:agones.dev.sdk.GameServer.Status.PlayerStatus.capacity) -} -inline ::int64_t GameServer_Status_PlayerStatus::_internal_capacity() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.capacity_; -} -inline void GameServer_Status_PlayerStatus::_internal_set_capacity(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.capacity_ = value; -} - -// repeated string ids = 3; -inline int GameServer_Status_PlayerStatus::_internal_ids_size() const { - return _internal_ids().size(); -} -inline int GameServer_Status_PlayerStatus::ids_size() const { - return _internal_ids_size(); -} -inline void GameServer_Status_PlayerStatus::clear_ids() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.ids_.Clear(); -} -inline ::std::string* PROTOBUF_NONNULL GameServer_Status_PlayerStatus::add_ids() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = _internal_mutable_ids()->Add(); - // @@protoc_insertion_point(field_add_mutable:agones.dev.sdk.GameServer.Status.PlayerStatus.ids) - return _s; -} -inline const ::std::string& GameServer_Status_PlayerStatus::ids(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:agones.dev.sdk.GameServer.Status.PlayerStatus.ids) - return _internal_ids().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL GameServer_Status_PlayerStatus::mutable_ids(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:agones.dev.sdk.GameServer.Status.PlayerStatus.ids) - return _internal_mutable_ids()->Mutable(index); -} -template -inline void GameServer_Status_PlayerStatus::set_ids(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_ids()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:agones.dev.sdk.GameServer.Status.PlayerStatus.ids) -} -template -inline void GameServer_Status_PlayerStatus::add_ids(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField(*_internal_mutable_ids(), - ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_add:agones.dev.sdk.GameServer.Status.PlayerStatus.ids) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& GameServer_Status_PlayerStatus::ids() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:agones.dev.sdk.GameServer.Status.PlayerStatus.ids) - return _internal_ids(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -GameServer_Status_PlayerStatus::mutable_ids() ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable_list:agones.dev.sdk.GameServer.Status.PlayerStatus.ids) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_ids(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -GameServer_Status_PlayerStatus::_internal_ids() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.ids_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -GameServer_Status_PlayerStatus::_internal_mutable_ids() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.ids_; -} - -// ------------------------------------------------------------------- - // GameServer_Status_CounterStatus // int64 count = 1; @@ -4729,104 +4364,6 @@ GameServer_Status::_internal_mutable_ports() { return &_impl_.ports_; } -// .agones.dev.sdk.GameServer.Status.PlayerStatus players = 4; -inline bool GameServer_Status::has_players() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - PROTOBUF_ASSUME(!value || _impl_.players_ != nullptr); - return value; -} -inline void GameServer_Status::clear_players() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.players_ != nullptr) _impl_.players_->Clear(); - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline const ::agones::dev::sdk::GameServer_Status_PlayerStatus& GameServer_Status::_internal_players() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::agones::dev::sdk::GameServer_Status_PlayerStatus* p = _impl_.players_; - return p != nullptr ? *p : reinterpret_cast(::agones::dev::sdk::_GameServer_Status_PlayerStatus_default_instance_); -} -inline const ::agones::dev::sdk::GameServer_Status_PlayerStatus& GameServer_Status::players() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:agones.dev.sdk.GameServer.Status.players) - return _internal_players(); -} -inline void GameServer_Status::unsafe_arena_set_allocated_players( - ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.players_); - } - _impl_.players_ = reinterpret_cast<::agones::dev::sdk::GameServer_Status_PlayerStatus*>(value); - if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:agones.dev.sdk.GameServer.Status.players) -} -inline ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE GameServer_Status::release_players() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - _impl_._has_bits_[0] &= ~0x00000004u; - ::agones::dev::sdk::GameServer_Status_PlayerStatus* released = _impl_.players_; - _impl_.players_ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE GameServer_Status::unsafe_arena_release_players() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:agones.dev.sdk.GameServer.Status.players) - - _impl_._has_bits_[0] &= ~0x00000004u; - ::agones::dev::sdk::GameServer_Status_PlayerStatus* temp = _impl_.players_; - _impl_.players_ = nullptr; - return temp; -} -inline ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NONNULL GameServer_Status::_internal_mutable_players() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.players_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::agones::dev::sdk::GameServer_Status_PlayerStatus>(GetArena()); - _impl_.players_ = reinterpret_cast<::agones::dev::sdk::GameServer_Status_PlayerStatus*>(p); - } - return _impl_.players_; -} -inline ::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NONNULL GameServer_Status::mutable_players() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000004u; - ::agones::dev::sdk::GameServer_Status_PlayerStatus* _msg = _internal_mutable_players(); - // @@protoc_insertion_point(field_mutable:agones.dev.sdk.GameServer.Status.players) - return _msg; -} -inline void GameServer_Status::set_allocated_players(::agones::dev::sdk::GameServer_Status_PlayerStatus* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.players_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = value->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - - _impl_.players_ = reinterpret_cast<::agones::dev::sdk::GameServer_Status_PlayerStatus*>(value); - // @@protoc_insertion_point(field_set_allocated:agones.dev.sdk.GameServer.Status.players) -} - // map counters = 5; inline int GameServer_Status::_internal_counters_size() const { return _internal_counters().size(); diff --git a/sdks/cpp/src/agones/sdk.pb.cc b/sdks/cpp/src/agones/sdk.pb.cc index 5a89597dd0..480bad09df 100644 --- a/sdks/cpp/src/agones/sdk.pb.cc +++ b/sdks/cpp/src/agones/sdk.pb.cc @@ -101,33 +101,6 @@ struct GameServer_Status_PortDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AGONES_EXPORT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GameServer_Status_PortDefaultTypeInternal _GameServer_Status_Port_default_instance_; -inline constexpr GameServer_Status_PlayerStatus::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - ids_{}, - count_{::int64_t{0}}, - capacity_{::int64_t{0}} {} - -template -PROTOBUF_CONSTEXPR GameServer_Status_PlayerStatus::GameServer_Status_PlayerStatus(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(GameServer_Status_PlayerStatus_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct GameServer_Status_PlayerStatusDefaultTypeInternal { - PROTOBUF_CONSTEXPR GameServer_Status_PlayerStatusDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~GameServer_Status_PlayerStatusDefaultTypeInternal() {} - union { - GameServer_Status_PlayerStatus _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AGONES_EXPORT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GameServer_Status_PlayerStatusDefaultTypeInternal _GameServer_Status_PlayerStatus_default_instance_; - inline constexpr GameServer_Status_ListStatus::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, @@ -431,8 +404,7 @@ inline constexpr GameServer_Status::Impl_::Impl_( ::_pbi::ConstantInitialized()), address_( &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - players_{nullptr} {} + ::_pbi::ConstantInitialized()) {} template PROTOBUF_CONSTEXPR GameServer_Status::GameServer_Status(::_pbi::ConstantInitialized) @@ -569,15 +541,6 @@ const ::uint32_t 0, 1, 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status_PlayerStatus, _impl_._has_bits_), - 6, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status_PlayerStatus, _impl_.count_), - PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status_PlayerStatus, _impl_.capacity_), - PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status_PlayerStatus, _impl_.ids_), - 0, - 1, - ~0u, - 0x081, // bitmap PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status_CounterStatus, _impl_._has_bits_), 5, // hasbit index offset PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status_CounterStatus, _impl_.count_), @@ -607,19 +570,17 @@ const ::uint32_t 1, 0x081, // bitmap PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_._has_bits_), - 10, // hasbit index offset + 9, // hasbit index offset PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_.state_), PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_.address_), PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_.addresses_), PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_.ports_), - PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_.players_), PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_.counters_), PROTOBUF_FIELD_OFFSET(::agones::dev::sdk::GameServer_Status, _impl_.lists_), 0, 1, ~0u, ~0u, - 2, ~0u, ~0u, 0x081, // bitmap @@ -645,13 +606,12 @@ static const ::_pbi::MigrationSchema {59, sizeof(::agones::dev::sdk::GameServer_Spec)}, {64, sizeof(::agones::dev::sdk::GameServer_Status_Address)}, {71, sizeof(::agones::dev::sdk::GameServer_Status_Port)}, - {78, sizeof(::agones::dev::sdk::GameServer_Status_PlayerStatus)}, - {87, sizeof(::agones::dev::sdk::GameServer_Status_CounterStatus)}, - {94, sizeof(::agones::dev::sdk::GameServer_Status_ListStatus)}, - {101, sizeof(::agones::dev::sdk::GameServer_Status_CountersEntry_DoNotUse)}, - {108, sizeof(::agones::dev::sdk::GameServer_Status_ListsEntry_DoNotUse)}, - {115, sizeof(::agones::dev::sdk::GameServer_Status)}, - {132, sizeof(::agones::dev::sdk::GameServer)}, + {78, sizeof(::agones::dev::sdk::GameServer_Status_CounterStatus)}, + {85, sizeof(::agones::dev::sdk::GameServer_Status_ListStatus)}, + {92, sizeof(::agones::dev::sdk::GameServer_Status_CountersEntry_DoNotUse)}, + {99, sizeof(::agones::dev::sdk::GameServer_Status_ListsEntry_DoNotUse)}, + {106, sizeof(::agones::dev::sdk::GameServer_Status)}, + {121, sizeof(::agones::dev::sdk::GameServer)}, }; static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::agones::dev::sdk::_Empty_default_instance_._instance, @@ -664,7 +624,6 @@ static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::agones::dev::sdk::_GameServer_Spec_default_instance_._instance, &::agones::dev::sdk::_GameServer_Status_Address_default_instance_._instance, &::agones::dev::sdk::_GameServer_Status_Port_default_instance_._instance, - &::agones::dev::sdk::_GameServer_Status_PlayerStatus_default_instance_._instance, &::agones::dev::sdk::_GameServer_Status_CounterStatus_default_instance_._instance, &::agones::dev::sdk::_GameServer_Status_ListStatus_default_instance_._instance, &::agones::dev::sdk::_GameServer_Status_CountersEntry_DoNotUse_default_instance_._instance, @@ -678,7 +637,7 @@ const char descriptor_table_protodef_sdk_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIAB "annotations.proto\032.protoc-gen-openapiv2/" "options/annotations.proto\"\007\n\005Empty\"&\n\010Ke" "yValue\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\"\033\n\010Du" - "ration\022\017\n\007seconds\030\001 \001(\003\"\213\014\n\nGameServer\022:" + "ration\022\017\n\007seconds\030\001 \001(\003\"\233\013\n\nGameServer\022:" "\n\013object_meta\030\001 \001(\0132%.agones.dev.sdk.Gam" "eServer.ObjectMeta\022-\n\004spec\030\002 \001(\0132\037.agone" "s.dev.sdk.GameServer.Spec\0221\n\006status\030\003 \001(" @@ -697,48 +656,46 @@ const char descriptor_table_protodef_sdk_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIAB ".sdk.GameServer.Spec.Health\032{\n\006Health\022\037\n" "\010disabled\030\001 \001(\010B\r\222A\n\242\002\007boolean\022\026\n\016period" "_seconds\030\002 \001(\005\022\031\n\021failure_threshold\030\003 \001(" - "\005\022\035\n\025initial_delay_seconds\030\004 \001(\005\032\212\006\n\006Sta" + "\005\022\035\n\025initial_delay_seconds\030\004 \001(\005\032\232\005\n\006Sta" "tus\022\r\n\005state\030\001 \001(\t\022\017\n\007address\030\002 \001(\t\022<\n\ta" "ddresses\030\007 \003(\0132).agones.dev.sdk.GameServ" "er.Status.Address\0225\n\005ports\030\003 \003(\0132&.agone" - "s.dev.sdk.GameServer.Status.Port\022\?\n\007play" - "ers\030\004 \001(\0132..agones.dev.sdk.GameServer.St" - "atus.PlayerStatus\022A\n\010counters\030\005 \003(\0132/.ag" - "ones.dev.sdk.GameServer.Status.CountersE" - "ntry\022;\n\005lists\030\006 \003(\0132,.agones.dev.sdk.Gam" - "eServer.Status.ListsEntry\032(\n\007Address\022\014\n\004" - "type\030\001 \001(\t\022\017\n\007address\030\002 \001(\t\032\"\n\004Port\022\014\n\004n" - "ame\030\001 \001(\t\022\014\n\004port\030\002 \001(\005\032<\n\014PlayerStatus\022" - "\r\n\005count\030\001 \001(\003\022\020\n\010capacity\030\002 \001(\003\022\013\n\003ids\030" - "\003 \003(\t\0320\n\rCounterStatus\022\r\n\005count\030\001 \001(\003\022\020\n" - "\010capacity\030\002 \001(\003\032.\n\nListStatus\022\020\n\010capacit" - "y\030\001 \001(\003\022\016\n\006values\030\002 \003(\t\032`\n\rCountersEntry" - "\022\013\n\003key\030\001 \001(\t\022>\n\005value\030\002 \001(\0132/.agones.de" - "v.sdk.GameServer.Status.CounterStatus:\0028" - "\001\032Z\n\nListsEntry\022\013\n\003key\030\001 \001(\t\022;\n\005value\030\002 " - "\001(\0132,.agones.dev.sdk.GameServer.Status.L" - "istStatus:\0028\0012\206\006\n\003SDK\022H\n\005Ready\022\025.agones." - "dev.sdk.Empty\032\025.agones.dev.sdk.Empty\"\021\202\323" - "\344\223\002\013\"\006/ready:\001*\022N\n\010Allocate\022\025.agones.dev" - ".sdk.Empty\032\025.agones.dev.sdk.Empty\"\024\202\323\344\223\002" - "\016\"\t/allocate:\001*\022N\n\010Shutdown\022\025.agones.dev" - ".sdk.Empty\032\025.agones.dev.sdk.Empty\"\024\202\323\344\223\002" - "\016\"\t/shutdown:\001*\022L\n\006Health\022\025.agones.dev.s" - "dk.Empty\032\025.agones.dev.sdk.Empty\"\022\202\323\344\223\002\014\"" - "\007/health:\001*(\001\022W\n\rGetGameServer\022\025.agones." - "dev.sdk.Empty\032\032.agones.dev.sdk.GameServe" - "r\"\023\202\323\344\223\002\r\022\013/gameserver\022a\n\017WatchGameServe" - "r\022\025.agones.dev.sdk.Empty\032\032.agones.dev.sd" - "k.GameServer\"\031\202\323\344\223\002\023\022\021/watch/gameserver0" - "\001\022W\n\010SetLabel\022\030.agones.dev.sdk.KeyValue\032" - "\025.agones.dev.sdk.Empty\"\032\202\323\344\223\002\024\032\017/metadat" - "a/label:\001*\022a\n\rSetAnnotation\022\030.agones.dev" - ".sdk.KeyValue\032\025.agones.dev.sdk.Empty\"\037\202\323" - "\344\223\002\031\032\024/metadata/annotation:\001*\022O\n\007Reserve" - "\022\030.agones.dev.sdk.Duration\032\025.agones.dev." - "sdk.Empty\"\023\202\323\344\223\002\r\"\010/reserve:\001*BOZ\005./sdk\222" - "AE\022\034\n\tsdk.proto2\017version not set*\001\0012\020app" - "lication/json:\020application/jsonb\006proto3" + "s.dev.sdk.GameServer.Status.Port\022A\n\010coun" + "ters\030\005 \003(\0132/.agones.dev.sdk.GameServer.S" + "tatus.CountersEntry\022;\n\005lists\030\006 \003(\0132,.ago" + "nes.dev.sdk.GameServer.Status.ListsEntry" + "\032(\n\007Address\022\014\n\004type\030\001 \001(\t\022\017\n\007address\030\002 \001" + "(\t\032\"\n\004Port\022\014\n\004name\030\001 \001(\t\022\014\n\004port\030\002 \001(\005\0320" + "\n\rCounterStatus\022\r\n\005count\030\001 \001(\003\022\020\n\010capaci" + "ty\030\002 \001(\003\032.\n\nListStatus\022\020\n\010capacity\030\001 \001(\003" + "\022\016\n\006values\030\002 \003(\t\032`\n\rCountersEntry\022\013\n\003key" + "\030\001 \001(\t\022>\n\005value\030\002 \001(\0132/.agones.dev.sdk.G" + "ameServer.Status.CounterStatus:\0028\001\032Z\n\nLi" + "stsEntry\022\013\n\003key\030\001 \001(\t\022;\n\005value\030\002 \001(\0132,.a" + "gones.dev.sdk.GameServer.Status.ListStat" + "us:\0028\001J\004\010\004\020\005R\007players2\206\006\n\003SDK\022H\n\005Ready\022\025" + ".agones.dev.sdk.Empty\032\025.agones.dev.sdk.E" + "mpty\"\021\202\323\344\223\002\013\"\006/ready:\001*\022N\n\010Allocate\022\025.ag" + "ones.dev.sdk.Empty\032\025.agones.dev.sdk.Empt" + "y\"\024\202\323\344\223\002\016\"\t/allocate:\001*\022N\n\010Shutdown\022\025.ag" + "ones.dev.sdk.Empty\032\025.agones.dev.sdk.Empt" + "y\"\024\202\323\344\223\002\016\"\t/shutdown:\001*\022L\n\006Health\022\025.agon" + "es.dev.sdk.Empty\032\025.agones.dev.sdk.Empty\"" + "\022\202\323\344\223\002\014\"\007/health:\001*(\001\022W\n\rGetGameServer\022\025" + ".agones.dev.sdk.Empty\032\032.agones.dev.sdk.G" + "ameServer\"\023\202\323\344\223\002\r\022\013/gameserver\022a\n\017WatchG" + "ameServer\022\025.agones.dev.sdk.Empty\032\032.agone" + "s.dev.sdk.GameServer\"\031\202\323\344\223\002\023\022\021/watch/gam" + "eserver0\001\022W\n\010SetLabel\022\030.agones.dev.sdk.K" + "eyValue\032\025.agones.dev.sdk.Empty\"\032\202\323\344\223\002\024\032\017" + "/metadata/label:\001*\022a\n\rSetAnnotation\022\030.ag" + "ones.dev.sdk.KeyValue\032\025.agones.dev.sdk.E" + "mpty\"\037\202\323\344\223\002\031\032\024/metadata/annotation:\001*\022O\n" + "\007Reserve\022\030.agones.dev.sdk.Duration\032\025.ago" + "nes.dev.sdk.Empty\"\023\202\323\344\223\002\r\"\010/reserve:\001*BO" + "Z\005./sdk\222AE\022\034\n\tsdk.proto2\017version not set" + "*\001\0012\020application/json:\020application/jsonb" + "\006proto3" }; static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const descriptor_table_sdk_2eproto_deps[2] = { @@ -749,13 +706,13 @@ static ::absl::once_flag descriptor_table_sdk_2eproto_once; PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_sdk_2eproto = { false, false, - 2599, + 2487, descriptor_table_protodef_sdk_2eproto, "sdk.proto", &descriptor_table_sdk_2eproto_once, descriptor_table_sdk_2eproto_deps, 2, - 17, + 16, schemas, file_default_instances, TableStruct_sdk_2eproto::offsets, @@ -3439,351 +3396,6 @@ ::google::protobuf::Metadata GameServer_Status_Port::GetMetadata() const { } // =================================================================== -class GameServer_Status_PlayerStatus::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_._has_bits_); -}; - -GameServer_Status_PlayerStatus::GameServer_Status_PlayerStatus(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, GameServer_Status_PlayerStatus_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:agones.dev.sdk.GameServer.Status.PlayerStatus) -} -PROTOBUF_NDEBUG_INLINE GameServer_Status_PlayerStatus::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const ::agones::dev::sdk::GameServer_Status_PlayerStatus& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - ids_{visibility, arena, from.ids_} {} - -GameServer_Status_PlayerStatus::GameServer_Status_PlayerStatus( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const GameServer_Status_PlayerStatus& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, GameServer_Status_PlayerStatus_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - GameServer_Status_PlayerStatus* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, count_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, count_), - offsetof(Impl_, capacity_) - - offsetof(Impl_, count_) + - sizeof(Impl_::capacity_)); - - // @@protoc_insertion_point(copy_constructor:agones.dev.sdk.GameServer.Status.PlayerStatus) -} -PROTOBUF_NDEBUG_INLINE GameServer_Status_PlayerStatus::Impl_::Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - ids_{visibility, arena} {} - -inline void GameServer_Status_PlayerStatus::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, count_), - 0, - offsetof(Impl_, capacity_) - - offsetof(Impl_, count_) + - sizeof(Impl_::capacity_)); -} -GameServer_Status_PlayerStatus::~GameServer_Status_PlayerStatus() { - // @@protoc_insertion_point(destructor:agones.dev.sdk.GameServer.Status.PlayerStatus) - SharedDtor(*this); -} -inline void GameServer_Status_PlayerStatus::SharedDtor(MessageLite& self) { - GameServer_Status_PlayerStatus& this_ = static_cast(self); - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL GameServer_Status_PlayerStatus::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) GameServer_Status_PlayerStatus(arena); -} -constexpr auto GameServer_Status_PlayerStatus::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.ids_) + - decltype(GameServer_Status_PlayerStatus::_impl_.ids_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(GameServer_Status_PlayerStatus), alignof(GameServer_Status_PlayerStatus), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&GameServer_Status_PlayerStatus::PlacementNew_, - sizeof(GameServer_Status_PlayerStatus), - alignof(GameServer_Status_PlayerStatus)); - } -} -constexpr auto GameServer_Status_PlayerStatus::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_GameServer_Status_PlayerStatus_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &GameServer_Status_PlayerStatus::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &GameServer_Status_PlayerStatus::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &GameServer_Status_PlayerStatus::ByteSizeLong, - &GameServer_Status_PlayerStatus::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_._cached_size_), - false, - }, - &GameServer_Status_PlayerStatus::kDescriptorMethods, - &descriptor_table_sdk_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull GameServer_Status_PlayerStatus_class_data_ = - GameServer_Status_PlayerStatus::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -GameServer_Status_PlayerStatus::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&GameServer_Status_PlayerStatus_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(GameServer_Status_PlayerStatus_class_data_.tc_table); - return GameServer_Status_PlayerStatus_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 0, 57, 2> -GameServer_Status_PlayerStatus::_table_ = { - { - PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_._has_bits_), - 0, // no _extensions_ - 3, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967288, // skipmap - offsetof(decltype(_table_), field_entries), - 3, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - GameServer_Status_PlayerStatus_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::agones::dev::sdk::GameServer_Status_PlayerStatus>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // int64 count = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(GameServer_Status_PlayerStatus, _impl_.count_), 0>(), - {8, 0, 0, PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.count_)}}, - // int64 capacity = 2; - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(GameServer_Status_PlayerStatus, _impl_.capacity_), 1>(), - {16, 1, 0, PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.capacity_)}}, - // repeated string ids = 3; - {::_pbi::TcParser::FastUR1, - {26, 63, 0, PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.ids_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // int64 count = 1; - {PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.count_), _Internal::kHasBitsOffset + 0, 0, - (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, - // int64 capacity = 2; - {PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.capacity_), _Internal::kHasBitsOffset + 1, 0, - (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, - // repeated string ids = 3; - {PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.ids_), -1, 0, - (0 | ::_fl::kFcRepeated | ::_fl::kUtf8String | ::_fl::kRepSString)}, - }}, - // no aux_entries - {{ - "\55\0\0\3\0\0\0\0" - "agones.dev.sdk.GameServer.Status.PlayerStatus" - "ids" - }}, -}; -PROTOBUF_NOINLINE void GameServer_Status_PlayerStatus::Clear() { -// @@protoc_insertion_point(message_clear_start:agones.dev.sdk.GameServer.Status.PlayerStatus) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_.ids_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if ((cached_has_bits & 0x00000003u) != 0) { - ::memset(&_impl_.count_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.capacity_) - - reinterpret_cast(&_impl_.count_)) + sizeof(_impl_.capacity_)); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL GameServer_Status_PlayerStatus::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const GameServer_Status_PlayerStatus& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL GameServer_Status_PlayerStatus::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const GameServer_Status_PlayerStatus& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(serialize_to_array_start:agones.dev.sdk.GameServer.Status.PlayerStatus) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - // int64 count = 1; - if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { - if (this_._internal_count() != 0) { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<1>( - stream, this_._internal_count(), target); - } - } - - // int64 capacity = 2; - if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { - if (this_._internal_capacity() != 0) { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<2>( - stream, this_._internal_capacity(), target); - } - } - - // repeated string ids = 3; - for (int i = 0, n = this_._internal_ids_size(); i < n; ++i) { - const auto& s = this_._internal_ids().Get(i); - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - s.data(), static_cast(s.length()), ::google::protobuf::internal::WireFormatLite::SERIALIZE, "agones.dev.sdk.GameServer.Status.PlayerStatus.ids"); - target = stream->WriteString(3, s, target); - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:agones.dev.sdk.GameServer.Status.PlayerStatus) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t GameServer_Status_PlayerStatus::ByteSizeLong(const MessageLite& base) { - const GameServer_Status_PlayerStatus& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t GameServer_Status_PlayerStatus::ByteSizeLong() const { - const GameServer_Status_PlayerStatus& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:agones.dev.sdk.GameServer.Status.PlayerStatus) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated string ids = 3; - { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_ids().size()); - for (int i = 0, n = this_._internal_ids().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_ids().Get(i)); - } - } - } - cached_has_bits = this_._impl_._has_bits_[0]; - if ((cached_has_bits & 0x00000003u) != 0) { - // int64 count = 1; - if ((cached_has_bits & 0x00000001u) != 0) { - if (this_._internal_count() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_count()); - } - } - // int64 capacity = 2; - if ((cached_has_bits & 0x00000002u) != 0) { - if (this_._internal_capacity() != 0) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_capacity()); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void GameServer_Status_PlayerStatus::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = static_cast(&to_msg); - auto& from = static_cast(from_msg); - // @@protoc_insertion_point(class_specific_merge_from_start:agones.dev.sdk.GameServer.Status.PlayerStatus) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void) cached_has_bits; - - _this->_internal_mutable_ids()->MergeFrom(from._internal_ids()); - cached_has_bits = from._impl_._has_bits_[0]; - if ((cached_has_bits & 0x00000003u) != 0) { - if ((cached_has_bits & 0x00000001u) != 0) { - if (from._internal_count() != 0) { - _this->_impl_.count_ = from._impl_.count_; - } - } - if ((cached_has_bits & 0x00000002u) != 0) { - if (from._internal_capacity() != 0) { - _this->_impl_.capacity_ = from._impl_.capacity_; - } - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); -} - -void GameServer_Status_PlayerStatus::CopyFrom(const GameServer_Status_PlayerStatus& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:agones.dev.sdk.GameServer.Status.PlayerStatus) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void GameServer_Status_PlayerStatus::InternalSwap(GameServer_Status_PlayerStatus* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.ids_.InternalSwap(&other->_impl_.ids_); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.capacity_) - + sizeof(GameServer_Status_PlayerStatus::_impl_.capacity_) - - PROTOBUF_FIELD_OFFSET(GameServer_Status_PlayerStatus, _impl_.count_)>( - reinterpret_cast(&_impl_.count_), - reinterpret_cast(&other->_impl_.count_)); -} - -::google::protobuf::Metadata GameServer_Status_PlayerStatus::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - class GameServer_Status_CounterStatus::_Internal { public: using HasBits = @@ -4599,10 +4211,6 @@ GameServer_Status::GameServer_Status( _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.players_ = ((cached_has_bits & 0x00000004u) != 0) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.players_) - : nullptr; // @@protoc_insertion_point(copy_constructor:agones.dev.sdk.GameServer.Status) } @@ -4619,7 +4227,6 @@ PROTOBUF_NDEBUG_INLINE GameServer_Status::Impl_::Impl_( inline void GameServer_Status::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.players_ = {}; } GameServer_Status::~GameServer_Status() { // @@protoc_insertion_point(destructor:agones.dev.sdk.GameServer.Status) @@ -4631,7 +4238,6 @@ inline void GameServer_Status::SharedDtor(MessageLite& self) { ABSL_DCHECK(this_.GetArena() == nullptr); this_._impl_.state_.Destroy(); this_._impl_.address_.Destroy(); - delete this_._impl_.players_; this_._impl_.~Impl_(); } @@ -4710,17 +4316,17 @@ GameServer_Status::GetClassData() const { return GameServer_Status_class_data_.base(); } PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 7, 7, 66, 2> +const ::_pbi::TcParseTable<3, 6, 6, 66, 2> GameServer_Status::_table_ = { { PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_._has_bits_), 0, // no _extensions_ 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967168, // skipmap + 4294967176, // skipmap offsetof(decltype(_table_), field_entries), - 7, // num_field_entries - 7, // num_aux_entries + 6, // num_field_entries + 6, // num_aux_entries offsetof(decltype(_table_), aux_entries), GameServer_Status_class_data_.base(), nullptr, // post_loop_handler @@ -4739,14 +4345,12 @@ GameServer_Status::_table_ = { // repeated .agones.dev.sdk.GameServer.Status.Port ports = 3; {::_pbi::TcParser::FastMtR1, {26, 63, 0, PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.ports_)}}, - // .agones.dev.sdk.GameServer.Status.PlayerStatus players = 4; - {::_pbi::TcParser::FastMtS1, - {34, 2, 1, PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.players_)}}, + {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, // repeated .agones.dev.sdk.GameServer.Status.Address addresses = 7; {::_pbi::TcParser::FastMtR1, - {58, 63, 2, PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.addresses_)}}, + {58, 63, 1, PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.addresses_)}}, }}, {{ 65535, 65535 }}, {{ @@ -4759,22 +4363,18 @@ GameServer_Status::_table_ = { // repeated .agones.dev.sdk.GameServer.Status.Port ports = 3; {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.ports_), -1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // .agones.dev.sdk.GameServer.Status.PlayerStatus players = 4; - {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.players_), _Internal::kHasBitsOffset + 2, 1, - (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // map counters = 5; - {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.counters_), -1, 3, + {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.counters_), -1, 2, (0 | ::_fl::kFcRepeated | ::_fl::kMap)}, // map lists = 6; - {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.lists_), -1, 5, + {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.lists_), -1, 4, (0 | ::_fl::kFcRepeated | ::_fl::kMap)}, // repeated .agones.dev.sdk.GameServer.Status.Address addresses = 7; - {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.addresses_), -1, 2, + {PROTOBUF_FIELD_OFFSET(GameServer_Status, _impl_.addresses_), -1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, }}, {{ {::_pbi::TcParser::GetTable<::agones::dev::sdk::GameServer_Status_Port>()}, - {::_pbi::TcParser::GetTable<::agones::dev::sdk::GameServer_Status_PlayerStatus>()}, {::_pbi::TcParser::GetTable<::agones::dev::sdk::GameServer_Status_Address>()}, {::_pbi::TcParser::GetMapAuxInfo(1, 0, 0, 9, 11, @@ -4786,7 +4386,7 @@ GameServer_Status::_table_ = { {::_pbi::TcParser::GetTable<::agones::dev::sdk::GameServer_Status_ListStatus>()}, }}, {{ - "\40\5\7\0\0\10\5\0" + "\40\5\7\0\10\5\0\0" "agones.dev.sdk.GameServer.Status" "state" "address" @@ -4806,17 +4406,13 @@ PROTOBUF_NOINLINE void GameServer_Status::Clear() { _impl_.lists_.Clear(); _impl_.addresses_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000003u) != 0) { if ((cached_has_bits & 0x00000001u) != 0) { _impl_.state_.ClearNonDefaultToEmpty(); } if ((cached_has_bits & 0x00000002u) != 0) { _impl_.address_.ClearNonDefaultToEmpty(); } - if ((cached_has_bits & 0x00000004u) != 0) { - ABSL_DCHECK(_impl_.players_ != nullptr); - _impl_.players_->Clear(); - } } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); @@ -4868,14 +4464,6 @@ ::uint8_t* PROTOBUF_NONNULL GameServer_Status::_InternalSerialize( target, stream); } - cached_has_bits = this_._impl_._has_bits_[0]; - // .agones.dev.sdk.GameServer.Status.PlayerStatus players = 4; - if ((cached_has_bits & 0x00000004u) != 0) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.players_, this_._impl_.players_->GetCachedSize(), target, - stream); - } - // map counters = 5; if (!this_._internal_counters().empty()) { using MapType = ::google::protobuf::Map; @@ -5002,7 +4590,7 @@ ::size_t GameServer_Status::ByteSizeLong() const { } } cached_has_bits = this_._impl_._has_bits_[0]; - if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000003u) != 0) { // string state = 1; if ((cached_has_bits & 0x00000001u) != 0) { if (!this_._internal_state().empty()) { @@ -5017,11 +4605,6 @@ ::size_t GameServer_Status::ByteSizeLong() const { this_._internal_address()); } } - // .agones.dev.sdk.GameServer.Status.PlayerStatus players = 4; - if ((cached_has_bits & 0x00000004u) != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.players_); - } } return this_.MaybeComputeUnknownFieldsSize(total_size, &this_._impl_._cached_size_); @@ -5030,7 +4613,6 @@ ::size_t GameServer_Status::ByteSizeLong() const { void GameServer_Status::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::google::protobuf::MessageLite& from_msg) { auto* const _this = static_cast(&to_msg); auto& from = static_cast(from_msg); - ::google::protobuf::Arena* arena = _this->GetArena(); // @@protoc_insertion_point(class_specific_merge_from_start:agones.dev.sdk.GameServer.Status) ABSL_DCHECK_NE(&from, _this); ::uint32_t cached_has_bits = 0; @@ -5043,7 +4625,7 @@ void GameServer_Status::MergeImpl(::google::protobuf::MessageLite& to_msg, const _this->_internal_mutable_addresses()->MergeFrom( from._internal_addresses()); cached_has_bits = from._impl_._has_bits_[0]; - if ((cached_has_bits & 0x00000007u) != 0) { + if ((cached_has_bits & 0x00000003u) != 0) { if ((cached_has_bits & 0x00000001u) != 0) { if (!from._internal_state().empty()) { _this->_internal_set_state(from._internal_state()); @@ -5062,14 +4644,6 @@ void GameServer_Status::MergeImpl(::google::protobuf::MessageLite& to_msg, const } } } - if ((cached_has_bits & 0x00000004u) != 0) { - ABSL_DCHECK(from._impl_.players_ != nullptr); - if (_this->_impl_.players_ == nullptr) { - _this->_impl_.players_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.players_); - } else { - _this->_impl_.players_->MergeFrom(*from._impl_.players_); - } - } } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>(from._internal_metadata_); @@ -5095,7 +4669,6 @@ void GameServer_Status::InternalSwap(GameServer_Status* PROTOBUF_RESTRICT PROTOB _impl_.addresses_.InternalSwap(&other->_impl_.addresses_); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.state_, &other->_impl_.state_, arena); ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.address_, &other->_impl_.address_, arena); - swap(_impl_.players_, other->_impl_.players_); } ::google::protobuf::Metadata GameServer_Status::GetMetadata() const { diff --git a/sdks/csharp/proto/sdk/alpha/alpha.proto b/sdks/csharp/proto/sdk/alpha/alpha.proto index 3d3dde9fb8..e8d2f6e107 100644 --- a/sdks/csharp/proto/sdk/alpha/alpha.proto +++ b/sdks/csharp/proto/sdk/alpha/alpha.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package agones.dev.sdk.alpha; option go_package = "./alpha"; -import "google/api/annotations.proto"; @@ -29,119 +28,5 @@ import "google/api/annotations.proto"; // SDK service to be used in the GameServer SDK to the Pod Sidecar. -service SDK { - // PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the - // list of connected playerIDs. - // - // If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of - // connected playerIDs will be left unchanged. - // - // An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for - // the server has been reached. The playerID will not be added to the list of playerIDs. - // - // Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count - // through the Kubernetes API, as indeterminate results will occur. - rpc PlayerConnect (PlayerID) returns (Bool) { - option (google.api.http) = { - post: "/alpha/player/connect" - body: "*" - }; - } +service SDK {} - // Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the - // playerID value exists within the list. - // - // If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list - // will be left unchanged. - // - // Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count - // through the Kubernetes API, as indeterminate results will occur. - rpc PlayerDisconnect (PlayerID) returns (Bool) { - option (google.api.http) = { - post: "/alpha/player/disconnect" - body: "*" - }; - } - - // Update the GameServer.Status.Players.Capacity value with a new capacity. - rpc SetPlayerCapacity (Count) returns (Empty) { - option (google.api.http) = { - put: "/alpha/player/capacity" - body: "*" - }; - } - - // Retrieves the current player capacity. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetPlayerCapacity (Empty) returns (Count) { - option (google.api.http) = { - get: "/alpha/player/capacity" - }; - } - - // Retrieves the current player count. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetPlayerCount (Empty) returns (Count) { - option (google.api.http) = { - get: "/alpha/player/count" - }; - } - - // Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. - rpc IsPlayerConnected (PlayerID) returns (Bool) { - option (google.api.http) = { - get: "/alpha/player/connected/{playerID}" - }; - } - - // Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetConnectedPlayers(Empty) returns (PlayerIDList) { - option (google.api.http) = { - get: "/alpha/player/connected" - }; - } -} - -// I am Empty -message Empty { -} - -// Store a count variable. -message Count { - int64 count = 1; -} - -// Store a boolean result -message Bool { - bool bool = 1; -} - -// The unique identifier for a given player. -message PlayerID { - string playerID = 1; -} - -// List of Player IDs -message PlayerIDList { - repeated string list = 1; -} diff --git a/sdks/csharp/proto/sdk/sdk.proto b/sdks/csharp/proto/sdk/sdk.proto index 22ab2489be..181d078d8d 100644 --- a/sdks/csharp/proto/sdk/sdk.proto +++ b/sdks/csharp/proto/sdk/sdk.proto @@ -148,6 +148,9 @@ message GameServer { } message Status { + reserved 4; + reserved "players"; + message Address { string type = 1; string address = 2; @@ -157,13 +160,6 @@ message GameServer { string name = 1; int32 port = 2; } - // [Stage:Alpha] - // [FeatureFlag:PlayerTracking] - message PlayerStatus { - int64 count = 1; - int64 capacity = 2; - repeated string ids = 3; - } // [Stage:Beta] // [FeatureFlag:CountsAndLists] @@ -184,10 +180,6 @@ message GameServer { repeated Address addresses = 7; repeated Port ports = 3; - // [Stage:Alpha] - // [FeatureFlag:PlayerTracking] - PlayerStatus players = 4; - // [Stage:Beta] // [FeatureFlag:CountsAndLists] map counters = 5; diff --git a/sdks/csharp/sdk/AgonesSDK.cs b/sdks/csharp/sdk/AgonesSDK.cs index 9f35de495d..60f0b18eb5 100644 --- a/sdks/csharp/sdk/AgonesSDK.cs +++ b/sdks/csharp/sdk/AgonesSDK.cs @@ -33,7 +33,6 @@ public sealed class AgonesSDK : IAgonesSDK public double RequestTimeoutSec { get; set; } internal SDK.SDKClient client; - internal readonly Alpha alpha; internal readonly Beta beta; internal readonly GrpcChannel channel; internal AsyncClientStreamingCall healthStream; @@ -81,19 +80,10 @@ public AgonesSDK( ); client = sdkClient ?? new SDK.SDKClient(channel); - alpha = new Alpha(channel, requestTimeoutSec, cancellationTokenSource, logger); beta = new Beta(channel, requestTimeoutSec, cancellationTokenSource, logger); } - /// - /// Alpha returns the Alpha SDK - /// - /// Agones alpha SDK - public IAgonesAlphaSDK Alpha() - { - return alpha; - } - + /// /// Beta returns the AlphBeta SDK /// diff --git a/sdks/csharp/sdk/Alpha.cs b/sdks/csharp/sdk/Alpha.cs deleted file mode 100644 index 7ab787fa60..0000000000 --- a/sdks/csharp/sdk/Alpha.cs +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. -using Agones.Dev.Sdk.Alpha; -using Grpc.Core; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Grpc.Net.Client; -using gProto = Google.Protobuf.WellKnownTypes; - -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Agones.Test")] -namespace Agones -{ - public sealed class Alpha : IAgonesAlphaSDK - { - - /// - /// The timeout for gRPC calls. - /// - public double RequestTimeoutSec { get; set; } - - internal SDK.SDKClient client; - internal readonly IClientStreamWriter healthStream; - internal readonly CancellationTokenSource cts; - internal readonly bool ownsCts; - internal CancellationToken ctoken; - - private readonly ILogger _logger; - private bool _disposed; - - public Alpha( - GrpcChannel channel, - double requestTimeoutSec = 15, - CancellationTokenSource cancellationTokenSource = null, - ILogger logger = null) - { - _logger = logger; - RequestTimeoutSec = requestTimeoutSec; - - if (cancellationTokenSource == null) - { - cts = new CancellationTokenSource(); - ownsCts = true; - } - else - { - cts = cancellationTokenSource; - ownsCts = false; - } - - ctoken = cts.Token; - client = new SDK.SDKClient(channel); - } - - - /// - /// This returns the last player capacity that was set through the SDK. - /// If the player capacity is set from outside the SDK, use SDK.GameServer() instead. - /// - /// Player capacity - public async Task GetPlayerCapacityAsync() - { - try - { - var count = await client.GetPlayerCapacityAsync(new Empty(), deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return count.Count_; - } - catch (RpcException ex) - { - LogError(ex, "Unable to invoke the GetPlayerCapacity."); - throw; - } - } - - /// - /// This changes the player capacity to a new value. - /// - /// gRPC Status of the request - public async Task SetPlayerCapacityAsync(long count) - { - try - { - await client.SetPlayerCapacityAsync(new Count() - { - Count_ = count - }, deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return new Status(StatusCode.OK, "SetPlayerCapacity request successful."); - } - catch (RpcException ex) - { - LogError(ex, "Unable to invoke the SetPlayerCapacity."); - return ex.Status; - } - - } - - /// - /// This function increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - /// Returns true and adds the playerID to the list of playerIDs if the playerIDs was not already in the list of connected playerIDs. - /// - /// True if the playerID was added to the list of playerIDs - public async Task PlayerConnectAsync(string id) - { - try - { - var result = await client.PlayerConnectAsync(new PlayerID() - { - PlayerID_ = id - }, deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return result.Bool_; - } - catch (RpcException ex) - { - LogError(ex, "Unable to invoke the PlayerConnect."); - throw; - } - } - - /// - /// This function decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - /// Will return true and remove the supplied playerID from the list of connected playerIDs if the playerID value exists within the list. - /// - /// True if the playerID was removed from the list of playerIDs - public async Task PlayerDisconnectAsync(string id) - { - try - { - var result = await client.PlayerDisconnectAsync(new PlayerID() - { - PlayerID_ = id - }, deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return result.Bool_; - } - catch (RpcException ex) - { - LogError(ex, "Unable to invoke the PlayerDisconnect."); - throw; - } - } - - /// - /// Returns the current player count. - /// - /// Player count - public async Task GetPlayerCountAsync() - { - try - { - var count = await client.GetPlayerCountAsync(new Empty(), deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return count.Count_; - } - catch (RpcException ex) - { - LogError(ex, "Unable to invoke the GetPlayerCount."); - throw; - } - } - - /// - /// This returns if the playerID is currently connected to the GameServer. - /// This is always accurate, even if the value hasn’t been updated to the GameServer status yet. - /// - /// True if the playerID is currently connected - public async Task IsPlayerConnectedAsync(string id) - { - try - { - var result = await client.IsPlayerConnectedAsync(new PlayerID() - { - PlayerID_ = id - }, deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return result.Bool_; - } - catch (RpcException ex) - { - LogError(ex, "Unable to invoke the IsPlayerConnected."); - throw; - } - } - - /// - /// This returns the list of the currently connected player ids. - /// This is always accurate, even if the value has not been updated to the Game Server status yet. - /// - /// The list of the currently connected player ids - public async Task> GetConnectedPlayersAsync() - { - try - { - var playerIDList = await client.GetConnectedPlayersAsync(new Empty(), deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return playerIDList.List.ToList(); - } - catch (RpcException ex) - { - LogError(ex, "Unable to invoke the GetConnectedPlayers."); - throw; - } - } - - public void Dispose() - { - if (_disposed) - { - return; - } - - cts.Cancel(); - - if (ownsCts) - { - cts.Dispose(); - } - - _disposed = true; - GC.SuppressFinalize(this); - } - - private void LogError(Exception ex, string message) - { - _logger?.LogError(ex, message); - } - } -} diff --git a/sdks/csharp/sdk/IAgonesAlphaSDK.cs b/sdks/csharp/sdk/IAgonesAlphaSDK.cs deleted file mode 100644 index 39ea71f18c..0000000000 --- a/sdks/csharp/sdk/IAgonesAlphaSDK.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Grpc.Core; - -namespace Agones -{ - public interface IAgonesAlphaSDK : IDisposable - { - Task GetPlayerCapacityAsync(); - Task SetPlayerCapacityAsync(long capacity); - Task PlayerConnectAsync(string id); - Task PlayerDisconnectAsync(string id); - Task GetPlayerCountAsync(); - Task IsPlayerConnectedAsync(string id); - Task> GetConnectedPlayersAsync(); - } -} diff --git a/sdks/csharp/sdk/IAgonesSDK.cs b/sdks/csharp/sdk/IAgonesSDK.cs index d302412285..55faf59fb4 100644 --- a/sdks/csharp/sdk/IAgonesSDK.cs +++ b/sdks/csharp/sdk/IAgonesSDK.cs @@ -30,7 +30,6 @@ public interface IAgonesSDK : IDisposable Task SetLabelAsync(string key, string value); Task SetAnnotationAsync(string key, string value); Task HealthAsync(); - IAgonesAlphaSDK Alpha(); IAgonesBetaSDK Beta(); } } \ No newline at end of file diff --git a/sdks/csharp/test/AgonesAlphaSDKClientTests.cs b/sdks/csharp/test/AgonesAlphaSDKClientTests.cs deleted file mode 100644 index 35597d2c86..0000000000 --- a/sdks/csharp/test/AgonesAlphaSDKClientTests.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -using Agones.Dev.Sdk.Alpha; -using Grpc.Core; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using System; -using Grpc.Net.Client; -using Microsoft.Extensions.Logging; -using gProto = Google.Protobuf.WellKnownTypes; - -namespace Agones.Tests -{ - [TestClass] - public class AgonesAlphaSDKClientTests - { - [TestMethod] - public async Task GetPlayerCapacity_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var expected = new Count() { Count_ = 1 }; - mockClient.Setup(m => m.GetPlayerCapacityAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns( - (Empty _, Metadata _, DateTime? _, CancellationToken _) => new AsyncUnaryCall(Task.FromResult(expected), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var result = await mockSdk.Alpha().GetPlayerCapacityAsync(); - Assert.AreEqual(expected.Count_, result); - } - - [TestMethod] - public async Task SetPlayerCapacity_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var expected = StatusCode.OK; - mockClient.Setup(m => m.SetPlayerCapacityAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns( - (Count _, Metadata _, DateTime? _, CancellationToken _) => new AsyncUnaryCall(Task.FromResult(new Empty()), Task.FromResult(new Metadata()), () => new Status(expected, ""), () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var result = await mockSdk.Alpha().SetPlayerCapacityAsync(1); - Assert.AreEqual(expected, result.StatusCode); - } - - [TestMethod] - public async Task PlayerConnect_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var expected = new Bool() { Bool_ = true }; - - mockClient.Setup(m => m.PlayerConnectAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns( - (PlayerID _, Metadata _, DateTime? _, CancellationToken _) => new AsyncUnaryCall(Task.FromResult(new Bool - { - Bool_ = true - }), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var result = await mockSdk.Alpha().PlayerConnectAsync("test"); - Assert.AreEqual(expected.Bool_, result); - } - - [TestMethod] - public async Task PlayerDisconnect_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var expected = new Bool() { Bool_ = true }; - - mockClient.Setup(m => m.PlayerDisconnectAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns( - (PlayerID _, Metadata _, DateTime? _, CancellationToken _) => new AsyncUnaryCall(Task.FromResult(new Bool - { - Bool_ = true - }), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var result = await mockSdk.Alpha().PlayerDisconnectAsync("test"); - Assert.AreEqual(expected.Bool_, result); - } - - [TestMethod] - public async Task GetPlayerCount_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var expected = new Count() { Count_ = 1 }; - mockClient.Setup(m => m.GetPlayerCountAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns( - (Empty _, Metadata _, DateTime? _, CancellationToken _) => new AsyncUnaryCall(Task.FromResult(expected), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var result = await mockSdk.Alpha().GetPlayerCountAsync(); - Assert.AreEqual(expected.Count_, result); - } - - [TestMethod] - public async Task IsPlayerConnected_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var expected = new Bool() { Bool_ = true }; - mockClient.Setup(m => m.IsPlayerConnectedAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns( - (PlayerID _, Metadata _, DateTime? _, CancellationToken _) => new AsyncUnaryCall(Task.FromResult(expected), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var result = await mockSdk.Alpha().IsPlayerConnectedAsync("test"); - Assert.AreEqual(expected.Bool_, result); - } - - [TestMethod] - public async Task GetConnectedPlayers_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var expected = new List { "player1", "player2" }; - var playerList = new PlayerIDList() { List = { expected } }; - mockClient.Setup(m => m.GetConnectedPlayersAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns( - (Empty _, Metadata _, DateTime? _, CancellationToken _) => new AsyncUnaryCall(Task.FromResult(playerList), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var result = await mockSdk.Alpha().GetConnectedPlayersAsync(); - CollectionAssert.AreEquivalent(expected, result); - } - - [TestMethod] - public void InstantiateWithParameters_OK() - { - var mockSdk = new AgonesSDK(); - //var mockChannel = new Channel(mockSdk.Host, mockSdk.Port, ChannelCredentials.Insecure); - var mockChannel = GrpcChannel.ForAddress($"http://{mockSdk.Host}:{mockSdk.Port}"); - ILogger mockLogger = new Mock().Object; - CancellationTokenSource mockCancellationTokenSource = new Mock().Object; - bool exceptionOccured = false; - try - { - new Alpha( - channel: mockChannel, - requestTimeoutSec: 15, - cancellationTokenSource: mockCancellationTokenSource, - logger: mockLogger - ); - } - catch - { - exceptionOccured = true; - } - - Assert.IsFalse(exceptionOccured); - } - } -} diff --git a/sdks/go/alpha.go b/sdks/go/alpha.go deleted file mode 100644 index 8ddb9a8bf8..0000000000 --- a/sdks/go/alpha.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -package sdk - -import ( - "context" - - "github.com/pkg/errors" - "google.golang.org/grpc" - - "agones.dev/agones/pkg/sdk/alpha" -) - -// Alpha is the struct for Alpha SDK functionality. -type Alpha struct { - client alpha.SDKClient -} - -// newAlpha creates a new Alpha SDK with the passed in connection. -func newAlpha(conn *grpc.ClientConn) *Alpha { - return &Alpha{ - client: alpha.NewSDKClient(conn), - } -} - -// GetPlayerCapacity gets the last player capacity that was set through the SDK. -// If the player capacity is set from outside the SDK, use SDK.GameServer() instead. -func (a *Alpha) GetPlayerCapacity() (int64, error) { - c, err := a.client.GetPlayerCapacity(context.Background(), &alpha.Empty{}) - return c.GetCount(), errors.Wrap(err, "could not get player capacity") -} - -// SetPlayerCapacity changes the player capacity to a new value. -func (a *Alpha) SetPlayerCapacity(capacity int64) error { - _, err := a.client.SetPlayerCapacity(context.Background(), &alpha.Count{Count: capacity}) - return errors.Wrap(err, "could not set player capacity") -} - -// PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to status.players.id. -// Will return true and add the playerID to the list of playerIDs if the playerIDs was not already in the -// list of connected playerIDs. -func (a *Alpha) PlayerConnect(id string) (bool, error) { - ok, err := a.client.PlayerConnect(context.Background(), &alpha.PlayerID{PlayerID: id}) - return ok.GetBool(), errors.Wrap(err, "could not register connected player") -} - -// PlayerDisconnect Decreases the SDK’s stored player count by one, and removes the playerID from status.players.id. -// Will return true and remove the supplied playerID from the list of connected playerIDs if the -// playerID value exists within the list. -func (a *Alpha) PlayerDisconnect(id string) (bool, error) { - ok, err := a.client.PlayerDisconnect(context.Background(), &alpha.PlayerID{PlayerID: id}) - return ok.GetBool(), errors.Wrap(err, "could not register disconnected player") -} - -// GetPlayerCount returns the current player count. -func (a *Alpha) GetPlayerCount() (int64, error) { - count, err := a.client.GetPlayerCount(context.Background(), &alpha.Empty{}) - return count.GetCount(), errors.Wrap(err, "could not get player count") -} - -// IsPlayerConnected returns if the playerID is currently connected to the GameServer. -// This is always accurate, even if the value hasn’t been updated to the GameServer status yet. -func (a *Alpha) IsPlayerConnected(id string) (bool, error) { - ok, err := a.client.IsPlayerConnected(context.Background(), &alpha.PlayerID{PlayerID: id}) - return ok.GetBool(), errors.Wrap(err, "could not get if player is connected") -} - -// GetConnectedPlayers returns the list of the currently connected player ids. -// This is always accurate, even if the value hasn’t been updated to the GameServer status yet. -func (a *Alpha) GetConnectedPlayers() ([]string, error) { - list, err := a.client.GetConnectedPlayers(context.Background(), &alpha.Empty{}) - return list.GetList(), errors.Wrap(err, "could not list connected players") -} diff --git a/sdks/go/alpha_test.go b/sdks/go/alpha_test.go deleted file mode 100644 index a910fab826..0000000000 --- a/sdks/go/alpha_test.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -package sdk - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "google.golang.org/grpc" - - "agones.dev/agones/pkg/sdk/alpha" -) - -func TestAlphaGetAndSetPlayerCapacity(t *testing.T) { - mock := &alphaMock{} - a := Alpha{ - client: mock, - } - - err := a.SetPlayerCapacity(15) - assert.NoError(t, err) - assert.Equal(t, int64(15), mock.capacity) - - capacity, err := a.GetPlayerCapacity() - assert.NoError(t, err) - assert.Equal(t, int64(15), capacity) - - playerID := "one" - ok, err := a.PlayerConnect(playerID) - assert.NoError(t, err) - assert.True(t, ok) - assert.Equal(t, playerID, mock.playerConnected) - - count, err := a.GetPlayerCount() - assert.NoError(t, err) - assert.Equal(t, int64(1), count) - - ok, err = a.PlayerDisconnect(playerID) - assert.NoError(t, err) - assert.True(t, ok) - assert.Equal(t, playerID, mock.playerDisconnected) - - // Put the player back in. - ok, err = a.PlayerConnect(playerID) - assert.NoError(t, err) - assert.True(t, ok) - assert.Equal(t, int64(1), count) - - ok, err = a.IsPlayerConnected(playerID) - assert.NoError(t, err) - assert.True(t, ok, "Player should be connected") - - ok, err = a.IsPlayerConnected("false") - assert.NoError(t, err) - assert.False(t, ok, "Player should not be connected") - - list, err := a.GetConnectedPlayers() - assert.NoError(t, err) - assert.Equal(t, []string{playerID}, list) -} - -type alphaMock struct { - capacity int64 - playerCount int64 - playerConnected string - playerDisconnected string -} - -func (a *alphaMock) PlayerConnect(_ context.Context, id *alpha.PlayerID, _ ...grpc.CallOption) (*alpha.Bool, error) { - a.playerConnected = id.PlayerID - a.playerCount++ - return &alpha.Bool{Bool: true}, nil -} - -func (a *alphaMock) PlayerDisconnect(_ context.Context, id *alpha.PlayerID, _ ...grpc.CallOption) (*alpha.Bool, error) { - a.playerDisconnected = id.PlayerID - a.playerCount-- - return &alpha.Bool{Bool: true}, nil -} - -func (a *alphaMock) IsPlayerConnected(_ context.Context, id *alpha.PlayerID, _ ...grpc.CallOption) (*alpha.Bool, error) { - return &alpha.Bool{Bool: id.PlayerID == a.playerConnected}, nil -} - -func (a *alphaMock) GetConnectedPlayers(_ context.Context, _ *alpha.Empty, _ ...grpc.CallOption) (*alpha.PlayerIDList, error) { - return &alpha.PlayerIDList{List: []string{a.playerConnected}}, nil -} - -func (a *alphaMock) SetPlayerCapacity(_ context.Context, in *alpha.Count, _ ...grpc.CallOption) (*alpha.Empty, error) { - a.capacity = in.Count - return &alpha.Empty{}, nil -} - -func (a *alphaMock) GetPlayerCapacity(_ context.Context, _ *alpha.Empty, _ ...grpc.CallOption) (*alpha.Count, error) { - return &alpha.Count{Count: a.capacity}, nil -} - -func (a *alphaMock) GetPlayerCount(_ context.Context, _ *alpha.Empty, _ ...grpc.CallOption) (*alpha.Count, error) { - return &alpha.Count{Count: a.playerCount}, nil -} diff --git a/sdks/go/sdk.go b/sdks/go/sdk.go index 61185cef37..e49cf53e8a 100644 --- a/sdks/go/sdk.go +++ b/sdks/go/sdk.go @@ -39,7 +39,6 @@ type SDK struct { client sdk.SDKClient ctx context.Context health sdk.SDK_HealthClient - alpha *Alpha beta *Beta } @@ -79,16 +78,10 @@ func NewSDK() (*SDK, error) { } s.client = sdk.NewSDKClient(conn) s.health, err = s.client.Health(s.ctx) - s.alpha = newAlpha(conn) s.beta = newBeta(conn) return s, errors.Wrap(err, "could not set up health check") } -// Alpha returns the Alpha SDK. -func (s *SDK) Alpha() *Alpha { - return s.alpha -} - // Beta returns the Beta SDK. func (s *SDK) Beta() *Beta { return s.beta diff --git a/sdks/nodejs/lib/alpha/alpha_grpc_pb.js b/sdks/nodejs/lib/alpha/alpha_grpc_pb.js index 83119ae281..0cf6622beb 100644 --- a/sdks/nodejs/lib/alpha/alpha_grpc_pb.js +++ b/sdks/nodejs/lib/alpha/alpha_grpc_pb.js @@ -31,190 +31,10 @@ // limitations under the License. // 'use strict'; -var alpha_pb = require('./alpha_pb.js'); -var google_api_annotations_pb = require('./google/api/annotations_pb.js'); var protoc$gen$openapiv2_options_annotations_pb = require('./protoc-gen-openapiv2/options/annotations_pb.js'); -function serialize_agones_dev_sdk_alpha_Bool(arg) { - if (!(arg instanceof alpha_pb.Bool)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.Bool'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_Bool(buffer_arg) { - return alpha_pb.Bool.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_Count(arg) { - if (!(arg instanceof alpha_pb.Count)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.Count'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_Count(buffer_arg) { - return alpha_pb.Count.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_Empty(arg) { - if (!(arg instanceof alpha_pb.Empty)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.Empty'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_Empty(buffer_arg) { - return alpha_pb.Empty.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_PlayerID(arg) { - if (!(arg instanceof alpha_pb.PlayerID)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.PlayerID'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_PlayerID(buffer_arg) { - return alpha_pb.PlayerID.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_PlayerIDList(arg) { - if (!(arg instanceof alpha_pb.PlayerIDList)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.PlayerIDList'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_PlayerIDList(buffer_arg) { - return alpha_pb.PlayerIDList.deserializeBinary(new Uint8Array(buffer_arg)); -} - // SDK service to be used in the GameServer SDK to the Pod Sidecar. var SDKService = exports['agones.dev.sdk.alpha.SDK'] = { - // PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. -// -// GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, -// unless there is already an update pending, in which case the update joins that batch operation. -// -// PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the -// list of connected playerIDs. -// -// If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of -// connected playerIDs will be left unchanged. -// -// An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for -// the server has been reached. The playerID will not be added to the list of playerIDs. -// -// Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count -// through the Kubernetes API, as indeterminate results will occur. -playerConnect: { - path: '/agones.dev.sdk.alpha.SDK/PlayerConnect', - requestStream: false, - responseStream: false, - requestType: alpha_pb.PlayerID, - responseType: alpha_pb.Bool, - requestSerialize: serialize_agones_dev_sdk_alpha_PlayerID, - requestDeserialize: deserialize_agones_dev_sdk_alpha_PlayerID, - responseSerialize: serialize_agones_dev_sdk_alpha_Bool, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Bool, - }, - // Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. -// -// GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, -// unless there is already an update pending, in which case the update joins that batch operation. -// -// PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the -// playerID value exists within the list. -// -// If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list -// will be left unchanged. -// -// Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count -// through the Kubernetes API, as indeterminate results will occur. -playerDisconnect: { - path: '/agones.dev.sdk.alpha.SDK/PlayerDisconnect', - requestStream: false, - responseStream: false, - requestType: alpha_pb.PlayerID, - responseType: alpha_pb.Bool, - requestSerialize: serialize_agones_dev_sdk_alpha_PlayerID, - requestDeserialize: deserialize_agones_dev_sdk_alpha_PlayerID, - responseSerialize: serialize_agones_dev_sdk_alpha_Bool, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Bool, - }, - // Update the GameServer.Status.Players.Capacity value with a new capacity. -setPlayerCapacity: { - path: '/agones.dev.sdk.alpha.SDK/SetPlayerCapacity', - requestStream: false, - responseStream: false, - requestType: alpha_pb.Count, - responseType: alpha_pb.Empty, - requestSerialize: serialize_agones_dev_sdk_alpha_Count, - requestDeserialize: deserialize_agones_dev_sdk_alpha_Count, - responseSerialize: serialize_agones_dev_sdk_alpha_Empty, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Empty, - }, - // Retrieves the current player capacity. This is always accurate from what has been set through this SDK, -// even if the value has yet to be updated on the GameServer status resource. -// -// If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. -getPlayerCapacity: { - path: '/agones.dev.sdk.alpha.SDK/GetPlayerCapacity', - requestStream: false, - responseStream: false, - requestType: alpha_pb.Empty, - responseType: alpha_pb.Count, - requestSerialize: serialize_agones_dev_sdk_alpha_Empty, - requestDeserialize: deserialize_agones_dev_sdk_alpha_Empty, - responseSerialize: serialize_agones_dev_sdk_alpha_Count, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Count, - }, - // Retrieves the current player count. This is always accurate from what has been set through this SDK, -// even if the value has yet to be updated on the GameServer status resource. -// -// If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. -getPlayerCount: { - path: '/agones.dev.sdk.alpha.SDK/GetPlayerCount', - requestStream: false, - responseStream: false, - requestType: alpha_pb.Empty, - responseType: alpha_pb.Count, - requestSerialize: serialize_agones_dev_sdk_alpha_Empty, - requestDeserialize: deserialize_agones_dev_sdk_alpha_Empty, - responseSerialize: serialize_agones_dev_sdk_alpha_Count, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Count, - }, - // Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, -// even if the value has yet to be updated on the GameServer status resource. -// -// If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. -isPlayerConnected: { - path: '/agones.dev.sdk.alpha.SDK/IsPlayerConnected', - requestStream: false, - responseStream: false, - requestType: alpha_pb.PlayerID, - responseType: alpha_pb.Bool, - requestSerialize: serialize_agones_dev_sdk_alpha_PlayerID, - requestDeserialize: deserialize_agones_dev_sdk_alpha_PlayerID, - responseSerialize: serialize_agones_dev_sdk_alpha_Bool, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Bool, - }, - // Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, -// even if the value has yet to be updated on the GameServer status resource. -// -// If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. -getConnectedPlayers: { - path: '/agones.dev.sdk.alpha.SDK/GetConnectedPlayers', - requestStream: false, - responseStream: false, - requestType: alpha_pb.Empty, - responseType: alpha_pb.PlayerIDList, - requestSerialize: serialize_agones_dev_sdk_alpha_Empty, - requestDeserialize: deserialize_agones_dev_sdk_alpha_Empty, - responseSerialize: serialize_agones_dev_sdk_alpha_PlayerIDList, - responseDeserialize: deserialize_agones_dev_sdk_alpha_PlayerIDList, - }, }; diff --git a/sdks/nodejs/lib/alpha/alpha_pb.js b/sdks/nodejs/lib/alpha/alpha_pb.js index efae115810..64245f1d10 100644 --- a/sdks/nodejs/lib/alpha/alpha_pb.js +++ b/sdks/nodejs/lib/alpha/alpha_pb.js @@ -30,765 +30,5 @@ var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); -var google_api_annotations_pb = require('./google/api/annotations_pb.js'); -goog.object.extend(proto, google_api_annotations_pb); var protoc$gen$openapiv2_options_annotations_pb = require('./protoc-gen-openapiv2/options/annotations_pb.js'); goog.object.extend(proto, protoc$gen$openapiv2_options_annotations_pb); -goog.exportSymbol('proto.agones.dev.sdk.alpha.Bool', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.Count', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.Empty', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.PlayerID', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.PlayerIDList', null, global); -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.Empty = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.Empty, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.Empty.displayName = 'proto.agones.dev.sdk.alpha.Empty'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.Count = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.Count, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.Count.displayName = 'proto.agones.dev.sdk.alpha.Count'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.Bool = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.Bool, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.Bool.displayName = 'proto.agones.dev.sdk.alpha.Bool'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.PlayerID = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.PlayerID, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.PlayerID.displayName = 'proto.agones.dev.sdk.alpha.PlayerID'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.PlayerIDList = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.agones.dev.sdk.alpha.PlayerIDList.repeatedFields_, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.PlayerIDList, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.PlayerIDList.displayName = 'proto.agones.dev.sdk.alpha.PlayerIDList'; -} - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.Empty.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.Empty.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.Empty} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Empty.toObject = function(includeInstance, msg) { - var f, obj = { - - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.Empty} - */ -proto.agones.dev.sdk.alpha.Empty.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.Empty; - return proto.agones.dev.sdk.alpha.Empty.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.Empty} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.Empty} - */ -proto.agones.dev.sdk.alpha.Empty.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.Empty.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.Empty.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.Empty} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Empty.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.Count.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.Count.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.Count} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Count.toObject = function(includeInstance, msg) { - var f, obj = { - count: jspb.Message.getFieldWithDefault(msg, 1, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.Count} - */ -proto.agones.dev.sdk.alpha.Count.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.Count; - return proto.agones.dev.sdk.alpha.Count.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.Count} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.Count} - */ -proto.agones.dev.sdk.alpha.Count.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCount(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.Count.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.Count.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.Count} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Count.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getCount(); - if (f !== 0) { - writer.writeInt64( - 1, - f - ); - } -}; - - -/** - * optional int64 count = 1; - * @return {number} - */ -proto.agones.dev.sdk.alpha.Count.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.agones.dev.sdk.alpha.Count} returns this - */ -proto.agones.dev.sdk.alpha.Count.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.Bool.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.Bool.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.Bool} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Bool.toObject = function(includeInstance, msg) { - var f, obj = { - bool: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.Bool} - */ -proto.agones.dev.sdk.alpha.Bool.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.Bool; - return proto.agones.dev.sdk.alpha.Bool.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.Bool} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.Bool} - */ -proto.agones.dev.sdk.alpha.Bool.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setBool(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.Bool.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.Bool.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.Bool} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Bool.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getBool(); - if (f) { - writer.writeBool( - 1, - f - ); - } -}; - - -/** - * optional bool bool = 1; - * @return {boolean} - */ -proto.agones.dev.sdk.alpha.Bool.prototype.getBool = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.agones.dev.sdk.alpha.Bool} returns this - */ -proto.agones.dev.sdk.alpha.Bool.prototype.setBool = function(value) { - return jspb.Message.setProto3BooleanField(this, 1, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.PlayerID.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.PlayerID.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.PlayerID} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.PlayerID.toObject = function(includeInstance, msg) { - var f, obj = { - playerid: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.PlayerID} - */ -proto.agones.dev.sdk.alpha.PlayerID.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.PlayerID; - return proto.agones.dev.sdk.alpha.PlayerID.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.PlayerID} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.PlayerID} - */ -proto.agones.dev.sdk.alpha.PlayerID.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setPlayerid(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.PlayerID.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.PlayerID.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.PlayerID} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.PlayerID.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getPlayerid(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string playerID = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.PlayerID.prototype.getPlayerid = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.PlayerID} returns this - */ -proto.agones.dev.sdk.alpha.PlayerID.prototype.setPlayerid = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.agones.dev.sdk.alpha.PlayerIDList.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.PlayerIDList.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.PlayerIDList.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.PlayerIDList} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.PlayerIDList.toObject = function(includeInstance, msg) { - var f, obj = { - listList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.PlayerIDList} - */ -proto.agones.dev.sdk.alpha.PlayerIDList.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.PlayerIDList; - return proto.agones.dev.sdk.alpha.PlayerIDList.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.PlayerIDList} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.PlayerIDList} - */ -proto.agones.dev.sdk.alpha.PlayerIDList.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.addList(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.PlayerIDList.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.PlayerIDList.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.PlayerIDList} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.PlayerIDList.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getListList(); - if (f.length > 0) { - writer.writeRepeatedString( - 1, - f - ); - } -}; - - -/** - * repeated string list = 1; - * @return {!Array} - */ -proto.agones.dev.sdk.alpha.PlayerIDList.prototype.getListList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.agones.dev.sdk.alpha.PlayerIDList} returns this - */ -proto.agones.dev.sdk.alpha.PlayerIDList.prototype.setListList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.agones.dev.sdk.alpha.PlayerIDList} returns this - */ -proto.agones.dev.sdk.alpha.PlayerIDList.prototype.addList = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.agones.dev.sdk.alpha.PlayerIDList} returns this - */ -proto.agones.dev.sdk.alpha.PlayerIDList.prototype.clearListList = function() { - return this.setListList([]); -}; - - -goog.object.extend(exports, proto.agones.dev.sdk.alpha); diff --git a/sdks/nodejs/lib/sdk_pb.js b/sdks/nodejs/lib/sdk_pb.js index f82047162f..d4df4bb514 100644 --- a/sdks/nodejs/lib/sdk_pb.js +++ b/sdks/nodejs/lib/sdk_pb.js @@ -44,7 +44,6 @@ goog.exportSymbol('proto.agones.dev.sdk.GameServer.Status', null, global); goog.exportSymbol('proto.agones.dev.sdk.GameServer.Status.Address', null, global); goog.exportSymbol('proto.agones.dev.sdk.GameServer.Status.CounterStatus', null, global); goog.exportSymbol('proto.agones.dev.sdk.GameServer.Status.ListStatus', null, global); -goog.exportSymbol('proto.agones.dev.sdk.GameServer.Status.PlayerStatus', null, global); goog.exportSymbol('proto.agones.dev.sdk.GameServer.Status.Port', null, global); goog.exportSymbol('proto.agones.dev.sdk.KeyValue', null, global); /** @@ -257,27 +256,6 @@ if (goog.DEBUG && !COMPILED) { */ proto.agones.dev.sdk.GameServer.Status.Port.displayName = 'proto.agones.dev.sdk.GameServer.Status.Port'; } -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.agones.dev.sdk.GameServer.Status.PlayerStatus.repeatedFields_, null); -}; -goog.inherits(proto.agones.dev.sdk.GameServer.Status.PlayerStatus, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.GameServer.Status.PlayerStatus.displayName = 'proto.agones.dev.sdk.GameServer.Status.PlayerStatus'; -} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1645,7 +1623,6 @@ proto.agones.dev.sdk.GameServer.Status.toObject = function(includeInstance, msg) proto.agones.dev.sdk.GameServer.Status.Address.toObject, includeInstance), portsList: jspb.Message.toObjectList(msg.getPortsList(), proto.agones.dev.sdk.GameServer.Status.Port.toObject, includeInstance), - players: (f = msg.getPlayers()) && proto.agones.dev.sdk.GameServer.Status.PlayerStatus.toObject(includeInstance, f), countersMap: (f = msg.getCountersMap()) ? f.toObject(includeInstance, proto.agones.dev.sdk.GameServer.Status.CounterStatus.toObject) : [], listsMap: (f = msg.getListsMap()) ? f.toObject(includeInstance, proto.agones.dev.sdk.GameServer.Status.ListStatus.toObject) : [] }; @@ -1702,11 +1679,6 @@ proto.agones.dev.sdk.GameServer.Status.deserializeBinaryFromReader = function(ms reader.readMessage(value,proto.agones.dev.sdk.GameServer.Status.Port.deserializeBinaryFromReader); msg.addPorts(value); break; - case 4: - var value = new proto.agones.dev.sdk.GameServer.Status.PlayerStatus; - reader.readMessage(value,proto.agones.dev.sdk.GameServer.Status.PlayerStatus.deserializeBinaryFromReader); - msg.setPlayers(value); - break; case 5: var value = msg.getCountersMap(); reader.readMessage(value, function(message, reader) { @@ -1778,14 +1750,6 @@ proto.agones.dev.sdk.GameServer.Status.serializeBinaryToWriter = function(messag proto.agones.dev.sdk.GameServer.Status.Port.serializeBinaryToWriter ); } - f = message.getPlayers(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.agones.dev.sdk.GameServer.Status.PlayerStatus.serializeBinaryToWriter - ); - } f = message.getCountersMap(true); if (f && f.getLength() > 0) { f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.agones.dev.sdk.GameServer.Status.CounterStatus.serializeBinaryToWriter); @@ -2118,222 +2082,6 @@ proto.agones.dev.sdk.GameServer.Status.Port.prototype.setPort = function(value) -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.repeatedFields_ = [3]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.GameServer.Status.PlayerStatus.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.toObject = function(includeInstance, msg) { - var f, obj = { - count: jspb.Message.getFieldWithDefault(msg, 1, 0), - capacity: jspb.Message.getFieldWithDefault(msg, 2, 0), - idsList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.GameServer.Status.PlayerStatus; - return proto.agones.dev.sdk.GameServer.Status.PlayerStatus.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCount(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCapacity(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.addIds(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.GameServer.Status.PlayerStatus.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getCount(); - if (f !== 0) { - writer.writeInt64( - 1, - f - ); - } - f = message.getCapacity(); - if (f !== 0) { - writer.writeInt64( - 2, - f - ); - } - f = message.getIdsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 3, - f - ); - } -}; - - -/** - * optional int64 count = 1; - * @return {number} - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} returns this - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional int64 capacity = 2; - * @return {number} - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.getCapacity = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} returns this - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.setCapacity = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * repeated string ids = 3; - * @return {!Array} - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.getIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); -}; - - -/** - * @param {!Array} value - * @return {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} returns this - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.setIdsList = function(value) { - return jspb.Message.setField(this, 3, value || []); -}; - - -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} returns this - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.addIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.agones.dev.sdk.GameServer.Status.PlayerStatus} returns this - */ -proto.agones.dev.sdk.GameServer.Status.PlayerStatus.prototype.clearIdsList = function() { - return this.setIdsList([]); -}; - - - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2791,43 +2539,6 @@ proto.agones.dev.sdk.GameServer.Status.prototype.clearPortsList = function() { }; -/** - * optional PlayerStatus players = 4; - * @return {?proto.agones.dev.sdk.GameServer.Status.PlayerStatus} - */ -proto.agones.dev.sdk.GameServer.Status.prototype.getPlayers = function() { - return /** @type{?proto.agones.dev.sdk.GameServer.Status.PlayerStatus} */ ( - jspb.Message.getWrapperField(this, proto.agones.dev.sdk.GameServer.Status.PlayerStatus, 4)); -}; - - -/** - * @param {?proto.agones.dev.sdk.GameServer.Status.PlayerStatus|undefined} value - * @return {!proto.agones.dev.sdk.GameServer.Status} returns this -*/ -proto.agones.dev.sdk.GameServer.Status.prototype.setPlayers = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.agones.dev.sdk.GameServer.Status} returns this - */ -proto.agones.dev.sdk.GameServer.Status.prototype.clearPlayers = function() { - return this.setPlayers(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.agones.dev.sdk.GameServer.Status.prototype.hasPlayers = function() { - return jspb.Message.getField(this, 4) != null; -}; - - /** * map counters = 5; * @param {boolean=} opt_noLazyCreate Do not create the map if diff --git a/sdks/nodejs/spec/agonesSDK.spec.js b/sdks/nodejs/spec/agonesSDK.spec.js index a81181f632..b284cde459 100644 --- a/sdks/nodejs/spec/agonesSDK.spec.js +++ b/sdks/nodejs/spec/agonesSDK.spec.js @@ -19,7 +19,6 @@ const grpc = require("@grpc/grpc-js"); const messages = require("../lib/sdk_pb"); const AgonesSDK = require("../src/agonesSDK"); -const Alpha = require("../src/alpha"); describe("AgonesSDK", () => { let agonesSDK; @@ -472,10 +471,4 @@ describe("AgonesSDK", () => { } }); }); - - describe("alpha", () => { - it("returns the alpha features class", () => { - expect(agonesSDK.alpha).toBeInstanceOf(Alpha); - }); - }); }); diff --git a/sdks/nodejs/spec/alphaAgonesSDK.spec.js b/sdks/nodejs/spec/alphaAgonesSDK.spec.js deleted file mode 100644 index d3f243fa16..0000000000 --- a/sdks/nodejs/spec/alphaAgonesSDK.spec.js +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -const grpc = require("@grpc/grpc-js"); - -const messages = require("../lib/alpha/alpha_pb"); -const Alpha = require("../src/alpha"); - -describe("Alpha", () => { - let alpha; - - beforeEach(() => { - const address = "localhost:9357"; - const credentials = grpc.credentials.createInsecure(); - alpha = new Alpha(address, credentials); - }); - - describe("playerConnect", () => { - it("calls the server and handles success when the player is not connected", async () => { - spyOn(alpha.client, "playerConnect").and.callFake( - (_request, callback) => { - const result = new messages.Bool(); - result.setBool(true); - callback(undefined, result); - }, - ); - - const result = await alpha.playerConnect("playerID"); - expect(alpha.client.playerConnect).toHaveBeenCalled(); - expect(result).toEqual(true); - }); - - it("calls the server and handles success when the player is already connected", async () => { - spyOn(alpha.client, "playerConnect").and.callFake( - (_request, callback) => { - const result = new messages.Bool(); - result.setBool(false); - callback(undefined, result); - }, - ); - - const result = await alpha.playerConnect("playerID"); - expect(alpha.client.playerConnect).toHaveBeenCalled(); - expect(result).toEqual(false); - }); - - it("calls the server and handles failure", async () => { - spyOn(alpha.client, "playerConnect").and.callFake( - (_request, callback) => { - callback("error", undefined); - }, - ); - try { - await alpha.playerConnect("playerID"); - fail(); - } catch (error) { - expect(alpha.client.playerConnect).toHaveBeenCalled(); - expect(error).toEqual("error"); - } - }); - }); - - describe("playerDisconnect", () => { - it("calls the server and handles success when the player is connected", async () => { - spyOn(alpha.client, "playerDisconnect").and.callFake( - (_request, callback) => { - const result = new messages.Bool(); - result.setBool(true); - callback(undefined, result); - }, - ); - - const result = await alpha.playerDisconnect("playerID"); - expect(alpha.client.playerDisconnect).toHaveBeenCalled(); - expect(result).toEqual(true); - }); - - it("calls the server and handles success when the player is not connected", async () => { - spyOn(alpha.client, "playerDisconnect").and.callFake( - (_request, callback) => { - const result = new messages.Bool(); - result.setBool(false); - callback(undefined, result); - }, - ); - - const result = await alpha.playerDisconnect("playerID"); - expect(alpha.client.playerDisconnect).toHaveBeenCalled(); - expect(result).toEqual(false); - }); - - it("calls the server and handles failure", async () => { - spyOn(alpha.client, "playerDisconnect").and.callFake( - (_request, callback) => { - callback("error", undefined); - }, - ); - try { - await alpha.playerDisconnect("playerID"); - fail(); - } catch (error) { - expect(alpha.client.playerDisconnect).toHaveBeenCalled(); - expect(error).toEqual("error"); - } - }); - }); - - describe("setPlayerCapacity", () => { - it("passes arguments to the server and handles success", async () => { - spyOn(alpha.client, "setPlayerCapacity").and.callFake( - (_request, callback) => { - const result = new messages.Empty(); - callback(undefined, result); - }, - ); - - const result = await alpha.setPlayerCapacity(64); - expect(result).toEqual({}); - expect(alpha.client.setPlayerCapacity).toHaveBeenCalled(); - const request = alpha.client.setPlayerCapacity.calls.argsFor(0)[0]; - expect(request.getCount()).toEqual(64); - }); - - it("calls the server and handles failure", async () => { - spyOn(alpha.client, "setPlayerCapacity").and.callFake( - (_request, callback) => { - callback("error", undefined); - }, - ); - try { - await alpha.setPlayerCapacity(64); - fail(); - } catch (error) { - expect(alpha.client.setPlayerCapacity).toHaveBeenCalled(); - expect(error).toEqual("error"); - } - }); - }); - - describe("getPlayerCapacity", () => { - it("calls the server and handles the response", async () => { - spyOn(alpha.client, "getPlayerCapacity").and.callFake( - (_request, callback) => { - const capacity = new messages.Count(); - capacity.setCount(64); - callback(undefined, capacity); - }, - ); - - const capacity = await alpha.getPlayerCapacity(); - expect(alpha.client.getPlayerCapacity).toHaveBeenCalled(); - expect(capacity).toEqual(64); - }); - - it("calls the server and handles failure", async () => { - spyOn(alpha.client, "getPlayerCapacity").and.callFake( - (_request, callback) => { - callback("error", undefined); - }, - ); - try { - await alpha.getPlayerCapacity(); - fail(); - } catch (error) { - expect(alpha.client.getPlayerCapacity).toHaveBeenCalled(); - expect(error).toEqual("error"); - } - }); - }); - - describe("getPlayerCount", () => { - it("calls the server and handles the response", async () => { - spyOn(alpha.client, "getPlayerCount").and.callFake( - (_request, callback) => { - const capacity = new messages.Count(); - capacity.setCount(16); - callback(undefined, capacity); - }, - ); - - const capacity = await alpha.getPlayerCount(); - expect(alpha.client.getPlayerCount).toHaveBeenCalled(); - expect(capacity).toEqual(16); - }); - - it("calls the server and handles failure", async () => { - spyOn(alpha.client, "getPlayerCount").and.callFake( - (_request, callback) => { - callback("error", undefined); - }, - ); - try { - await alpha.getPlayerCount(); - fail(); - } catch (error) { - expect(alpha.client.getPlayerCount).toHaveBeenCalled(); - expect(error).toEqual("error"); - } - }); - }); - - describe("isPlayerConnected", () => { - it("calls the server and handles success when the player is connected", async () => { - spyOn(alpha.client, "isPlayerConnected").and.callFake( - (_request, callback) => { - const result = new messages.Bool(); - result.setBool(true); - callback(undefined, result); - }, - ); - - const result = await alpha.isPlayerConnected("playerID"); - expect(alpha.client.isPlayerConnected).toHaveBeenCalled(); - expect(result).toEqual(true); - }); - - it("calls the server and handles success when the player is not connected", async () => { - spyOn(alpha.client, "isPlayerConnected").and.callFake( - (_request, callback) => { - const result = new messages.Bool(); - result.setBool(false); - callback(undefined, result); - }, - ); - - const result = await alpha.isPlayerConnected("playerID"); - expect(alpha.client.isPlayerConnected).toHaveBeenCalled(); - expect(result).toEqual(false); - }); - - it("calls the server and handles failure", async () => { - spyOn(alpha.client, "isPlayerConnected").and.callFake( - (_request, callback) => { - callback("error", undefined); - }, - ); - try { - await alpha.isPlayerConnected("playerID"); - fail(); - } catch (error) { - expect(alpha.client.isPlayerConnected).toHaveBeenCalled(); - expect(error).toEqual("error"); - } - }); - }); - - describe("getConnectedPlayers", () => { - it("calls the server and handles the response", async () => { - spyOn(alpha.client, "getConnectedPlayers").and.callFake( - (_request, callback) => { - const connectedPlayers = new messages.PlayerIDList(); - connectedPlayers.setListList(["firstPlayerID", "secondPlayerID"]); - callback(undefined, connectedPlayers); - }, - ); - - const connectedPlayers = await alpha.getConnectedPlayers(); - expect(alpha.client.getConnectedPlayers).toHaveBeenCalled(); - expect(connectedPlayers).toEqual(["firstPlayerID", "secondPlayerID"]); - }); - - it("calls the server and handles failure", async () => { - spyOn(alpha.client, "getConnectedPlayers").and.callFake( - (_request, callback) => { - callback("error", undefined); - }, - ); - try { - await alpha.getConnectedPlayers(); - fail(); - } catch (error) { - expect(alpha.client.getConnectedPlayers).toHaveBeenCalled(); - expect(error).toEqual("error"); - } - }); - }); -}); diff --git a/sdks/nodejs/src/agonesSDK.d.ts b/sdks/nodejs/src/agonesSDK.d.ts index e0a620eb2f..c640914600 100644 --- a/sdks/nodejs/src/agonesSDK.d.ts +++ b/sdks/nodejs/src/agonesSDK.d.ts @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Alpha from "./alpha"; type Seconds = number; @@ -56,8 +55,6 @@ type GameServer = { export declare class AgonesSDK { constructor(); - alpha: Alpha; - get port(): string; connect(): Promise; diff --git a/sdks/nodejs/src/agonesSDK.js b/sdks/nodejs/src/agonesSDK.js index 23743b4153..83dae16e6f 100644 --- a/sdks/nodejs/src/agonesSDK.js +++ b/sdks/nodejs/src/agonesSDK.js @@ -14,7 +14,6 @@ const grpc = require("@grpc/grpc-js"); -const Alpha = require("./alpha"); const Beta = require("./beta"); const messages = require("../lib/sdk_pb"); @@ -28,7 +27,6 @@ class AgonesSDK { this.client = new services.agones.dev.sdk.SDK(address, credentials); this.healthStream = undefined; this.streams = []; - this.alpha = new Alpha(address, credentials); this.beta = new Beta(address, credentials); } diff --git a/sdks/nodejs/src/alpha.d.ts b/sdks/nodejs/src/alpha.d.ts deleted file mode 100644 index e22627eb7c..0000000000 --- a/sdks/nodejs/src/alpha.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -type PlayerId = string; - -declare class Alpha { - playerConnect(playerID: PlayerId): Promise; - - playerDisconnect(playerID: PlayerId): Promise; - - setPlayerCapacity(capacity: number): Promise>; - - getPlayerCapacity(): Promise; - - getPlayerCount(): Promise; - - isPlayerConnected(playerID: PlayerId): Promise; - - getConnectedPlayers(): Promise; -} - -export default Alpha; diff --git a/sdks/nodejs/src/alpha.js b/sdks/nodejs/src/alpha.js deleted file mode 100644 index 5f6d7d6072..0000000000 --- a/sdks/nodejs/src/alpha.js +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -const grpc = require("@grpc/grpc-js"); - -const messages = require("../lib/alpha/alpha_pb"); -const servicesPackageDefinition = require("../lib/alpha/alpha_grpc_pb"); - -class Alpha { - constructor(address, credentials) { - const services = grpc.loadPackageDefinition(servicesPackageDefinition); - this.client = new services.agones.dev.sdk.alpha.SDK(address, credentials); - } - - async playerConnect(playerID) { - const request = new messages.PlayerID(); - request.setPlayerid(playerID); - - return new Promise((resolve, reject) => { - this.client.playerConnect(request, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response.getBool()); - } - }); - }); - } - - async playerDisconnect(playerID) { - const request = new messages.PlayerID(); - request.setPlayerid(playerID); - - return new Promise((resolve, reject) => { - this.client.playerDisconnect(request, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response.getBool()); - } - }); - }); - } - - async setPlayerCapacity(capacity) { - const request = new messages.Count(); - request.setCount(capacity); - - return new Promise((resolve, reject) => { - this.client.setPlayerCapacity(request, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response.toObject()); - } - }); - }); - } - - async getPlayerCapacity() { - const request = new messages.Empty(); - - return new Promise((resolve, reject) => { - this.client.getPlayerCapacity(request, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response.getCount()); - } - }); - }); - } - - async getPlayerCount() { - const request = new messages.Empty(); - - return new Promise((resolve, reject) => { - this.client.getPlayerCount(request, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response.getCount()); - } - }); - }); - } - - async isPlayerConnected(playerID) { - const request = new messages.PlayerID(); - request.setPlayerid(playerID); - - return new Promise((resolve, reject) => { - this.client.isPlayerConnected(request, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response.getBool()); - } - }); - }); - } - - async getConnectedPlayers() { - const request = new messages.Empty(); - - return new Promise((resolve, reject) => { - this.client.getConnectedPlayers(request, (error, response) => { - if (error) { - reject(error); - } else { - resolve(response.getListList()); - } - }); - }); - } -} - -module.exports = Alpha; diff --git a/sdks/python/agones/_generated/alpha/alpha_pb2.py b/sdks/python/agones/_generated/alpha/alpha_pb2.py index ca00f3ddb8..dc25c373e8 100644 --- a/sdks/python/agones/_generated/alpha/alpha_pb2.py +++ b/sdks/python/agones/_generated/alpha/alpha_pb2.py @@ -40,7 +40,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61lpha.proto\x12\x14\x61gones.dev.sdk.alpha\"\x07\n\x05\x45mpty\"\x16\n\x05\x43ount\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\"\x14\n\x04\x42ool\x12\x0c\n\x04\x62ool\x18\x01 \x01(\x08\"\x1c\n\x08PlayerID\x12\x10\n\x08playerID\x18\x01 \x01(\t\"\x1c\n\x0cPlayerIDList\x12\x0c\n\x04list\x18\x01 \x03(\t2\xc3\x04\n\x03SDK\x12M\n\rPlayerConnect\x12\x1e.agones.dev.sdk.alpha.PlayerID\x1a\x1a.agones.dev.sdk.alpha.Bool\"\x00\x12P\n\x10PlayerDisconnect\x12\x1e.agones.dev.sdk.alpha.PlayerID\x1a\x1a.agones.dev.sdk.alpha.Bool\"\x00\x12O\n\x11SetPlayerCapacity\x12\x1b.agones.dev.sdk.alpha.Count\x1a\x1b.agones.dev.sdk.alpha.Empty\"\x00\x12O\n\x11GetPlayerCapacity\x12\x1b.agones.dev.sdk.alpha.Empty\x1a\x1b.agones.dev.sdk.alpha.Count\"\x00\x12L\n\x0eGetPlayerCount\x12\x1b.agones.dev.sdk.alpha.Empty\x1a\x1b.agones.dev.sdk.alpha.Count\"\x00\x12Q\n\x11IsPlayerConnected\x12\x1e.agones.dev.sdk.alpha.PlayerID\x1a\x1a.agones.dev.sdk.alpha.Bool\"\x00\x12X\n\x13GetConnectedPlayers\x12\x1b.agones.dev.sdk.alpha.Empty\x1a\".agones.dev.sdk.alpha.PlayerIDList\"\x00\x42\tZ\x07./alphab\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61lpha.proto\x12\x14\x61gones.dev.sdk.alpha2\x05\n\x03SDKB\tZ\x07./alphab\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -48,16 +48,6 @@ if not _descriptor._USE_C_DESCRIPTORS: _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z\007./alpha' - _globals['_EMPTY']._serialized_start=37 - _globals['_EMPTY']._serialized_end=44 - _globals['_COUNT']._serialized_start=46 - _globals['_COUNT']._serialized_end=68 - _globals['_BOOL']._serialized_start=70 - _globals['_BOOL']._serialized_end=90 - _globals['_PLAYERID']._serialized_start=92 - _globals['_PLAYERID']._serialized_end=120 - _globals['_PLAYERIDLIST']._serialized_start=122 - _globals['_PLAYERIDLIST']._serialized_end=150 - _globals['_SDK']._serialized_start=153 - _globals['_SDK']._serialized_end=732 + _globals['_SDK']._serialized_start=37 + _globals['_SDK']._serialized_end=42 # @@protoc_insertion_point(module_scope) \ No newline at end of file diff --git a/sdks/python/agones/_generated/alpha/alpha_pb2_grpc.py b/sdks/python/agones/_generated/alpha/alpha_pb2_grpc.py index d68b210246..3cf5e4cb07 100644 --- a/sdks/python/agones/_generated/alpha/alpha_pb2_grpc.py +++ b/sdks/python/agones/_generated/alpha/alpha_pb2_grpc.py @@ -19,7 +19,6 @@ import grpc import warnings -from . import alpha_pb2 as alpha__pb2 GRPC_GENERATED_VERSION = '1.80.0' GRPC_VERSION = grpc.__version__ @@ -51,173 +50,15 @@ def __init__(self, channel): Args: channel: A grpc.Channel. """ - self.PlayerConnect = channel.unary_unary( - '/agones.dev.sdk.alpha.SDK/PlayerConnect', - request_serializer=alpha__pb2.PlayerID.SerializeToString, - response_deserializer=alpha__pb2.Bool.FromString, - _registered_method=True) - self.PlayerDisconnect = channel.unary_unary( - '/agones.dev.sdk.alpha.SDK/PlayerDisconnect', - request_serializer=alpha__pb2.PlayerID.SerializeToString, - response_deserializer=alpha__pb2.Bool.FromString, - _registered_method=True) - self.SetPlayerCapacity = channel.unary_unary( - '/agones.dev.sdk.alpha.SDK/SetPlayerCapacity', - request_serializer=alpha__pb2.Count.SerializeToString, - response_deserializer=alpha__pb2.Empty.FromString, - _registered_method=True) - self.GetPlayerCapacity = channel.unary_unary( - '/agones.dev.sdk.alpha.SDK/GetPlayerCapacity', - request_serializer=alpha__pb2.Empty.SerializeToString, - response_deserializer=alpha__pb2.Count.FromString, - _registered_method=True) - self.GetPlayerCount = channel.unary_unary( - '/agones.dev.sdk.alpha.SDK/GetPlayerCount', - request_serializer=alpha__pb2.Empty.SerializeToString, - response_deserializer=alpha__pb2.Count.FromString, - _registered_method=True) - self.IsPlayerConnected = channel.unary_unary( - '/agones.dev.sdk.alpha.SDK/IsPlayerConnected', - request_serializer=alpha__pb2.PlayerID.SerializeToString, - response_deserializer=alpha__pb2.Bool.FromString, - _registered_method=True) - self.GetConnectedPlayers = channel.unary_unary( - '/agones.dev.sdk.alpha.SDK/GetConnectedPlayers', - request_serializer=alpha__pb2.Empty.SerializeToString, - response_deserializer=alpha__pb2.PlayerIDList.FromString, - _registered_method=True) class SDKServicer(object): """SDK service to be used in the GameServer SDK to the Pod Sidecar. """ - def PlayerConnect(self, request, context): - """PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - - GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - unless there is already an update pending, in which case the update joins that batch operation. - - PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the - list of connected playerIDs. - - If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of - connected playerIDs will be left unchanged. - - An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for - the server has been reached. The playerID will not be added to the list of playerIDs. - - Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count - through the Kubernetes API, as indeterminate results will occur. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def PlayerDisconnect(self, request, context): - """Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - - GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - unless there is already an update pending, in which case the update joins that batch operation. - - PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the - playerID value exists within the list. - - If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list - will be left unchanged. - - Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count - through the Kubernetes API, as indeterminate results will occur. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def SetPlayerCapacity(self, request, context): - """Update the GameServer.Status.Players.Capacity value with a new capacity. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetPlayerCapacity(self, request, context): - """Retrieves the current player capacity. This is always accurate from what has been set through this SDK, - even if the value has yet to be updated on the GameServer status resource. - - If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetPlayerCount(self, request, context): - """Retrieves the current player count. This is always accurate from what has been set through this SDK, - even if the value has yet to be updated on the GameServer status resource. - - If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def IsPlayerConnected(self, request, context): - """Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, - even if the value has yet to be updated on the GameServer status resource. - - If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def GetConnectedPlayers(self, request, context): - """Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, - even if the value has yet to be updated on the GameServer status resource. - - If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - def add_SDKServicer_to_server(servicer, server): rpc_method_handlers = { - 'PlayerConnect': grpc.unary_unary_rpc_method_handler( - servicer.PlayerConnect, - request_deserializer=alpha__pb2.PlayerID.FromString, - response_serializer=alpha__pb2.Bool.SerializeToString, - ), - 'PlayerDisconnect': grpc.unary_unary_rpc_method_handler( - servicer.PlayerDisconnect, - request_deserializer=alpha__pb2.PlayerID.FromString, - response_serializer=alpha__pb2.Bool.SerializeToString, - ), - 'SetPlayerCapacity': grpc.unary_unary_rpc_method_handler( - servicer.SetPlayerCapacity, - request_deserializer=alpha__pb2.Count.FromString, - response_serializer=alpha__pb2.Empty.SerializeToString, - ), - 'GetPlayerCapacity': grpc.unary_unary_rpc_method_handler( - servicer.GetPlayerCapacity, - request_deserializer=alpha__pb2.Empty.FromString, - response_serializer=alpha__pb2.Count.SerializeToString, - ), - 'GetPlayerCount': grpc.unary_unary_rpc_method_handler( - servicer.GetPlayerCount, - request_deserializer=alpha__pb2.Empty.FromString, - response_serializer=alpha__pb2.Count.SerializeToString, - ), - 'IsPlayerConnected': grpc.unary_unary_rpc_method_handler( - servicer.IsPlayerConnected, - request_deserializer=alpha__pb2.PlayerID.FromString, - response_serializer=alpha__pb2.Bool.SerializeToString, - ), - 'GetConnectedPlayers': grpc.unary_unary_rpc_method_handler( - servicer.GetConnectedPlayers, - request_deserializer=alpha__pb2.Empty.FromString, - response_serializer=alpha__pb2.PlayerIDList.SerializeToString, - ), } generic_handler = grpc.method_handlers_generic_handler( 'agones.dev.sdk.alpha.SDK', rpc_method_handlers) @@ -228,193 +69,4 @@ def add_SDKServicer_to_server(servicer, server): # This class is part of an EXPERIMENTAL API. class SDK(object): """SDK service to be used in the GameServer SDK to the Pod Sidecar. - """ - - @staticmethod - def PlayerConnect(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/agones.dev.sdk.alpha.SDK/PlayerConnect', - alpha__pb2.PlayerID.SerializeToString, - alpha__pb2.Bool.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def PlayerDisconnect(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/agones.dev.sdk.alpha.SDK/PlayerDisconnect', - alpha__pb2.PlayerID.SerializeToString, - alpha__pb2.Bool.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def SetPlayerCapacity(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/agones.dev.sdk.alpha.SDK/SetPlayerCapacity', - alpha__pb2.Count.SerializeToString, - alpha__pb2.Empty.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def GetPlayerCapacity(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/agones.dev.sdk.alpha.SDK/GetPlayerCapacity', - alpha__pb2.Empty.SerializeToString, - alpha__pb2.Count.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def GetPlayerCount(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/agones.dev.sdk.alpha.SDK/GetPlayerCount', - alpha__pb2.Empty.SerializeToString, - alpha__pb2.Count.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def IsPlayerConnected(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/agones.dev.sdk.alpha.SDK/IsPlayerConnected', - alpha__pb2.PlayerID.SerializeToString, - alpha__pb2.Bool.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def GetConnectedPlayers(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary( - request, - target, - '/agones.dev.sdk.alpha.SDK/GetConnectedPlayers', - alpha__pb2.Empty.SerializeToString, - alpha__pb2.PlayerIDList.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) \ No newline at end of file + """ \ No newline at end of file diff --git a/sdks/python/agones/_generated/sdk_pb2.py b/sdks/python/agones/_generated/sdk_pb2.py index d2ffb8618f..eb873dbb57 100644 --- a/sdks/python/agones/_generated/sdk_pb2.py +++ b/sdks/python/agones/_generated/sdk_pb2.py @@ -40,7 +40,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\tsdk.proto\x12\x0e\x61gones.dev.sdk\"\x07\n\x05\x45mpty\"&\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\x1b\n\x08\x44uration\x12\x0f\n\x07seconds\x18\x01 \x01(\x03\"\xfc\x0b\n\nGameServer\x12:\n\x0bobject_meta\x18\x01 \x01(\x0b\x32%.agones.dev.sdk.GameServer.ObjectMeta\x12-\n\x04spec\x18\x02 \x01(\x0b\x32\x1f.agones.dev.sdk.GameServer.Spec\x12\x31\n\x06status\x18\x03 \x01(\x0b\x32!.agones.dev.sdk.GameServer.Status\x1a\x93\x03\n\nObjectMeta\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x0b\n\x03uid\x18\x03 \x01(\t\x12\x18\n\x10resource_version\x18\x04 \x01(\t\x12\x12\n\ngeneration\x18\x05 \x01(\x03\x12\x1a\n\x12\x63reation_timestamp\x18\x06 \x01(\x03\x12\x1a\n\x12\x64\x65letion_timestamp\x18\x07 \x01(\x03\x12K\n\x0b\x61nnotations\x18\x08 \x03(\x0b\x32\x36.agones.dev.sdk.GameServer.ObjectMeta.AnnotationsEntry\x12\x41\n\x06labels\x18\t \x03(\x0b\x32\x31.agones.dev.sdk.GameServer.ObjectMeta.LabelsEntry\x1a\x32\n\x10\x41nnotationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\xac\x01\n\x04Spec\x12\x36\n\x06health\x18\x01 \x01(\x0b\x32&.agones.dev.sdk.GameServer.Spec.Health\x1al\n\x06Health\x12\x10\n\x08\x64isabled\x18\x01 \x01(\x08\x12\x16\n\x0eperiod_seconds\x18\x02 \x01(\x05\x12\x19\n\x11\x66\x61ilure_threshold\x18\x03 \x01(\x05\x12\x1d\n\x15initial_delay_seconds\x18\x04 \x01(\x05\x1a\x8a\x06\n\x06Status\x12\r\n\x05state\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12<\n\taddresses\x18\x07 \x03(\x0b\x32).agones.dev.sdk.GameServer.Status.Address\x12\x35\n\x05ports\x18\x03 \x03(\x0b\x32&.agones.dev.sdk.GameServer.Status.Port\x12?\n\x07players\x18\x04 \x01(\x0b\x32..agones.dev.sdk.GameServer.Status.PlayerStatus\x12\x41\n\x08\x63ounters\x18\x05 \x03(\x0b\x32/.agones.dev.sdk.GameServer.Status.CountersEntry\x12;\n\x05lists\x18\x06 \x03(\x0b\x32,.agones.dev.sdk.GameServer.Status.ListsEntry\x1a(\n\x07\x41\x64\x64ress\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x1a\"\n\x04Port\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\x05\x1a<\n\x0cPlayerStatus\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x10\n\x08\x63\x61pacity\x18\x02 \x01(\x03\x12\x0b\n\x03ids\x18\x03 \x03(\t\x1a\x30\n\rCounterStatus\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x10\n\x08\x63\x61pacity\x18\x02 \x01(\x03\x1a.\n\nListStatus\x12\x10\n\x08\x63\x61pacity\x18\x01 \x01(\x03\x12\x0e\n\x06values\x18\x02 \x03(\t\x1a`\n\rCountersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.agones.dev.sdk.GameServer.Status.CounterStatus:\x02\x38\x01\x1aZ\n\nListsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12;\n\x05value\x18\x02 \x01(\x0b\x32,.agones.dev.sdk.GameServer.Status.ListStatus:\x02\x38\x01\x32\xc3\x04\n\x03SDK\x12\x37\n\x05Ready\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00\x12:\n\x08\x41llocate\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00\x12:\n\x08Shutdown\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00\x12:\n\x06Health\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00(\x01\x12\x44\n\rGetGameServer\x12\x15.agones.dev.sdk.Empty\x1a\x1a.agones.dev.sdk.GameServer\"\x00\x12H\n\x0fWatchGameServer\x12\x15.agones.dev.sdk.Empty\x1a\x1a.agones.dev.sdk.GameServer\"\x00\x30\x01\x12=\n\x08SetLabel\x12\x18.agones.dev.sdk.KeyValue\x1a\x15.agones.dev.sdk.Empty\"\x00\x12\x42\n\rSetAnnotation\x12\x18.agones.dev.sdk.KeyValue\x1a\x15.agones.dev.sdk.Empty\"\x00\x12<\n\x07Reserve\x12\x18.agones.dev.sdk.Duration\x1a\x15.agones.dev.sdk.Empty\"\x00\x42\x07Z\x05./sdkb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\tsdk.proto\x12\x0e\x61gones.dev.sdk\"\x07\n\x05\x45mpty\"&\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\x1b\n\x08\x44uration\x12\x0f\n\x07seconds\x18\x01 \x01(\x03\"\x8c\x0b\n\nGameServer\x12:\n\x0bobject_meta\x18\x01 \x01(\x0b\x32%.agones.dev.sdk.GameServer.ObjectMeta\x12-\n\x04spec\x18\x02 \x01(\x0b\x32\x1f.agones.dev.sdk.GameServer.Spec\x12\x31\n\x06status\x18\x03 \x01(\x0b\x32!.agones.dev.sdk.GameServer.Status\x1a\x93\x03\n\nObjectMeta\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tnamespace\x18\x02 \x01(\t\x12\x0b\n\x03uid\x18\x03 \x01(\t\x12\x18\n\x10resource_version\x18\x04 \x01(\t\x12\x12\n\ngeneration\x18\x05 \x01(\x03\x12\x1a\n\x12\x63reation_timestamp\x18\x06 \x01(\x03\x12\x1a\n\x12\x64\x65letion_timestamp\x18\x07 \x01(\x03\x12K\n\x0b\x61nnotations\x18\x08 \x03(\x0b\x32\x36.agones.dev.sdk.GameServer.ObjectMeta.AnnotationsEntry\x12\x41\n\x06labels\x18\t \x03(\x0b\x32\x31.agones.dev.sdk.GameServer.ObjectMeta.LabelsEntry\x1a\x32\n\x10\x41nnotationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\xac\x01\n\x04Spec\x12\x36\n\x06health\x18\x01 \x01(\x0b\x32&.agones.dev.sdk.GameServer.Spec.Health\x1al\n\x06Health\x12\x10\n\x08\x64isabled\x18\x01 \x01(\x08\x12\x16\n\x0eperiod_seconds\x18\x02 \x01(\x05\x12\x19\n\x11\x66\x61ilure_threshold\x18\x03 \x01(\x05\x12\x1d\n\x15initial_delay_seconds\x18\x04 \x01(\x05\x1a\x9a\x05\n\x06Status\x12\r\n\x05state\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12<\n\taddresses\x18\x07 \x03(\x0b\x32).agones.dev.sdk.GameServer.Status.Address\x12\x35\n\x05ports\x18\x03 \x03(\x0b\x32&.agones.dev.sdk.GameServer.Status.Port\x12\x41\n\x08\x63ounters\x18\x05 \x03(\x0b\x32/.agones.dev.sdk.GameServer.Status.CountersEntry\x12;\n\x05lists\x18\x06 \x03(\x0b\x32,.agones.dev.sdk.GameServer.Status.ListsEntry\x1a(\n\x07\x41\x64\x64ress\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x1a\"\n\x04Port\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04port\x18\x02 \x01(\x05\x1a\x30\n\rCounterStatus\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x12\x10\n\x08\x63\x61pacity\x18\x02 \x01(\x03\x1a.\n\nListStatus\x12\x10\n\x08\x63\x61pacity\x18\x01 \x01(\x03\x12\x0e\n\x06values\x18\x02 \x03(\t\x1a`\n\rCountersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.agones.dev.sdk.GameServer.Status.CounterStatus:\x02\x38\x01\x1aZ\n\nListsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12;\n\x05value\x18\x02 \x01(\x0b\x32,.agones.dev.sdk.GameServer.Status.ListStatus:\x02\x38\x01J\x04\x08\x04\x10\x05R\x07players2\xc3\x04\n\x03SDK\x12\x37\n\x05Ready\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00\x12:\n\x08\x41llocate\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00\x12:\n\x08Shutdown\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00\x12:\n\x06Health\x12\x15.agones.dev.sdk.Empty\x1a\x15.agones.dev.sdk.Empty\"\x00(\x01\x12\x44\n\rGetGameServer\x12\x15.agones.dev.sdk.Empty\x1a\x1a.agones.dev.sdk.GameServer\"\x00\x12H\n\x0fWatchGameServer\x12\x15.agones.dev.sdk.Empty\x1a\x1a.agones.dev.sdk.GameServer\"\x00\x30\x01\x12=\n\x08SetLabel\x12\x18.agones.dev.sdk.KeyValue\x1a\x15.agones.dev.sdk.Empty\"\x00\x12\x42\n\rSetAnnotation\x12\x18.agones.dev.sdk.KeyValue\x1a\x15.agones.dev.sdk.Empty\"\x00\x12<\n\x07Reserve\x12\x18.agones.dev.sdk.Duration\x1a\x15.agones.dev.sdk.Empty\"\x00\x42\x07Z\x05./sdkb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -63,7 +63,7 @@ _globals['_DURATION']._serialized_start=78 _globals['_DURATION']._serialized_end=105 _globals['_GAMESERVER']._serialized_start=108 - _globals['_GAMESERVER']._serialized_end=1640 + _globals['_GAMESERVER']._serialized_end=1528 _globals['_GAMESERVER_OBJECTMETA']._serialized_start=281 _globals['_GAMESERVER_OBJECTMETA']._serialized_end=684 _globals['_GAMESERVER_OBJECTMETA_ANNOTATIONSENTRY']._serialized_start=587 @@ -75,21 +75,19 @@ _globals['_GAMESERVER_SPEC_HEALTH']._serialized_start=751 _globals['_GAMESERVER_SPEC_HEALTH']._serialized_end=859 _globals['_GAMESERVER_STATUS']._serialized_start=862 - _globals['_GAMESERVER_STATUS']._serialized_end=1640 - _globals['_GAMESERVER_STATUS_ADDRESS']._serialized_start=1214 - _globals['_GAMESERVER_STATUS_ADDRESS']._serialized_end=1254 - _globals['_GAMESERVER_STATUS_PORT']._serialized_start=1256 - _globals['_GAMESERVER_STATUS_PORT']._serialized_end=1290 - _globals['_GAMESERVER_STATUS_PLAYERSTATUS']._serialized_start=1292 - _globals['_GAMESERVER_STATUS_PLAYERSTATUS']._serialized_end=1352 - _globals['_GAMESERVER_STATUS_COUNTERSTATUS']._serialized_start=1354 - _globals['_GAMESERVER_STATUS_COUNTERSTATUS']._serialized_end=1402 - _globals['_GAMESERVER_STATUS_LISTSTATUS']._serialized_start=1404 - _globals['_GAMESERVER_STATUS_LISTSTATUS']._serialized_end=1450 - _globals['_GAMESERVER_STATUS_COUNTERSENTRY']._serialized_start=1452 - _globals['_GAMESERVER_STATUS_COUNTERSENTRY']._serialized_end=1548 - _globals['_GAMESERVER_STATUS_LISTSENTRY']._serialized_start=1550 - _globals['_GAMESERVER_STATUS_LISTSENTRY']._serialized_end=1640 - _globals['_SDK']._serialized_start=1643 - _globals['_SDK']._serialized_end=2222 + _globals['_GAMESERVER_STATUS']._serialized_end=1528 + _globals['_GAMESERVER_STATUS_ADDRESS']._serialized_start=1149 + _globals['_GAMESERVER_STATUS_ADDRESS']._serialized_end=1189 + _globals['_GAMESERVER_STATUS_PORT']._serialized_start=1191 + _globals['_GAMESERVER_STATUS_PORT']._serialized_end=1225 + _globals['_GAMESERVER_STATUS_COUNTERSTATUS']._serialized_start=1227 + _globals['_GAMESERVER_STATUS_COUNTERSTATUS']._serialized_end=1275 + _globals['_GAMESERVER_STATUS_LISTSTATUS']._serialized_start=1277 + _globals['_GAMESERVER_STATUS_LISTSTATUS']._serialized_end=1323 + _globals['_GAMESERVER_STATUS_COUNTERSENTRY']._serialized_start=1325 + _globals['_GAMESERVER_STATUS_COUNTERSENTRY']._serialized_end=1421 + _globals['_GAMESERVER_STATUS_LISTSENTRY']._serialized_start=1423 + _globals['_GAMESERVER_STATUS_LISTSENTRY']._serialized_end=1513 + _globals['_SDK']._serialized_start=1531 + _globals['_SDK']._serialized_end=2110 # @@protoc_insertion_point(module_scope) \ No newline at end of file diff --git a/sdks/python/agones/alpha.py b/sdks/python/agones/alpha.py deleted file mode 100644 index 96c7478ec4..0000000000 --- a/sdks/python/agones/alpha.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright Contributors to Agones a Series of LF Projects, 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. - -"""Alpha SDK - Player tracking functionality.""" - -import grpc - -from agones._generated.alpha import alpha_pb2, alpha_pb2_grpc - - -class Alpha: - """Player tracking API (Alpha feature).""" - - def __init__(self, channel: grpc.Channel): - self._client = alpha_pb2_grpc.SDKStub(channel) - - def player_connect(self, player_id: str) -> bool: - """Register a player connection. Returns True if newly added.""" - return self._client.PlayerConnect(alpha_pb2.PlayerID(playerID=player_id)).bool - - def player_disconnect(self, player_id: str) -> bool: - """Register a player disconnection. Returns True if removed.""" - return self._client.PlayerDisconnect(alpha_pb2.PlayerID(playerID=player_id)).bool - - def set_player_capacity(self, capacity: int) -> None: - """Set the max player capacity.""" - self._client.SetPlayerCapacity(alpha_pb2.Count(count=capacity)) - - def get_player_capacity(self) -> int: - """Get the max player capacity.""" - return self._client.GetPlayerCapacity(alpha_pb2.Empty()).count - - def get_player_count(self) -> int: - """Get the current player count.""" - return self._client.GetPlayerCount(alpha_pb2.Empty()).count - - def is_player_connected(self, player_id: str) -> bool: - """Check if a player is currently connected.""" - return self._client.IsPlayerConnected(alpha_pb2.PlayerID(playerID=player_id)).bool - - def get_connected_players(self) -> list[str]: - """Get the list of connected player IDs.""" - return list(self._client.GetConnectedPlayers(alpha_pb2.Empty()).list) diff --git a/sdks/python/agones/sdk.py b/sdks/python/agones/sdk.py index 47f25ea1fe..1b1eeb4052 100644 --- a/sdks/python/agones/sdk.py +++ b/sdks/python/agones/sdk.py @@ -23,7 +23,6 @@ import grpc from agones._generated import sdk_pb2, sdk_pb2_grpc -from agones.alpha import Alpha from agones.beta import Beta _DEFAULT_HOST = "localhost" @@ -41,7 +40,6 @@ def __init__(self, host: str | None = None, port: int | None = None): self._client: sdk_pb2_grpc.SDKStub | None = None self._health_stream = None self._health_queue: queue.Queue | None = None - self._alpha: Alpha | None = None self._beta: Beta | None = None def connect(self, timeout: float = _DEFAULT_TIMEOUT) -> None: @@ -49,7 +47,6 @@ def connect(self, timeout: float = _DEFAULT_TIMEOUT) -> None: self._channel = grpc.insecure_channel(f"{self._host}:{self._port}") grpc.channel_ready_future(self._channel).result(timeout=timeout) self._client = sdk_pb2_grpc.SDKStub(self._channel) - self._alpha = Alpha(self._channel) self._beta = Beta(self._channel) def close(self) -> None: @@ -141,13 +138,6 @@ def set_annotation(self, key: str, value: str) -> None: # --- Sub-SDKs --- - @property - def alpha(self) -> Alpha: - """Access the Alpha SDK (player tracking).""" - if self._alpha is None: - raise RuntimeError("SDK not connected. Call connect() first.") - return self._alpha - @property def beta(self) -> Beta: """Access the Beta SDK (counters and lists).""" diff --git a/sdks/python/tests/test_alpha.py b/sdks/python/tests/test_alpha.py deleted file mode 100644 index e2a8a612bd..0000000000 --- a/sdks/python/tests/test_alpha.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright Contributors to Agones a Series of LF Projects, 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. - -import unittest -from unittest.mock import MagicMock - -from agones._generated.alpha import alpha_pb2 -from agones.alpha import Alpha - - -class TestAlpha(unittest.TestCase): - - def setUp(self): - self.channel = MagicMock() - self.alpha = Alpha(self.channel) - self.alpha._client = MagicMock() - - def test_player_connect(self): - self.alpha._client.PlayerConnect.return_value = alpha_pb2.Bool(bool=True) - result = self.alpha.player_connect("player-1") - self.assertTrue(result) - call_args = self.alpha._client.PlayerConnect.call_args[0][0] - self.assertEqual(call_args.playerID, "player-1") - - def test_player_disconnect(self): - self.alpha._client.PlayerDisconnect.return_value = alpha_pb2.Bool(bool=True) - result = self.alpha.player_disconnect("player-1") - self.assertTrue(result) - - def test_set_player_capacity(self): - self.alpha.set_player_capacity(100) - call_args = self.alpha._client.SetPlayerCapacity.call_args[0][0] - self.assertEqual(call_args.count, 100) - - def test_get_player_capacity(self): - self.alpha._client.GetPlayerCapacity.return_value = alpha_pb2.Count(count=64) - self.assertEqual(self.alpha.get_player_capacity(), 64) - - def test_get_player_count(self): - self.alpha._client.GetPlayerCount.return_value = alpha_pb2.Count(count=10) - self.assertEqual(self.alpha.get_player_count(), 10) - - def test_is_player_connected(self): - self.alpha._client.IsPlayerConnected.return_value = alpha_pb2.Bool(bool=False) - self.assertFalse(self.alpha.is_player_connected("unknown")) - - def test_get_connected_players(self): - self.alpha._client.GetConnectedPlayers.return_value = alpha_pb2.PlayerIDList(list=["a", "b"]) - result = self.alpha.get_connected_players() - self.assertEqual(result, ["a", "b"]) - - -if __name__ == "__main__": - unittest.main() diff --git a/sdks/python/tests/test_sdk.py b/sdks/python/tests/test_sdk.py index bfbe5901d3..97af882fa7 100644 --- a/sdks/python/tests/test_sdk.py +++ b/sdks/python/tests/test_sdk.py @@ -26,7 +26,6 @@ class TestAgonesSDK(unittest.TestCase): def setUp(self): self.sdk = AgonesSDK() self.sdk._client = MagicMock() - self.sdk._alpha = MagicMock() self.sdk._beta = MagicMock() def test_default_host_and_port(self): @@ -123,11 +122,6 @@ def test_close_stops_health(self): self.sdk.close() self.assertIsNone(self.sdk._health_queue) - def test_alpha_not_connected_raises(self): - sdk = AgonesSDK() - with self.assertRaises(RuntimeError): - _ = sdk.alpha - def test_beta_not_connected_raises(self): sdk = AgonesSDK() with self.assertRaises(RuntimeError): diff --git a/sdks/rust/proto/sdk/alpha/alpha.proto b/sdks/rust/proto/sdk/alpha/alpha.proto index fb75ed5ae0..1fce55051a 100644 --- a/sdks/rust/proto/sdk/alpha/alpha.proto +++ b/sdks/rust/proto/sdk/alpha/alpha.proto @@ -17,7 +17,6 @@ syntax = "proto3"; package agones.dev.sdk.alpha; option go_package = "./alpha"; -import "google/api/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { @@ -31,119 +30,5 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { }; // SDK service to be used in the GameServer SDK to the Pod Sidecar. -service SDK { - // PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the - // list of connected playerIDs. - // - // If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of - // connected playerIDs will be left unchanged. - // - // An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for - // the server has been reached. The playerID will not be added to the list of playerIDs. - // - // Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count - // through the Kubernetes API, as indeterminate results will occur. - rpc PlayerConnect (PlayerID) returns (Bool) { - option (google.api.http) = { - post: "/alpha/player/connect" - body: "*" - }; - } +service SDK {} - // Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - // - // GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, - // unless there is already an update pending, in which case the update joins that batch operation. - // - // PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the - // playerID value exists within the list. - // - // If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list - // will be left unchanged. - // - // Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count - // through the Kubernetes API, as indeterminate results will occur. - rpc PlayerDisconnect (PlayerID) returns (Bool) { - option (google.api.http) = { - post: "/alpha/player/disconnect" - body: "*" - }; - } - - // Update the GameServer.Status.Players.Capacity value with a new capacity. - rpc SetPlayerCapacity (Count) returns (Empty) { - option (google.api.http) = { - put: "/alpha/player/capacity" - body: "*" - }; - } - - // Retrieves the current player capacity. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetPlayerCapacity (Empty) returns (Count) { - option (google.api.http) = { - get: "/alpha/player/capacity" - }; - } - - // Retrieves the current player count. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetPlayerCount (Empty) returns (Count) { - option (google.api.http) = { - get: "/alpha/player/count" - }; - } - - // Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. - rpc IsPlayerConnected (PlayerID) returns (Bool) { - option (google.api.http) = { - get: "/alpha/player/connected/{playerID}" - }; - } - - // Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, - // even if the value has yet to be updated on the GameServer status resource. - // - // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - rpc GetConnectedPlayers(Empty) returns (PlayerIDList) { - option (google.api.http) = { - get: "/alpha/player/connected" - }; - } -} - -// I am Empty -message Empty { -} - -// Store a count variable. -message Count { - int64 count = 1; -} - -// Store a boolean result -message Bool { - bool bool = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {format: "boolean"}]; -} - -// The unique identifier for a given player. -message PlayerID { - string playerID = 1; -} - -// List of Player IDs -message PlayerIDList { - repeated string list = 1; -} diff --git a/sdks/rust/proto/sdk/sdk.proto b/sdks/rust/proto/sdk/sdk.proto index 7b08d1163f..0e7b541887 100644 --- a/sdks/rust/proto/sdk/sdk.proto +++ b/sdks/rust/proto/sdk/sdk.proto @@ -150,6 +150,9 @@ message GameServer { } message Status { + reserved 4; + reserved "players"; + message Address { string type = 1; string address = 2; @@ -159,13 +162,6 @@ message GameServer { string name = 1; int32 port = 2; } - // [Stage:Alpha] - // [FeatureFlag:PlayerTracking] - message PlayerStatus { - int64 count = 1; - int64 capacity = 2; - repeated string ids = 3; - } // [Stage:Beta] // [FeatureFlag:CountsAndLists] @@ -186,10 +182,6 @@ message GameServer { repeated Address addresses = 7; repeated Port ports = 3; - // [Stage:Alpha] - // [FeatureFlag:PlayerTracking] - PlayerStatus players = 4; - // [Stage:Beta] // [FeatureFlag:CountsAndLists] map counters = 5; diff --git a/sdks/rust/src/alpha.rs b/sdks/rust/src/alpha.rs deleted file mode 100644 index b698e92a2c..0000000000 --- a/sdks/rust/src/alpha.rs +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -use crate::errors::Result; -use tonic::transport::Channel; - -mod api { - tonic::include_proto!("agones.dev.sdk.alpha"); -} - -use api::sdk_client::SdkClient; - -/// Alpha is an instance of the Agones Alpha SDK -#[derive(Clone)] -pub struct Alpha { - client: SdkClient, -} - -impl Alpha { - /// new creates a new instance of the Alpha SDK - pub(crate) fn new(ch: Channel) -> Self { - Self { - client: SdkClient::new(ch), - } - } - - /// This returns the last player capacity that was set through the SDK. - /// If the player capacity is set from outside the SDK, use - /// [`Sdk::get_gameserver`] instead. - #[inline] - pub async fn get_player_capacity(&mut self) -> Result { - Ok(self - .client - .get_player_capacity(api::Empty {}) - .await - .map(|c| c.into_inner().count)?) - } - - /// This changes the player capacity to a new value. - #[inline] - pub async fn set_player_capacity(&mut self, count: i64) -> Result<()> { - Ok(self - .client - .set_player_capacity(api::Count { count }) - .await - .map(|_| ())?) - } - - /// This function increases the SDK’s stored player count by one, and appends - /// this playerID to `GameServer.status.players.ids`. - /// - /// Returns true and adds the playerID to the list of playerIDs if the - /// playerIDs was not already in the list of connected playerIDs. - #[inline] - pub async fn player_connect(&mut self, id: impl Into) -> Result { - Ok(self - .client - .player_connect(api::PlayerId { - player_id: id.into(), - }) - .await - .map(|b| b.into_inner().bool)?) - } - - /// This function decreases the SDK’s stored player count by one, and removes - /// the playerID from GameServer.status.players.ids. - /// - /// Will return true and remove the supplied playerID from the list of - /// connected playerIDs if the playerID value exists within the list. - #[inline] - pub async fn player_disconnect(&mut self, id: impl Into) -> Result { - Ok(self - .client - .player_disconnect(api::PlayerId { - player_id: id.into(), - }) - .await - .map(|b| b.into_inner().bool)?) - } - - /// Returns the current player count. - #[inline] - pub async fn get_player_count(&mut self) -> Result { - Ok(self - .client - .get_player_count(api::Empty {}) - .await - .map(|c| c.into_inner().count)?) - } - - /// This returns if the playerID is currently connected to the GameServer. - /// This is always accurate, even if the value hasn’t been updated to the - /// Game Server status yet. - #[inline] - pub async fn is_player_connected(&mut self, id: impl Into) -> Result { - Ok(self - .client - .is_player_connected(api::PlayerId { - player_id: id.into(), - }) - .await - .map(|b| b.into_inner().bool)?) - } - - /// This returns the list of the currently connected player ids. - /// This is always accurate, even if the value has not been updated to the - /// Game Server status yet. - #[inline] - pub async fn get_connected_players(&mut self) -> Result> { - Ok(self - .client - .get_connected_players(api::Empty {}) - .await - .map(|pl| pl.into_inner().list)?) - } -} - - -#[cfg(test)] -mod tests { - use tokio; - - // MockAlpha simulates Alpha's async methods for unit testing - struct MockAlpha { - capacity: i64, - player_count: i64, - player_connected: Option, - player_disconnected: Option, - } - - impl MockAlpha { - fn new() -> Self { - Self { - capacity: 0, - player_count: 0, - player_connected: None, - player_disconnected: None, - } - } - - async fn get_player_capacity(&mut self) -> i64 { - self.capacity - } - - async fn set_player_capacity(&mut self, count: i64) { - self.capacity = count; - } - - async fn player_connect(&mut self, id: impl Into) -> bool { - let id = id.into(); - self.player_connected = Some(id.clone()); - self.player_count += 1; - true - } - - async fn player_disconnect(&mut self, id: impl Into) -> bool { - let id = id.into(); - self.player_disconnected = Some(id.clone()); - if self.player_count > 0 { - self.player_count -= 1; - } - true - } - - async fn get_player_count(&mut self) -> i64 { - self.player_count - } - - async fn is_player_connected(&mut self, id: impl Into) -> bool { - match &self.player_connected { - Some(connected) => id.into() == *connected, - None => false, - } - } - - async fn get_connected_players(&mut self) -> Vec { - match &self.player_connected { - Some(id) => vec![id.clone()], - None => vec![], - } - } - } - - #[tokio::test] - async fn test_alpha_player_flow() { - let mut alpha = MockAlpha::new(); - - // Set and get player capacity - alpha.set_player_capacity(15).await; - assert_eq!(alpha.capacity, 15); - - let capacity = alpha.get_player_capacity().await; - assert_eq!(capacity, 15); - - // Connect player - let player_id = "one"; - let ok = alpha.player_connect(player_id).await; - assert!(ok); - assert_eq!(alpha.player_connected.as_deref(), Some(player_id)); - - // Get player count - let count = alpha.get_player_count().await; - assert_eq!(count, 1); - - // Disconnect player - let ok = alpha.player_disconnect(player_id).await; - assert!(ok); - assert_eq!(alpha.player_disconnected.as_deref(), Some(player_id)); - - // Put the player back in - let ok = alpha.player_connect(player_id).await; - assert!(ok); - let count = alpha.get_player_count().await; - assert_eq!(count, 1); - - // Is player connected (should be true) - let ok = alpha.is_player_connected(player_id).await; - assert!(ok, "Player should be connected"); - - // Is player connected (should be false) - let ok = alpha.is_player_connected("false").await; - assert!(!ok, "Player should not be connected"); - - // Get connected players - let list = alpha.get_connected_players().await; - assert_eq!(list, vec![player_id]); - } -} \ No newline at end of file diff --git a/sdks/rust/src/lib.rs b/sdks/rust/src/lib.rs index 1e55685832..93f5570819 100644 --- a/sdks/rust/src/lib.rs +++ b/sdks/rust/src/lib.rs @@ -14,9 +14,8 @@ //! the Rust game server SDK -pub mod alpha; pub mod beta; pub mod errors; mod sdk; -pub use sdk::{GameServer, ObjectMeta, PlayerStatus, Port, Sdk, Spec, Status}; +pub use sdk::{GameServer, ObjectMeta, Port, Sdk, Spec, Status}; diff --git a/sdks/rust/src/sdk.rs b/sdks/rust/src/sdk.rs index d045291ac5..7e6d285ad7 100644 --- a/sdks/rust/src/sdk.rs +++ b/sdks/rust/src/sdk.rs @@ -22,7 +22,7 @@ mod api { use api::sdk_client::SdkClient; pub use api::{ game_server::{ - status::{PlayerStatus, Port}, + status::{Port}, ObjectMeta, Spec, Status, }, GameServer, @@ -30,7 +30,7 @@ pub use api::{ pub type WatchStream = tonic::Streaming; -use crate::{alpha::Alpha, beta::Beta, errors::Result}; +use crate::{beta::Beta, errors::Result}; #[inline] fn empty() -> api::Empty { @@ -41,7 +41,6 @@ fn empty() -> api::Empty { #[derive(Clone)] pub struct Sdk { client: SdkClient, - alpha: Alpha, beta: Beta, } @@ -103,7 +102,6 @@ impl Sdk { // will only attempt to connect on first invocation, so won't exit straight away. let channel = builder.connect_lazy(); let mut client = SdkClient::new(channel.clone()); - let alpha = Alpha::new(channel.clone()); let beta = Beta::new(channel); tokio::time::timeout(Duration::from_secs(30), async { @@ -118,14 +116,9 @@ impl Sdk { }) .await?; - Ok(Self { client, alpha, beta }) + Ok(Self { client, beta }) } - /// Alpha returns the Alpha SDK - #[inline] - pub fn alpha(&self) -> &Alpha { - &self.alpha - } /// Beta returns the Beta SDK #[inline] diff --git a/sdks/swagger/alpha.swagger.json b/sdks/swagger/alpha.swagger.json index 6d579f5a96..832679be4d 100644 --- a/sdks/swagger/alpha.swagger.json +++ b/sdks/swagger/alpha.swagger.json @@ -4,11 +4,6 @@ "title": "alpha.proto", "version": "version not set" }, - "tags": [ - { - "name": "SDK" - } - ], "schemes": [ "http" ], @@ -18,217 +13,6 @@ "produces": [ "application/json" ], - "paths": { - "/alpha/player/capacity": { - "get": { - "summary": "Retrieves the current player capacity. This is always accurate from what has been set through this SDK,\neven if the value has yet to be updated on the GameServer status resource.", - "description": "If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.", - "operationId": "GetPlayerCapacity", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaCount" - } - } - }, - "tags": [ - "SDK" - ] - }, - "put": { - "summary": "Update the GameServer.Status.Players.Capacity value with a new capacity.", - "operationId": "SetPlayerCapacity", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaEmpty" - } - } - }, - "parameters": [ - { - "name": "body", - "description": "Store a count variable.", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/alphaCount" - } - } - ], - "tags": [ - "SDK" - ] - } - }, - "/alpha/player/connect": { - "post": { - "summary": "PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs.", - "description": "GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,\nunless there is already an update pending, in which case the update joins that batch operation.\n\nPlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the\nlist of connected playerIDs.\n\nIf the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of\nconnected playerIDs will be left unchanged.\n\nAn error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for\nthe server has been reached. The playerID will not be added to the list of playerIDs.\n\nWarning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count\nthrough the Kubernetes API, as indeterminate results will occur.", - "operationId": "PlayerConnect", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaBool" - } - } - }, - "parameters": [ - { - "name": "body", - "description": "The unique identifier for a given player.", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/alphaPlayerID" - } - } - ], - "tags": [ - "SDK" - ] - } - }, - "/alpha/player/connected": { - "get": { - "summary": "Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK,\neven if the value has yet to be updated on the GameServer status resource.", - "description": "If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.", - "operationId": "GetConnectedPlayers", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaPlayerIDList" - } - } - }, - "tags": [ - "SDK" - ] - } - }, - "/alpha/player/connected/{playerID}": { - "get": { - "summary": "Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK,\neven if the value has yet to be updated on the GameServer status resource.", - "description": "If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status.", - "operationId": "IsPlayerConnected", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaBool" - } - } - }, - "parameters": [ - { - "name": "playerID", - "in": "path", - "required": true, - "type": "string" - } - ], - "tags": [ - "SDK" - ] - } - }, - "/alpha/player/count": { - "get": { - "summary": "Retrieves the current player count. This is always accurate from what has been set through this SDK,\neven if the value has yet to be updated on the GameServer status resource.", - "description": "If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.", - "operationId": "GetPlayerCount", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaCount" - } - } - }, - "tags": [ - "SDK" - ] - } - }, - "/alpha/player/disconnect": { - "post": { - "summary": "Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs.", - "description": "GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,\nunless there is already an update pending, in which case the update joins that batch operation.\n\nPlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the\nplayerID value exists within the list.\n\nIf the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list\nwill be left unchanged.\n\nWarning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count\nthrough the Kubernetes API, as indeterminate results will occur.", - "operationId": "PlayerDisconnect", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaBool" - } - } - }, - "parameters": [ - { - "name": "body", - "description": "The unique identifier for a given player.", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/alphaPlayerID" - } - } - ], - "tags": [ - "SDK" - ] - } - } - }, - "definitions": { - "alphaBool": { - "type": "object", - "properties": { - "bool": { - "type": "boolean", - "format": "boolean" - } - }, - "title": "Store a boolean result" - }, - "alphaCount": { - "type": "object", - "properties": { - "count": { - "type": "string", - "format": "int64" - } - }, - "description": "Store a count variable." - }, - "alphaEmpty": { - "type": "object", - "title": "I am Empty" - }, - "alphaPlayerID": { - "type": "object", - "properties": { - "playerID": { - "type": "string" - } - }, - "description": "The unique identifier for a given player." - }, - "alphaPlayerIDList": { - "type": "object", - "properties": { - "list": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "title": "List of Player IDs" - } - } + "paths": {}, + "definitions": {} } diff --git a/sdks/swagger/sdk.swagger.json b/sdks/swagger/sdk.swagger.json index 3738432cbc..cc6c4025e6 100644 --- a/sdks/swagger/sdk.swagger.json +++ b/sdks/swagger/sdk.swagger.json @@ -365,26 +365,6 @@ }, "title": "[Stage:Beta]\n[FeatureFlag:CountsAndLists]" }, - "StatusPlayerStatus": { - "type": "object", - "properties": { - "count": { - "type": "string", - "format": "int64" - }, - "capacity": { - "type": "string", - "format": "int64" - }, - "ids": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "title": "[Stage:Alpha]\n[FeatureFlag:PlayerTracking]" - }, "StatusPort": { "type": "object", "properties": { @@ -449,10 +429,6 @@ "$ref": "#/definitions/StatusPort" } }, - "players": { - "$ref": "#/definitions/StatusPlayerStatus", - "title": "[Stage:Alpha]\n[FeatureFlag:PlayerTracking]" - }, "counters": { "type": "object", "additionalProperties": { diff --git a/sdks/unity/AgonesAlphaSdk.cs b/sdks/unity/AgonesAlphaSdk.cs deleted file mode 100644 index 464ccffe02..0000000000 --- a/sdks/unity/AgonesAlphaSdk.cs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, LLC. -// All Rights Reserved. -// -// 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. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Agones.Model; -using MiniJSON; -using UnityEngine; -using UnityEngine.Networking; - -namespace Agones -{ - /// - /// Agones Alpha SDK for Unity. - /// - public class AgonesAlphaSdk : AgonesSdk - { - #region AgonesRestClient Public Methods - - private struct Player - { - public string playerID; - - public Player(string playerId) - { - this.playerID = playerId; - } - } - - /// - /// This function increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. - /// Returns true and adds the playerID to the list of playerIDs if the playerIDs was not already in the list of connected playerIDs. - /// - /// True if the playerID was added to the list of playerIDs - public async Task PlayerConnect(string id) - { - string json = JsonUtility.ToJson(new Player(playerId: id)); - return await SendRequestAsync("/alpha/player/connect", json).ContinueWith(task => task.Result.ok); - } - - /// - /// This function decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. - /// Will return true and remove the supplied playerID from the list of connected playerIDs if the playerID value exists within the list. - /// - /// True if the playerID was removed from the list of playerIDs - public async Task PlayerDisconnect(string id) - { - string json = JsonUtility.ToJson(new Player(playerId: id)); - return await SendRequestAsync("/alpha/player/disconnect", json).ContinueWith(task => task.Result.ok); - } - - private struct Capacity - { - public long count; - - public Capacity(long count) - { - this.count = count; - } - } - - /// - /// This changes the player capacity to a new value. - /// - /// gRPC Status of the request - public async Task SetPlayerCapacity(long count) - { - string json = JsonUtility.ToJson(new Capacity(count: count)); - return await SendRequestAsync("/alpha/player/capacity", json, UnityWebRequest.kHttpVerbPUT).ContinueWith(task => task.Result.ok); - } - - - /// - /// This returns the last player capacity that was set through the SDK. - /// If the player capacity is set from outside the SDK, use SDK.GameServer() instead. - /// - /// Player capacity - public async Task GetPlayerCapacity() - { - var result = await SendRequestAsync("/alpha/player/capacity", "{}", UnityWebRequest.kHttpVerbGET); - - if (!result.ok) - { - return 0; - } - - if (Json.Deserialize(result.json) is not Dictionary data - || !data.TryGetValue("count", out object countObject) - || countObject is not string countString - || !long.TryParse(countString, out long count)) - { - return 0; - } - - return count; - } - - /// - /// Returns the current player count. - /// - /// Player count - public async Task GetPlayerCount() - { - var result = await SendRequestAsync("/alpha/player/count", "{}", UnityWebRequest.kHttpVerbGET); - - if (!result.ok) - { - return 0; - } - - if (Json.Deserialize(result.json) is not Dictionary data - || !data.TryGetValue("count", out object countObject) - || countObject is not string countString - || !long.TryParse(countString, out long count)) - { - return 0; - } - - return count; - } - - /// - /// This returns if the playerID is currently connected to the GameServer. - /// This is always accurate, even if the value hasn’t been updated to the GameServer status yet. - /// - /// True if the playerID is currently connected - public async Task IsPlayerConnected(string id) - { - var result = await SendRequestAsync($"/alpha/player/connected/{id}", "{}", UnityWebRequest.kHttpVerbGET); - - if (!result.ok) - { - return false; - } - - if (Json.Deserialize(result.json) is not Dictionary data - || !data.TryGetValue("bool", out object boolObject) - || boolObject is not bool resultBool) - { - return false; - } - - return resultBool; - } - - /// - /// This returns the list of the currently connected player ids. - /// This is always accurate, even if the value has not been updated to the Game Server status yet. - /// - /// The list of the currently connected player ids - public async Task> GetConnectedPlayers() - { - var result = await SendRequestAsync("/alpha/player/connected", "{}", UnityWebRequest.kHttpVerbGET); - - if (!result.ok) - { - return new List(); - } - - if (Json.Deserialize(result.json) is not Dictionary data - || !data.TryGetValue("list", out object listObject) - || listObject is not List list) - { - return new List(); - } - - return list.Where(l => l is string).Select(l => l.ToString()).ToList();; - } - - #endregion - - } -} \ No newline at end of file diff --git a/sdks/unity/AgonesAlphaSdk.cs.meta b/sdks/unity/AgonesAlphaSdk.cs.meta deleted file mode 100644 index 1b315c041a..0000000000 --- a/sdks/unity/AgonesAlphaSdk.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: a4bfa24699304c85ad1b9ef381ab10ff -timeCreated: 1653041463 \ No newline at end of file diff --git a/sdks/unity/Tests/Runtime/PlayMode/AgonesSdkIntegrationTests.cs b/sdks/unity/Tests/Runtime/PlayMode/AgonesSdkIntegrationTests.cs index 3d80007b93..049f76b16e 100644 --- a/sdks/unity/Tests/Runtime/PlayMode/AgonesSdkIntegrationTests.cs +++ b/sdks/unity/Tests/Runtime/PlayMode/AgonesSdkIntegrationTests.cs @@ -28,7 +28,6 @@ public class AgonesSdkIntegrationTests private AgonesSdk sdk; private AgonesBetaSdk betaSdk; - private AgonesAlphaSdk alphaSdk; [UnitySetUp] public IEnumerator UnitySetUp() @@ -38,11 +37,9 @@ public IEnumerator UnitySetUp() this.sdk = gameObject.AddComponent(); this.betaSdk = gameObject.AddComponent(); - this.alphaSdk = gameObject.AddComponent(); Assert.IsNotNull(this.sdk); Assert.IsNotNull(this.betaSdk); - Assert.IsNotNull(this.alphaSdk); } [UnityTest] diff --git a/sdks/unreal/Agones/Source/Agones/Classes/Classes.h b/sdks/unreal/Agones/Source/Agones/Classes/Classes.h index 05ce99411a..caf85ca429 100644 --- a/sdks/unreal/Agones/Source/Agones/Classes/Classes.h +++ b/sdks/unreal/Agones/Source/Agones/Classes/Classes.h @@ -348,24 +348,6 @@ struct FDuration int64 Seconds = 0; }; -USTRUCT(BlueprintType) -struct FAgonesPlayer -{ - GENERATED_BODY() - - UPROPERTY(BlueprintReadOnly, Category="Agones") - FString PlayerID; -}; - -USTRUCT(BlueprintType) -struct FPlayerCapacity -{ - GENERATED_BODY() - - UPROPERTY(BlueprintReadOnly, Category="Agones") - int64 Count = 0; -}; - USTRUCT(BlueprintType) struct FEmptyResponse { @@ -435,24 +417,6 @@ struct FCountResponse } }; -USTRUCT(BlueprintType) -struct FConnectedPlayersResponse -{ - GENERATED_BODY() - - FConnectedPlayersResponse() - { - } - - UPROPERTY(BlueprintReadOnly, Category="Agones") - TArray ConnectedPlayers; - - explicit FConnectedPlayersResponse(const TSharedPtr JsonObject) - { - JsonObject->TryGetStringArrayField(TEXT("list"), ConnectedPlayers); - } -}; - USTRUCT(BlueprintType) struct FCounterResponse { diff --git a/sdks/unreal/Agones/Source/Agones/Private/AgonesSubsystem.cpp b/sdks/unreal/Agones/Source/Agones/Private/AgonesSubsystem.cpp index 5ad812da25..5c233b0307 100644 --- a/sdks/unreal/Agones/Source/Agones/Private/AgonesSubsystem.cpp +++ b/sdks/unreal/Agones/Source/Agones/Private/AgonesSubsystem.cpp @@ -448,88 +448,6 @@ void UAgonesSubsystem::Reserve( Request->ProcessRequest(); } -void UAgonesSubsystem::PlayerConnect( - const FString PlayerId, const FPlayerConnectDelegate SuccessDelegate, const FAgonesErrorDelegate ErrorDelegate) -{ - const FAgonesPlayer Player = {PlayerId}; - FString Json; - if (!FJsonObjectConverter::UStructToJsonObjectString(Player, Json)) - { - ErrorDelegate.ExecuteIfBound({TEXT("Failed to serializing request")}); - return; - } - - // TODO(dom) - look at JSON encoding in UE4. - Json = Json.Replace(TEXT("playerId"), TEXT("playerID")); - - FHttpRequestRef Request = BuildAgonesRequest("alpha/player/connect", FHttpVerb::Post, Json); - Request->OnProcessRequestComplete().BindWeakLambda(this, - [SuccessDelegate, ErrorDelegate](FHttpRequestPtr HttpRequest, const FHttpResponsePtr HttpResponse, const bool bSucceeded) { - TSharedPtr JsonObject; - - if (!IsValidJsonResponse(JsonObject, bSucceeded, HttpResponse, ErrorDelegate)) - { - return; - } - - SuccessDelegate.ExecuteIfBound(FConnectedResponse(JsonObject)); - }); - Request->ProcessRequest(); -} - -void UAgonesSubsystem::PlayerDisconnect( - const FString PlayerId, const FPlayerDisconnectDelegate SuccessDelegate, const FAgonesErrorDelegate ErrorDelegate) -{ - const FAgonesPlayer Player = {PlayerId}; - FString Json; - if (!FJsonObjectConverter::UStructToJsonObjectString(Player, Json)) - { - ErrorDelegate.ExecuteIfBound({TEXT("Failed to serializing request")}); - return; - } - - // TODO(dom) - look at JSON encoding in UE4. - Json = Json.Replace(TEXT("playerId"), TEXT("playerID")); - - FHttpRequestRef Request = BuildAgonesRequest("alpha/player/disconnect", FHttpVerb::Post, Json); - Request->OnProcessRequestComplete().BindWeakLambda(this, - [SuccessDelegate, ErrorDelegate](FHttpRequestPtr HttpRequest, const FHttpResponsePtr HttpResponse, const bool bSucceeded) { - TSharedPtr JsonObject; - - if (!IsValidJsonResponse(JsonObject, bSucceeded, HttpResponse, ErrorDelegate)) - { - return; - } - - SuccessDelegate.ExecuteIfBound(FDisconnectResponse(JsonObject)); - }); - Request->ProcessRequest(); -} - -void UAgonesSubsystem::SetPlayerCapacity( - const int64 Count, const FSetPlayerCapacityDelegate SuccessDelegate, const FAgonesErrorDelegate ErrorDelegate) -{ - const FPlayerCapacity PlayerCapacity = {Count}; - FString Json; - if (!FJsonObjectConverter::UStructToJsonObjectString(PlayerCapacity, Json)) - { - ErrorDelegate.ExecuteIfBound({TEXT("Failed to serializing request")}); - return; - } - - FHttpRequestRef Request = BuildAgonesRequest("alpha/player/capacity", FHttpVerb::Put, Json); - Request->OnProcessRequestComplete().BindWeakLambda(this, - [SuccessDelegate, ErrorDelegate](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, const bool bSucceeded) { - if (!IsValidResponse(bSucceeded, HttpResponse, ErrorDelegate)) - { - return; - } - - SuccessDelegate.ExecuteIfBound({}); - }); - Request->ProcessRequest(); -} - void UAgonesSubsystem::GetCounter(FString Key, FGetCounterDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate) { FHttpRequestRef Request = BuildAgonesRequest(FString::Format(TEXT("v1beta1/counters/{0}"), {Key}), FHttpVerb::Get, ""); @@ -589,87 +507,6 @@ FTimerManager* UAgonesSubsystem::GetTimerManager() const return TimerManager.Get(); } -void UAgonesSubsystem::GetPlayerCapacity(FGetPlayerCapacityDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate) -{ - FHttpRequestRef Request = BuildAgonesRequest("alpha/player/capacity", FHttpVerb::Get, ""); - Request->OnProcessRequestComplete().BindWeakLambda(this, - [SuccessDelegate, ErrorDelegate](FHttpRequestPtr HttpRequest, const FHttpResponsePtr HttpResponse, const bool bSucceeded) { - TSharedPtr JsonObject; - - if (!IsValidJsonResponse(JsonObject, bSucceeded, HttpResponse, ErrorDelegate)) - { - return; - } - - SuccessDelegate.ExecuteIfBound(FCountResponse(JsonObject)); - }); - Request->ProcessRequest(); -} - -void UAgonesSubsystem::GetPlayerCount(FGetPlayerCountDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate) -{ - FHttpRequestRef Request = BuildAgonesRequest("alpha/player/count", FHttpVerb::Get, ""); - Request->OnProcessRequestComplete().BindWeakLambda(this, - [SuccessDelegate, ErrorDelegate](FHttpRequestPtr HttpRequest, const FHttpResponsePtr HttpResponse, const bool bSucceeded) { - TSharedPtr JsonObject; - - if (!IsValidJsonResponse(JsonObject, bSucceeded, HttpResponse, ErrorDelegate)) - { - return; - } - - SuccessDelegate.ExecuteIfBound(FCountResponse(JsonObject)); - }); - Request->ProcessRequest(); -} - -void UAgonesSubsystem::IsPlayerConnected( - const FString PlayerId, const FIsPlayerConnectedDelegate SuccessDelegate, const FAgonesErrorDelegate ErrorDelegate) -{ - FHttpRequestRef Request = BuildAgonesRequest( - FString::Format(TEXT("alpha/player/connected/{0}"), - static_cast( - TArray>{ - FStringFormatArg(PlayerId) - } - ) - ), - FHttpVerb::Get, - "" - ); - - Request->OnProcessRequestComplete().BindWeakLambda(this, - [SuccessDelegate, ErrorDelegate](FHttpRequestPtr HttpRequest, const FHttpResponsePtr HttpResponse, const bool bSucceeded) { - TSharedPtr JsonObject; - - if (!IsValidJsonResponse(JsonObject, bSucceeded, HttpResponse, ErrorDelegate)) - { - return; - } - - SuccessDelegate.ExecuteIfBound(FConnectedResponse(JsonObject)); - }); - Request->ProcessRequest(); -} - -void UAgonesSubsystem::GetConnectedPlayers( - const FGetConnectedPlayersDelegate SuccessDelegate, const FAgonesErrorDelegate ErrorDelegate) -{ - FHttpRequestRef Request = BuildAgonesRequest("alpha/player/connected/{0}", FHttpVerb::Get, ""); - Request->OnProcessRequestComplete().BindWeakLambda(this, - [SuccessDelegate, ErrorDelegate](FHttpRequestPtr HttpRequest, const FHttpResponsePtr HttpResponse, const bool bSucceeded) { - TSharedPtr JsonObject; - - if (!IsValidJsonResponse(JsonObject, bSucceeded, HttpResponse, ErrorDelegate)) - { - return; - } - - SuccessDelegate.ExecuteIfBound(FConnectedPlayersResponse(JsonObject)); - }); - Request->ProcessRequest(); -} - void UAgonesSubsystem::GetList(const FString& Key, FListDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate) { const FString Path = FString::Printf(TEXT("v1beta1/lists/%s"), *Key); diff --git a/sdks/unreal/Agones/Source/Agones/Public/AgonesSubsystem.h b/sdks/unreal/Agones/Source/Agones/Public/AgonesSubsystem.h index 109376adfc..59611e85d5 100644 --- a/sdks/unreal/Agones/Source/Agones/Public/AgonesSubsystem.h +++ b/sdks/unreal/Agones/Source/Agones/Public/AgonesSubsystem.h @@ -31,20 +31,8 @@ DECLARE_DYNAMIC_DELEGATE_OneParam(FAllocateDelegate, const FEmptyResponse&, Resp DECLARE_DYNAMIC_DELEGATE_OneParam(FGameServerDelegate, const FGameServerResponse&, Response); -DECLARE_DYNAMIC_DELEGATE_OneParam(FGetConnectedPlayersDelegate, const FConnectedPlayersResponse&, Response); - -DECLARE_DYNAMIC_DELEGATE_OneParam(FGetPlayerCapacityDelegate, const FCountResponse&, Response); - -DECLARE_DYNAMIC_DELEGATE_OneParam(FGetPlayerCountDelegate, const FCountResponse&, Response); - DECLARE_DYNAMIC_DELEGATE_OneParam(FHealthDelegate, const FEmptyResponse&, Response); -DECLARE_DYNAMIC_DELEGATE_OneParam(FIsPlayerConnectedDelegate, const FConnectedResponse&, Response); - -DECLARE_DYNAMIC_DELEGATE_OneParam(FPlayerConnectDelegate, const FConnectedResponse&, Response); - -DECLARE_DYNAMIC_DELEGATE_OneParam(FPlayerDisconnectDelegate, const FDisconnectResponse&, Response); - DECLARE_DYNAMIC_DELEGATE_OneParam(FReadyDelegate, const FEmptyResponse&, Response); DECLARE_DYNAMIC_DELEGATE_OneParam(FReserveDelegate, const FEmptyResponse&, Response); @@ -53,8 +41,6 @@ DECLARE_DYNAMIC_DELEGATE_OneParam(FSetAnnotationDelegate, const FEmptyResponse&, DECLARE_DYNAMIC_DELEGATE_OneParam(FSetLabelDelegate, const FEmptyResponse&, Response); -DECLARE_DYNAMIC_DELEGATE_OneParam(FSetPlayerCapacityDelegate, const FEmptyResponse&, Response); - DECLARE_DYNAMIC_DELEGATE_OneParam(FGetCounterDelegate, const FCounterResponse&, Response); DECLARE_DYNAMIC_DELEGATE_OneParam(FIncrementCounterDelegate, const FEmptyResponse&, Response); @@ -267,68 +253,6 @@ class AGONES_API UAgonesSubsystem : public UGameInstanceSubsystem UFUNCTION(BlueprintCallable, Category = "Agones | Lifecycle") void Shutdown(FShutdownDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - /** - * \brief [Alpha] GetConnectedPlayers returns the list of the currently connected player ids. - * \param SuccessDelegate - Called on Successful call. - * \param ErrorDelegate - Called on Unsuccessful call. - */ - UFUNCTION(BlueprintCallable, Category = "Agones | Alpha | Player Tracking") - void GetConnectedPlayers(FGetConnectedPlayersDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - - /** - * \brief [Alpha] GetPlayerCapacity gets the last player capacity that was set through the SDK. - * \param SuccessDelegate - Called on Successful call. - * \param ErrorDelegate - Called on Unsuccessful call. - */ - UFUNCTION(BlueprintCallable, Category = "Agones | Alpha | Player Tracking") - void GetPlayerCapacity(FGetPlayerCapacityDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - - /** - * \brief [Alpha] GetPlayerCount returns the current player count - * \param SuccessDelegate - Called on Successful call. - * \param ErrorDelegate - Called on Unsuccessful call. - */ - UFUNCTION(BlueprintCallable, Category = "Agones | Alpha | Player Tracking") - void GetPlayerCount(FGetPlayerCountDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - - /** - * \brief [Alpha] IsPlayerConnected returns if the playerID is currently connected to the GameServer. - * \param PlayerId - PlayerID of player to check. - * \param SuccessDelegate - Called on Successful call. - * \param ErrorDelegate - Called on Unsuccessful call. - */ - UFUNCTION(BlueprintCallable, Category = "Agones | Alpha | Player Tracking") - void IsPlayerConnected(FString PlayerId, FIsPlayerConnectedDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - - /** - * \brief [Alpha] PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to status.players.id. - * \param PlayerId - PlayerID of connecting player. - * \param SuccessDelegate - Called on Successful call. - * \param ErrorDelegate - Called on Unsuccessful call. - */ - UFUNCTION(BlueprintCallable, Category = "Agones | Alpha | Player Tracking") - void PlayerConnect(FString PlayerId, FPlayerConnectDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - - /** - * \brief [Alpha] PlayerDisconnect Decreases the SDK’s stored player count by one, and removes the playerID from - * status.players.id. - * - * \param PlayerId - PlayerID of disconnecting player. - * \param SuccessDelegate - Called on Successful call. - * \param ErrorDelegate - Called on Unsuccessful call. - */ - UFUNCTION(BlueprintCallable, Category = "Agones | Alpha | Player Tracking") - void PlayerDisconnect(FString PlayerId, FPlayerDisconnectDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - - /** - * \brief [Alpha] SetPlayerCapacity changes the player capacity to a new value. - * \param Count - Capacity of game server. - * \param SuccessDelegate - Called on Successful call. - * \param ErrorDelegate - Called on Unsuccessful call. - */ - UFUNCTION(BlueprintCallable, Category = "Agones | Alpha | Player Tracking") - void SetPlayerCapacity(int64 Count, FSetPlayerCapacityDelegate SuccessDelegate, FAgonesErrorDelegate ErrorDelegate); - /** * \brief [Beta] GetCounter return counter (count and capacity) associated with a Key. * \param Key - Key to counter value diff --git a/test/sdk/csharp/Program.cs b/test/sdk/csharp/Program.cs index 76b23029a6..7b836a0bbe 100644 --- a/test/sdk/csharp/Program.cs +++ b/test/sdk/csharp/Program.cs @@ -89,82 +89,6 @@ } var featureGates = Environment.GetEnvironmentVariable("FEATURE_GATES") ?? ""; -if (featureGates.Contains("PlayerTracking")) -{ - var alpha = sdk.Alpha(); - var capacity = 10; - var playerId = "1234"; - - { - var status = await alpha.SetPlayerCapacityAsync(capacity); - if (status.StatusCode != StatusCode.OK) - { - Console.Error.WriteLine( - $"Error setting player capacity. StatusCode={status.StatusCode}, Detail={status.Detail}"); - Environment.Exit(1); - } - } - - { - var c = await alpha.GetPlayerCapacityAsync(); - if (c != capacity) - { - Console.Error.WriteLine( - $"Player Capacity should be {capacity}, but is {c}"); - Environment.Exit(1); - } - } - - { - var ok = await alpha.PlayerConnectAsync(playerId); - if (!ok) - { - Console.Error.WriteLine( - $"PlayerConnect returned false"); - Environment.Exit(1); - } - } - - { - var ok = await alpha.IsPlayerConnectedAsync(playerId); - if (!ok) - { - Console.Error.WriteLine( - $"IsPlayerConnected returned false"); - Environment.Exit(1); - } - } - - { - var players = await alpha.GetConnectedPlayersAsync(); - if (players.Count == 0) - { - Console.Error.WriteLine( - $"No connected players returned"); - Environment.Exit(1); - } - } - - { - var ok = await alpha.PlayerDisconnectAsync(playerId); - if (!ok) - { - Console.Error.WriteLine( - $"PlayerDisconnect returned false"); - Environment.Exit(1); - } - } - - { - var c = await alpha.GetPlayerCountAsync(); - if (c != 0) - { - Console.Error.WriteLine( - $"Player Count should be 0, but is {c}"); - Environment.Exit(1); - } - } -} if (featureGates.Contains("CountsAndLists")) // Tests are expected to run sequentially on the same pre-defined Counter in the localsdk server diff --git a/test/sdk/go/sdk-client-test.go b/test/sdk/go/sdk-client-test.go index 75ec1cd330..965d8fdd6c 100644 --- a/test/sdk/go/sdk-client-test.go +++ b/test/sdk/go/sdk-client-test.go @@ -115,10 +115,6 @@ func main() { log.Fatalf("Could not set annotation: %s", err) } - if runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { - testPlayerTracking(sdk) - } - if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { testCounts(sdk) testLists(sdk) @@ -136,52 +132,6 @@ func main() { time.Sleep(time.Duration(gracefulTerminationDelaySec) * time.Second) } -func testPlayerTracking(sdk *goSdk.SDK) { - capacity := int64(10) - if err := sdk.Alpha().SetPlayerCapacity(capacity); err != nil { - log.Fatalf("Error setting player capacity: %s", err) - } - - c, err := sdk.Alpha().GetPlayerCapacity() - if err != nil { - log.Fatalf("Error getting player capacity: %s", err) - } - if c != capacity { - log.Fatalf("Player Capacity should be %d, but is %d", capacity, c) - } - - playerID := "1234" - if ok, err := sdk.Alpha().PlayerConnect(playerID); err != nil { - log.Fatalf("Error registering player as connected: %s", err) - } else if !ok { - log.Fatalf("PlayerConnect returned false") - } - - if ok, err := sdk.Alpha().IsPlayerConnected(playerID); err != nil { - log.Fatalf("Error checking if player is connected: %s", err) - } else if !ok { - log.Fatalf("IsPlayerConnected returned false") - } - - if list, err := sdk.Alpha().GetConnectedPlayers(); err != nil { - log.Fatalf("Error getting connected player: %s", err) - } else if len(list) == 0 { - log.Fatalf("No connected players returned") - } - - if ok, err := sdk.Alpha().PlayerDisconnect(playerID); err != nil { - log.Fatalf("Error registering player as disconnected: %s", err) - } else if !ok { - log.Fatalf("PlayerDisconnect returned false") - } - - if c, err = sdk.Alpha().GetPlayerCount(); err != nil { - log.Fatalf("Error retrieving player count: %s", err) - } else if c != int64(0) { - log.Fatalf("Player Count should be 0, but is %d", c) - } -} - func testCounts(sdk *goSdk.SDK) { // LocalSDKServer starting "rooms": {Count: 1, Capacity: 10} counter := "rooms" diff --git a/test/sdk/python/testSDKClient.py b/test/sdk/python/testSDKClient.py index d5f9465508..2ca0cf61f4 100644 --- a/test/sdk/python/testSDKClient.py +++ b/test/sdk/python/testSDKClient.py @@ -23,42 +23,6 @@ from agones import AgonesSDK - -def run_player_tracking(alpha): - print("python: Setting player capacity...") - alpha.set_player_capacity(10) - - capacity = alpha.get_player_capacity() - print(f"python: Player capacity: {capacity}") - - player_id = "1234" - print("python: Increasing the player count...") - added = alpha.player_connect(player_id) - if not added: - raise RuntimeError("Failed to add player") - print("python: Added player") - - connected = alpha.is_player_connected(player_id) - if not connected: - raise RuntimeError(f"{player_id} is not connected") - print(f"python: {player_id} is connected") - - players = alpha.get_connected_players() - print(f"python: Connected players: {players}") - - count = alpha.get_player_count() - print(f"python: Current player count: {count}") - - print("python: Decreasing the player count...") - removed = alpha.player_disconnect(player_id) - if not removed: - raise RuntimeError("Failed to remove player") - print("python: Removed player") - - count = alpha.get_player_count() - print(f"python: Current player count: {count}") - - def run_counts_and_lists(beta): counter = "rooms" print("python: Getting Counter count...") @@ -152,8 +116,6 @@ def on_game_server(gs): print("python: ...Allocated") feature_gates = os.environ.get("FEATURE_GATES", "") - if "PlayerTracking=true" in feature_gates: - run_player_tracking(sdk.alpha) if "CountsAndLists=true" in feature_gates: run_counts_and_lists(sdk.beta) diff --git a/test/sdk/restapi/alpha/swagger/api_sdk.go b/test/sdk/restapi/alpha/swagger/api_sdk.go deleted file mode 100644 index 2cb40d8a01..0000000000 --- a/test/sdk/restapi/alpha/swagger/api_sdk.go +++ /dev/null @@ -1,632 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. - -/* - * alpha.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: version not set - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -import ( - "context" - "io/ioutil" - "net/http" - "net/url" - "strings" - "fmt" -) - -// Linger please -var ( - _ context.Context -) - -type SDKApiService service -/* -SDKApiService Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, even if the value has yet to be updated on the GameServer status resource. -If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return AlphaPlayerIdList -*/ -func (a *SDKApiService) GetConnectedPlayers(ctx context.Context) (AlphaPlayerIdList, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaPlayerIdList - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/alpha/player/connected" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaPlayerIdList - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService Retrieves the current player capacity. This is always accurate from what has been set through this SDK, even if the value has yet to be updated on the GameServer status resource. -If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return AlphaCount -*/ -func (a *SDKApiService) GetPlayerCapacity(ctx context.Context) (AlphaCount, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaCount - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/alpha/player/capacity" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaCount - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService Retrieves the current player count. This is always accurate from what has been set through this SDK, even if the value has yet to be updated on the GameServer status resource. -If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@return AlphaCount -*/ -func (a *SDKApiService) GetPlayerCount(ctx context.Context) (AlphaCount, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaCount - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/alpha/player/count" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaCount - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK, even if the value has yet to be updated on the GameServer status resource. -If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param playerID -@return AlphaBool -*/ -func (a *SDKApiService) IsPlayerConnected(ctx context.Context, playerID string) (AlphaBool, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaBool - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/alpha/player/connected/{playerID}" - localVarPath = strings.Replace(localVarPath, "{"+"playerID"+"}", fmt.Sprintf("%v", playerID), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaBool - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs. -GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, unless there is already an update pending, in which case the update joins that batch operation. PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the list of connected playerIDs. If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of connected playerIDs will be left unchanged. An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for the server has been reached. The playerID will not be added to the list of playerIDs. Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count through the Kubernetes API, as indeterminate results will occur. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body The unique identifier for a given player. -@return AlphaBool -*/ -func (a *SDKApiService) PlayerConnect(ctx context.Context, body AlphaPlayerId) (AlphaBool, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaBool - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/alpha/player/connect" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaBool - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs. -GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now, unless there is already an update pending, in which case the update joins that batch operation. PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the playerID value exists within the list. If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list will be left unchanged. Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count through the Kubernetes API, as indeterminate results will occur. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body The unique identifier for a given player. -@return AlphaBool -*/ -func (a *SDKApiService) PlayerDisconnect(ctx context.Context, body AlphaPlayerId) (AlphaBool, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaBool - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/alpha/player/disconnect" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaBool - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService Update the GameServer.Status.Players.Capacity value with a new capacity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body Store a count variable. -@return AlphaEmpty -*/ -func (a *SDKApiService) SetPlayerCapacity(ctx context.Context, body AlphaCount) (AlphaEmpty, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Put") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaEmpty - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/alpha/player/capacity" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaEmpty - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} diff --git a/test/sdk/restapi/alpha/swagger/client.go b/test/sdk/restapi/alpha/swagger/client.go index a1f46cb0fe..2d7f2443e9 100644 --- a/test/sdk/restapi/alpha/swagger/client.go +++ b/test/sdk/restapi/alpha/swagger/client.go @@ -58,8 +58,6 @@ type APIClient struct { common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services - - SDKApi *SDKApiService } type service struct { @@ -78,7 +76,6 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services - c.SDKApi = (*SDKApiService)(&c.common) return c } diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_bool.go b/test/sdk/restapi/alpha/swagger/model_alpha_bool.go deleted file mode 100644 index 9ab131c594..0000000000 --- a/test/sdk/restapi/alpha/swagger/model_alpha_bool.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. -/* - * alpha.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: version not set - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type AlphaBool struct { - Bool_ bool `json:"bool,omitempty"` -} diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_count.go b/test/sdk/restapi/alpha/swagger/model_alpha_count.go deleted file mode 100644 index 3ac7d6f333..0000000000 --- a/test/sdk/restapi/alpha/swagger/model_alpha_count.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. -/* - * alpha.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: version not set - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -// Store a count variable. -type AlphaCount struct { - Count string `json:"count,omitempty"` -} diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_empty.go b/test/sdk/restapi/alpha/swagger/model_alpha_empty.go deleted file mode 100644 index ff00e746dd..0000000000 --- a/test/sdk/restapi/alpha/swagger/model_alpha_empty.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. -/* - * alpha.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: version not set - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type AlphaEmpty struct { -} diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_player_id.go b/test/sdk/restapi/alpha/swagger/model_alpha_player_id.go deleted file mode 100644 index 016ee10c7f..0000000000 --- a/test/sdk/restapi/alpha/swagger/model_alpha_player_id.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. -/* - * alpha.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: version not set - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -// The unique identifier for a given player. -type AlphaPlayerId struct { - PlayerID string `json:"playerID,omitempty"` -} diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_player_id_list.go b/test/sdk/restapi/alpha/swagger/model_alpha_player_id_list.go deleted file mode 100644 index 3566d84cf6..0000000000 --- a/test/sdk/restapi/alpha/swagger/model_alpha_player_id_list.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. -/* - * alpha.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: version not set - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type AlphaPlayerIdList struct { - List []string `json:"list,omitempty"` -} diff --git a/test/sdk/restapi/http-api-test.go b/test/sdk/restapi/http-api-test.go index 25fa909e89..cf1b2760b0 100644 --- a/test/sdk/restapi/http-api-test.go +++ b/test/sdk/restapi/http-api-test.go @@ -23,7 +23,6 @@ import ( "github.com/google/go-cmp/cmp" "golang.org/x/net/context" - alpha "agones.dev/agones/test/sdk/restapi/alpha/swagger" beta "agones.dev/agones/test/sdk/restapi/beta/swagger" "agones.dev/agones/test/sdk/restapi/swagger" ) @@ -35,11 +34,6 @@ func main() { conf.BasePath = "http://localhost:" + portStr cli := swagger.NewAPIClient(conf) - log.Println("Alpha Client is starting") - alphaConf := alpha.NewConfiguration() - alphaConf.BasePath = "http://localhost:" + portStr - alphaCli := alpha.NewAPIClient(alphaConf) - log.Println("Beta Client is starting") betaConf := beta.NewConfiguration() betaConf.BasePath = "http://localhost:" + portStr @@ -120,13 +114,6 @@ func main() { log.Fatalf("Could not SetAnnotation: %v\n", err) } - // easy feature flag check - if strings.Contains(os.Getenv("FEATURE_GATES"), "PlayerTracking=true") { - testPlayers(ctx, alphaCli) - } else { - log.Print("Player Tracking not enabled, skipping.") - } - if strings.Contains(os.Getenv("FEATURE_GATES"), "CountsAndLists=true") { testCounters(ctx, betaCli) testLists(ctx, betaCli) @@ -141,52 +128,6 @@ func main() { log.Println("REST API test finished, all queries were performed") } -func testPlayers(ctx context.Context, alphaCli *alpha.APIClient) { - capacity := "10" - if _, _, err := alphaCli.SDKApi.SetPlayerCapacity(ctx, alpha.AlphaCount{Count: capacity}); err != nil { - log.Fatalf("Could not set Capacity: %v\n", err) - } - - count, _, err := alphaCli.SDKApi.GetPlayerCapacity(ctx) - if err != nil { - log.Fatalf("Could not get Capacity: %v\n", err) - } - if count.Count != capacity { - log.Fatalf("Player Capacity should be %s, but is %s", capacity, count.Count) - } - - playerID := "1234" - if ok, _, err := alphaCli.SDKApi.PlayerConnect(ctx, alpha.AlphaPlayerId{PlayerID: playerID}); err != nil { - log.Fatalf("Error registering player as connected: %s", err) - } else if !ok.Bool_ { - log.Fatalf("PlayerConnect returned false") - } - - if ok, _, err := alphaCli.SDKApi.IsPlayerConnected(ctx, playerID); err != nil { - log.Fatalf("Error checking if player is connected: %s", err) - } else if !ok.Bool_ { - log.Fatalf("IsPlayerConnected returned false") - } - - if list, _, err := alphaCli.SDKApi.GetConnectedPlayers(ctx); err != nil { - log.Fatalf("Error getting connected player: %s", err) - } else if len(list.List) == 0 { - log.Fatalf("No connected players returned") - } - - if ok, _, err := alphaCli.SDKApi.PlayerDisconnect(ctx, alpha.AlphaPlayerId{PlayerID: playerID}); err != nil { - log.Fatalf("Error registering player as disconnected: %s", err) - } else if !ok.Bool_ { - log.Fatalf("PlayerDisconnect returned false") - } - - if count, _, err := alphaCli.SDKApi.GetPlayerCount(ctx); err != nil { - log.Fatalf("Error retrieving player count: %s", err) - } else if count.Count != "0" { - log.Fatalf("Player Count should be 0, but is %v", count) - } -} - func testCounters(ctx context.Context, betaCli *beta.APIClient) { // Tests are expected to run sequentially on the same pre-defined Counter in the localsdk server counterName := "rooms" diff --git a/test/sdk/restapi/swagger/model_sdk_game_server_status.go b/test/sdk/restapi/swagger/model_sdk_game_server_status.go index bbc5c41215..13e128a8cf 100644 --- a/test/sdk/restapi/swagger/model_sdk_game_server_status.go +++ b/test/sdk/restapi/swagger/model_sdk_game_server_status.go @@ -28,7 +28,6 @@ type SdkGameServerStatus struct { Address string `json:"address,omitempty"` Addresses []StatusAddress `json:"addresses,omitempty"` Ports []StatusPort `json:"ports,omitempty"` - Players *StatusPlayerStatus `json:"players,omitempty"` Counters map[string]StatusCounterStatus `json:"counters,omitempty"` Lists map[string]StatusListStatus `json:"lists,omitempty"` } diff --git a/test/sdk/restapi/swagger/model_status_player_status.go b/test/sdk/restapi/swagger/model_status_player_status.go deleted file mode 100644 index 2dec3772e9..0000000000 --- a/test/sdk/restapi/swagger/model_status_player_status.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright Contributors to Agones a Series of LF Projects, 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. - -// This code was autogenerated. Do not edit directly. -/* - * sdk.proto - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: version not set - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type StatusPlayerStatus struct { - Count string `json:"count,omitempty"` - Capacity string `json:"capacity,omitempty"` - Ids []string `json:"ids,omitempty"` -} diff --git a/test/sdk/rust/src/main.rs b/test/sdk/rust/src/main.rs index 1d69703bb3..0b40d4056d 100644 --- a/test/sdk/rust/src/main.rs +++ b/test/sdk/rust/src/main.rs @@ -181,9 +181,6 @@ fn run_sync() -> Result<(), String> { })?; let feature_gates = env::var("FEATURE_GATES").unwrap_or_default(); - if feature_gates.contains("PlayerTracking=true") { - run_player_tracking_features(sdk.alpha().clone())?; - } if feature_gates.contains("CountsAndLists=true") { run_counts_and_lists_features(sdk.beta().clone())?; } @@ -206,93 +203,6 @@ fn run_sync() -> Result<(), String> { Ok(()) } -fn run_player_tracking_features(mut alpha: agones::alpha::Alpha) -> Result<(), String> { - use tokio::runtime::Handle; - - println!("rust: Setting player capacity..."); - Handle::current().block_on(async { - alpha - .set_player_capacity(10) - .await - .map_err(|e| format!("Could not run SetPlayerCapacity(): {:#?}. Exiting!", e)) - })?; - - println!("rust: Getting player capacity..."); - let capacity = Handle::current().block_on(async { - alpha - .get_player_capacity() - .await - .map_err(|e| format!("Could not run GetPlayerCapacity(): {}. Exiting!", e)) - })?; - println!("rust: Player capacity: {}", capacity); - - println!("rust: Increasing the player count..."); - let player_id = "1234".to_string(); - - let added = Handle::current().block_on(async { - alpha - .player_connect(&player_id) - .await - .map_err(|e| format!("Could not run PlayerConnect(): {}. Exiting!", e)) - })?; - if added { - println!("rust: Added player"); - } else { - panic!("rust: Failed to add player. Exiting!"); - } - - let connected = Handle::current().block_on(async { - alpha - .is_player_connected(&player_id) - .await - .map_err(|e| format!("Could not run IsPlayerConnected(): {}. Exiting!", e)) - })?; - if connected { - println!("rust: {} is connected", player_id); - } else { - panic!("rust: {} is not connected. Exiting!", player_id); - } - - let player_ids = Handle::current().block_on(async { - alpha - .get_connected_players() - .await - .map_err(|e| format!("Could not run GetConnectedPlayers(): {}. Exiting!", e)) - })?; - println!("rust: Connected players: {:?}", player_ids); - - let player_count = Handle::current().block_on(async { - alpha - .get_player_count() - .await - .map_err(|e| format!("Could not run GetConnectedPlayers(): {}. Exiting!", e)) - })?; - println!("rust: Current player count: {}", player_count); - - println!("rust: Decreasing the player count..."); - let removed = Handle::current().block_on(async { - alpha - .player_disconnect(&player_id) - .await - .map_err(|e| format!("Could not run PlayerDisconnect(): {}. Exiting!", e)) - })?; - if removed { - println!("rust: Removed player"); - } else { - panic!("rust: Failed to remove player. Exiting!"); - } - - let player_count = Handle::current().block_on(async { - alpha - .get_player_count() - .await - .map_err(|e| format!("Could not GetPlayerCount(): {}. Exiting!", e)) - })?; - println!("rust: Current player count: {}", player_count); - - Ok(()) -} - fn run_counts_and_lists_features(mut beta: agones::beta::Beta) -> Result<(), String> { use tokio::runtime::Handle; @@ -529,9 +439,6 @@ async fn run_async() -> Result<(), String> { .map_err(|e| format!("Could not run SetLabel(): {}. Exiting!", e))?; let feature_gates = env::var("FEATURE_GATES").unwrap_or_default(); - if feature_gates.contains("PlayerTracking=true") { - run_player_tracking_features_async(sdk.alpha().clone()).await?; - } if feature_gates.contains("CountsAndLists=true") { run_counts_and_lists_features_async(sdk.beta().clone()).await?; } @@ -552,74 +459,6 @@ async fn run_async() -> Result<(), String> { Ok(()) } -async fn run_player_tracking_features_async(mut alpha: agones::alpha::Alpha) -> Result<(), String> { - println!("rust_async: Setting player capacity..."); - alpha - .set_player_capacity(10) - .await - .map_err(|e| format!("Could not run SetPlayerCapacity(): {}. Exiting!", e))?; - - println!("rust_async: Getting player capacity..."); - let capacity = alpha - .get_player_capacity() - .await - .map_err(|e| format!("Could not run GetPlayerCapacity(): {}. Exiting!", e))?; - println!("rust_async: Player capacity: {}", capacity); - - println!("rust_async: Increasing the player count..."); - let player_id = "1234".to_string(); - let added = alpha - .player_connect(&player_id) - .await - .map_err(|e| format!("Could not run PlayerConnect(): {}. Exiting!", e))?; - if added { - println!("Added player"); - } else { - panic!("rust_async: Failed to add player. Exiting!"); - } - - let connected = alpha - .is_player_connected(&player_id) - .await - .map_err(|e| format!("Could not run IsPlayerConnected(): {}. Exiting!", e))?; - if connected { - println!("rust_async: {} is connected", player_id); - } else { - panic!("rust_async: {} is not connected. Exiting!", player_id); - } - - let player_ids = alpha - .get_connected_players() - .await - .map_err(|e| format!("Could not run GetConnectedPlayers(): {}. Exiting!", e))?; - println!("rust_async: Connected players: {:?}", player_ids); - - let player_count = alpha - .get_player_count() - .await - .map_err(|e| format!("Could not run GetConnectedPlayers(): {}. Exiting!", e))?; - println!("rust_async: Current player count: {}", player_count); - - println!("rust_async: Decreasing the player count..."); - let removed = alpha - .player_disconnect(&player_id) - .await - .map_err(|e| format!("Could not run PlayerDisconnect(): {}. Exiting!", e))?; - if removed { - println!("rust_async: Removed player"); - } else { - panic!("rust_async: Failed to remove player. Exiting!"); - } - - let player_count = alpha - .get_player_count() - .await - .map_err(|e| format!("Could not GetPlayerCount(): {}. Exiting!", e))?; - println!("rust_async: Current player count: {}", player_count); - - Ok(()) -} - async fn run_counts_and_lists_features_async(mut beta: agones::beta::Beta) -> Result<(), String> { // Counter tests let counter = "rooms";