agones.dev/agones@v1.54.0/pkg/sdk/alpha/alpha_grpc.pb.go (about)

     1  // Copyright 2024 Google LLC All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // This code was autogenerated. Do not edit directly.
    16  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    17  // versions:
    18  // - protoc-gen-go-grpc v1.2.0
    19  // - protoc             v6.31.1
    20  // source: alpha.proto
    21  
    22  package alpha
    23  
    24  import (
    25  	context "context"
    26  
    27  	grpc "google.golang.org/grpc"
    28  	codes "google.golang.org/grpc/codes"
    29  	status "google.golang.org/grpc/status"
    30  )
    31  
    32  // This is a compile-time assertion to ensure that this generated file
    33  // is compatible with the grpc package it is being compiled against.
    34  // Requires gRPC-Go v1.32.0 or later.
    35  const _ = grpc.SupportPackageIsVersion7
    36  
    37  // SDKClient is the client API for SDK service.
    38  //
    39  // 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.
    40  type SDKClient interface {
    41  	// PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs.
    42  	//
    43  	// GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,
    44  	// unless there is already an update pending, in which case the update joins that batch operation.
    45  	//
    46  	// PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the
    47  	// list of connected playerIDs.
    48  	//
    49  	// If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of
    50  	// connected playerIDs will be left unchanged.
    51  	//
    52  	// An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for
    53  	// the server has been reached. The playerID will not be added to the list of playerIDs.
    54  	//
    55  	// Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count
    56  	// through the Kubernetes API, as indeterminate results will occur.
    57  	PlayerConnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error)
    58  	// Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs.
    59  	//
    60  	// GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,
    61  	// unless there is already an update pending, in which case the update joins that batch operation.
    62  	//
    63  	// PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the
    64  	// playerID value exists within the list.
    65  	//
    66  	// If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list
    67  	// will be left unchanged.
    68  	//
    69  	// Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count
    70  	// through the Kubernetes API, as indeterminate results will occur.
    71  	PlayerDisconnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error)
    72  	// Update the GameServer.Status.Players.Capacity value with a new capacity.
    73  	SetPlayerCapacity(ctx context.Context, in *Count, opts ...grpc.CallOption) (*Empty, error)
    74  	// Retrieves the current player capacity. This is always accurate from what has been set through this SDK,
    75  	// even if the value has yet to be updated on the GameServer status resource.
    76  	//
    77  	// If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
    78  	GetPlayerCapacity(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error)
    79  	// Retrieves the current player count. This is always accurate from what has been set through this SDK,
    80  	// even if the value has yet to be updated on the GameServer status resource.
    81  	//
    82  	// If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
    83  	GetPlayerCount(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error)
    84  	// Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK,
    85  	// even if the value has yet to be updated on the GameServer status resource.
    86  	//
    87  	// If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status.
    88  	IsPlayerConnected(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error)
    89  	// Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK,
    90  	// even if the value has yet to be updated on the GameServer status resource.
    91  	//
    92  	// If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
    93  	GetConnectedPlayers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PlayerIDList, error)
    94  }
    95  
    96  type sDKClient struct {
    97  	cc grpc.ClientConnInterface
    98  }
    99  
   100  func NewSDKClient(cc grpc.ClientConnInterface) SDKClient {
   101  	return &sDKClient{cc}
   102  }
   103  
   104  func (c *sDKClient) PlayerConnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) {
   105  	out := new(Bool)
   106  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/PlayerConnect", in, out, opts...)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return out, nil
   111  }
   112  
   113  func (c *sDKClient) PlayerDisconnect(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) {
   114  	out := new(Bool)
   115  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/PlayerDisconnect", in, out, opts...)
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	return out, nil
   120  }
   121  
   122  func (c *sDKClient) SetPlayerCapacity(ctx context.Context, in *Count, opts ...grpc.CallOption) (*Empty, error) {
   123  	out := new(Empty)
   124  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity", in, out, opts...)
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  	return out, nil
   129  }
   130  
   131  func (c *sDKClient) GetPlayerCapacity(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error) {
   132  	out := new(Count)
   133  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity", in, out, opts...)
   134  	if err != nil {
   135  		return nil, err
   136  	}
   137  	return out, nil
   138  }
   139  
   140  func (c *sDKClient) GetPlayerCount(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error) {
   141  	out := new(Count)
   142  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetPlayerCount", in, out, opts...)
   143  	if err != nil {
   144  		return nil, err
   145  	}
   146  	return out, nil
   147  }
   148  
   149  func (c *sDKClient) IsPlayerConnected(ctx context.Context, in *PlayerID, opts ...grpc.CallOption) (*Bool, error) {
   150  	out := new(Bool)
   151  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/IsPlayerConnected", in, out, opts...)
   152  	if err != nil {
   153  		return nil, err
   154  	}
   155  	return out, nil
   156  }
   157  
   158  func (c *sDKClient) GetConnectedPlayers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PlayerIDList, error) {
   159  	out := new(PlayerIDList)
   160  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers", in, out, opts...)
   161  	if err != nil {
   162  		return nil, err
   163  	}
   164  	return out, nil
   165  }
   166  
   167  // SDKServer is the server API for SDK service.
   168  // All implementations should embed UnimplementedSDKServer
   169  // for forward compatibility
   170  type SDKServer interface {
   171  	// PlayerConnect increases the SDK’s stored player count by one, and appends this playerID to GameServer.Status.Players.IDs.
   172  	//
   173  	// GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,
   174  	// unless there is already an update pending, in which case the update joins that batch operation.
   175  	//
   176  	// PlayerConnect returns true and adds the playerID to the list of playerIDs if this playerID was not already in the
   177  	// list of connected playerIDs.
   178  	//
   179  	// If the playerID exists within the list of connected playerIDs, PlayerConnect will return false, and the list of
   180  	// connected playerIDs will be left unchanged.
   181  	//
   182  	// An error will be returned if the playerID was not already in the list of connected playerIDs but the player capacity for
   183  	// the server has been reached. The playerID will not be added to the list of playerIDs.
   184  	//
   185  	// Warning: Do not use this method if you are manually managing GameServer.Status.Players.IDs and GameServer.Status.Players.Count
   186  	// through the Kubernetes API, as indeterminate results will occur.
   187  	PlayerConnect(context.Context, *PlayerID) (*Bool, error)
   188  	// Decreases the SDK’s stored player count by one, and removes the playerID from GameServer.Status.Players.IDs.
   189  	//
   190  	// GameServer.Status.Players.Count and GameServer.Status.Players.IDs are then set to update the player count and id list a second from now,
   191  	// unless there is already an update pending, in which case the update joins that batch operation.
   192  	//
   193  	// PlayerDisconnect will return true and remove the supplied playerID from the list of connected playerIDs if the
   194  	// playerID value exists within the list.
   195  	//
   196  	// If the playerID was not in the list of connected playerIDs, the call will return false, and the connected playerID list
   197  	// will be left unchanged.
   198  	//
   199  	// Warning: Do not use this method if you are manually managing GameServer.status.players.IDs and GameServer.status.players.Count
   200  	// through the Kubernetes API, as indeterminate results will occur.
   201  	PlayerDisconnect(context.Context, *PlayerID) (*Bool, error)
   202  	// Update the GameServer.Status.Players.Capacity value with a new capacity.
   203  	SetPlayerCapacity(context.Context, *Count) (*Empty, error)
   204  	// Retrieves the current player capacity. This is always accurate from what has been set through this SDK,
   205  	// even if the value has yet to be updated on the GameServer status resource.
   206  	//
   207  	// If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
   208  	GetPlayerCapacity(context.Context, *Empty) (*Count, error)
   209  	// Retrieves the current player count. This is always accurate from what has been set through this SDK,
   210  	// even if the value has yet to be updated on the GameServer status resource.
   211  	//
   212  	// If GameServer.Status.Players.Count is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
   213  	GetPlayerCount(context.Context, *Empty) (*Count, error)
   214  	// Returns if the playerID is currently connected to the GameServer. This is always accurate from what has been set through this SDK,
   215  	// even if the value has yet to be updated on the GameServer status resource.
   216  	//
   217  	// If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to determine connected status.
   218  	IsPlayerConnected(context.Context, *PlayerID) (*Bool, error)
   219  	// Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK,
   220  	// even if the value has yet to be updated on the GameServer status resource.
   221  	//
   222  	// If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value.
   223  	GetConnectedPlayers(context.Context, *Empty) (*PlayerIDList, error)
   224  }
   225  
   226  // UnimplementedSDKServer should be embedded to have forward compatible implementations.
   227  type UnimplementedSDKServer struct {
   228  }
   229  
   230  func (UnimplementedSDKServer) PlayerConnect(context.Context, *PlayerID) (*Bool, error) {
   231  	return nil, status.Errorf(codes.Unimplemented, "method PlayerConnect not implemented")
   232  }
   233  func (UnimplementedSDKServer) PlayerDisconnect(context.Context, *PlayerID) (*Bool, error) {
   234  	return nil, status.Errorf(codes.Unimplemented, "method PlayerDisconnect not implemented")
   235  }
   236  func (UnimplementedSDKServer) SetPlayerCapacity(context.Context, *Count) (*Empty, error) {
   237  	return nil, status.Errorf(codes.Unimplemented, "method SetPlayerCapacity not implemented")
   238  }
   239  func (UnimplementedSDKServer) GetPlayerCapacity(context.Context, *Empty) (*Count, error) {
   240  	return nil, status.Errorf(codes.Unimplemented, "method GetPlayerCapacity not implemented")
   241  }
   242  func (UnimplementedSDKServer) GetPlayerCount(context.Context, *Empty) (*Count, error) {
   243  	return nil, status.Errorf(codes.Unimplemented, "method GetPlayerCount not implemented")
   244  }
   245  func (UnimplementedSDKServer) IsPlayerConnected(context.Context, *PlayerID) (*Bool, error) {
   246  	return nil, status.Errorf(codes.Unimplemented, "method IsPlayerConnected not implemented")
   247  }
   248  func (UnimplementedSDKServer) GetConnectedPlayers(context.Context, *Empty) (*PlayerIDList, error) {
   249  	return nil, status.Errorf(codes.Unimplemented, "method GetConnectedPlayers not implemented")
   250  }
   251  
   252  // UnsafeSDKServer may be embedded to opt out of forward compatibility for this service.
   253  // Use of this interface is not recommended, as added methods to SDKServer will
   254  // result in compilation errors.
   255  type UnsafeSDKServer interface {
   256  	mustEmbedUnimplementedSDKServer()
   257  }
   258  
   259  func RegisterSDKServer(s grpc.ServiceRegistrar, srv SDKServer) {
   260  	s.RegisterService(&SDK_ServiceDesc, srv)
   261  }
   262  
   263  func _SDK_PlayerConnect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   264  	in := new(PlayerID)
   265  	if err := dec(in); err != nil {
   266  		return nil, err
   267  	}
   268  	if interceptor == nil {
   269  		return srv.(SDKServer).PlayerConnect(ctx, in)
   270  	}
   271  	info := &grpc.UnaryServerInfo{
   272  		Server:     srv,
   273  		FullMethod: "/agones.dev.sdk.alpha.SDK/PlayerConnect",
   274  	}
   275  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   276  		return srv.(SDKServer).PlayerConnect(ctx, req.(*PlayerID))
   277  	}
   278  	return interceptor(ctx, in, info, handler)
   279  }
   280  
   281  func _SDK_PlayerDisconnect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   282  	in := new(PlayerID)
   283  	if err := dec(in); err != nil {
   284  		return nil, err
   285  	}
   286  	if interceptor == nil {
   287  		return srv.(SDKServer).PlayerDisconnect(ctx, in)
   288  	}
   289  	info := &grpc.UnaryServerInfo{
   290  		Server:     srv,
   291  		FullMethod: "/agones.dev.sdk.alpha.SDK/PlayerDisconnect",
   292  	}
   293  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   294  		return srv.(SDKServer).PlayerDisconnect(ctx, req.(*PlayerID))
   295  	}
   296  	return interceptor(ctx, in, info, handler)
   297  }
   298  
   299  func _SDK_SetPlayerCapacity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   300  	in := new(Count)
   301  	if err := dec(in); err != nil {
   302  		return nil, err
   303  	}
   304  	if interceptor == nil {
   305  		return srv.(SDKServer).SetPlayerCapacity(ctx, in)
   306  	}
   307  	info := &grpc.UnaryServerInfo{
   308  		Server:     srv,
   309  		FullMethod: "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity",
   310  	}
   311  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   312  		return srv.(SDKServer).SetPlayerCapacity(ctx, req.(*Count))
   313  	}
   314  	return interceptor(ctx, in, info, handler)
   315  }
   316  
   317  func _SDK_GetPlayerCapacity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   318  	in := new(Empty)
   319  	if err := dec(in); err != nil {
   320  		return nil, err
   321  	}
   322  	if interceptor == nil {
   323  		return srv.(SDKServer).GetPlayerCapacity(ctx, in)
   324  	}
   325  	info := &grpc.UnaryServerInfo{
   326  		Server:     srv,
   327  		FullMethod: "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity",
   328  	}
   329  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   330  		return srv.(SDKServer).GetPlayerCapacity(ctx, req.(*Empty))
   331  	}
   332  	return interceptor(ctx, in, info, handler)
   333  }
   334  
   335  func _SDK_GetPlayerCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   336  	in := new(Empty)
   337  	if err := dec(in); err != nil {
   338  		return nil, err
   339  	}
   340  	if interceptor == nil {
   341  		return srv.(SDKServer).GetPlayerCount(ctx, in)
   342  	}
   343  	info := &grpc.UnaryServerInfo{
   344  		Server:     srv,
   345  		FullMethod: "/agones.dev.sdk.alpha.SDK/GetPlayerCount",
   346  	}
   347  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   348  		return srv.(SDKServer).GetPlayerCount(ctx, req.(*Empty))
   349  	}
   350  	return interceptor(ctx, in, info, handler)
   351  }
   352  
   353  func _SDK_IsPlayerConnected_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   354  	in := new(PlayerID)
   355  	if err := dec(in); err != nil {
   356  		return nil, err
   357  	}
   358  	if interceptor == nil {
   359  		return srv.(SDKServer).IsPlayerConnected(ctx, in)
   360  	}
   361  	info := &grpc.UnaryServerInfo{
   362  		Server:     srv,
   363  		FullMethod: "/agones.dev.sdk.alpha.SDK/IsPlayerConnected",
   364  	}
   365  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   366  		return srv.(SDKServer).IsPlayerConnected(ctx, req.(*PlayerID))
   367  	}
   368  	return interceptor(ctx, in, info, handler)
   369  }
   370  
   371  func _SDK_GetConnectedPlayers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   372  	in := new(Empty)
   373  	if err := dec(in); err != nil {
   374  		return nil, err
   375  	}
   376  	if interceptor == nil {
   377  		return srv.(SDKServer).GetConnectedPlayers(ctx, in)
   378  	}
   379  	info := &grpc.UnaryServerInfo{
   380  		Server:     srv,
   381  		FullMethod: "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers",
   382  	}
   383  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   384  		return srv.(SDKServer).GetConnectedPlayers(ctx, req.(*Empty))
   385  	}
   386  	return interceptor(ctx, in, info, handler)
   387  }
   388  
   389  // SDK_ServiceDesc is the grpc.ServiceDesc for SDK service.
   390  // It's only intended for direct use with grpc.RegisterService,
   391  // and not to be introspected or modified (even as a copy)
   392  var SDK_ServiceDesc = grpc.ServiceDesc{
   393  	ServiceName: "agones.dev.sdk.alpha.SDK",
   394  	HandlerType: (*SDKServer)(nil),
   395  	Methods: []grpc.MethodDesc{
   396  		{
   397  			MethodName: "PlayerConnect",
   398  			Handler:    _SDK_PlayerConnect_Handler,
   399  		},
   400  		{
   401  			MethodName: "PlayerDisconnect",
   402  			Handler:    _SDK_PlayerDisconnect_Handler,
   403  		},
   404  		{
   405  			MethodName: "SetPlayerCapacity",
   406  			Handler:    _SDK_SetPlayerCapacity_Handler,
   407  		},
   408  		{
   409  			MethodName: "GetPlayerCapacity",
   410  			Handler:    _SDK_GetPlayerCapacity_Handler,
   411  		},
   412  		{
   413  			MethodName: "GetPlayerCount",
   414  			Handler:    _SDK_GetPlayerCount_Handler,
   415  		},
   416  		{
   417  			MethodName: "IsPlayerConnected",
   418  			Handler:    _SDK_IsPlayerConnected_Handler,
   419  		},
   420  		{
   421  			MethodName: "GetConnectedPlayers",
   422  			Handler:    _SDK_GetConnectedPlayers_Handler,
   423  		},
   424  	},
   425  	Streams:  []grpc.StreamDesc{},
   426  	Metadata: "alpha.proto",
   427  }