alpha

package
v1.5.0-rc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package alpha is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterSDKHandler

func RegisterSDKHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSDKHandler registers the http handlers for service SDK to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSDKHandlerClient

func RegisterSDKHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SDKClient) error

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.

func RegisterSDKHandlerFromEndpoint

func RegisterSDKHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSDKHandlerFromEndpoint is same as RegisterSDKHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSDKHandlerServer

func RegisterSDKHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SDKServer) error

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.

func RegisterSDKServer

func RegisterSDKServer(s *grpc.Server, srv SDKServer)

Types

type Count

type Count struct {
	Count                int64    `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Store a count variable.

func (*Count) Descriptor

func (*Count) Descriptor() ([]byte, []int)

func (*Count) GetCount

func (m *Count) GetCount() int64

func (*Count) ProtoMessage

func (*Count) ProtoMessage()

func (*Count) Reset

func (m *Count) Reset()

func (*Count) String

func (m *Count) String() string

func (*Count) XXX_DiscardUnknown

func (m *Count) XXX_DiscardUnknown()

func (*Count) XXX_Marshal

func (m *Count) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Count) XXX_Merge

func (dst *Count) XXX_Merge(src proto.Message)

func (*Count) XXX_Size

func (m *Count) XXX_Size() int

func (*Count) XXX_Unmarshal

func (m *Count) XXX_Unmarshal(b []byte) error

type Empty

type Empty struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

I am Empty

func (*Empty) Descriptor

func (*Empty) Descriptor() ([]byte, []int)

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) String

func (m *Empty) String() string

func (*Empty) XXX_DiscardUnknown

func (m *Empty) XXX_DiscardUnknown()

func (*Empty) XXX_Marshal

func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Empty) XXX_Merge

func (dst *Empty) XXX_Merge(src proto.Message)

func (*Empty) XXX_Size

func (m *Empty) XXX_Size() int

func (*Empty) XXX_Unmarshal

func (m *Empty) XXX_Unmarshal(b []byte) error

type PlayerId

type PlayerId struct {
	PlayerId             string   `protobuf:"bytes,1,opt,name=playerId,proto3" json:"playerId,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

The unique identifier for a given player.

func (*PlayerId) Descriptor

func (*PlayerId) Descriptor() ([]byte, []int)

func (*PlayerId) GetPlayerId

func (m *PlayerId) GetPlayerId() string

func (*PlayerId) ProtoMessage

func (*PlayerId) ProtoMessage()

func (*PlayerId) Reset

func (m *PlayerId) Reset()

func (*PlayerId) String

func (m *PlayerId) String() string

func (*PlayerId) XXX_DiscardUnknown

func (m *PlayerId) XXX_DiscardUnknown()

func (*PlayerId) XXX_Marshal

func (m *PlayerId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PlayerId) XXX_Merge

func (dst *PlayerId) XXX_Merge(src proto.Message)

func (*PlayerId) XXX_Size

func (m *PlayerId) XXX_Size() int

func (*PlayerId) XXX_Unmarshal

func (m *PlayerId) XXX_Unmarshal(b []byte) error

type SDKClient

type SDKClient interface {
	// Call when a player has connected.
	PlayerConnect(ctx context.Context, in *PlayerId, opts ...grpc.CallOption) (*Empty, error)
	// Call when a player has disconnected.
	PlayerDisconnect(ctx context.Context, in *PlayerId, opts ...grpc.CallOption) (*Empty, error)
	// Change the player capacity to a new value.
	SetPlayerCapacity(ctx context.Context, in *Count, opts ...grpc.CallOption) (*Empty, error)
	// Get the last player capacity that was set through the SDK.
	// If the player capacity is set from outside the SDK, use SDK.GameServer() instead.
	GetPlayerCapacity(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error)
	// get the current player count
	GetPlayerCount(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Count, error)
}

SDKClient is the client API for SDK service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewSDKClient

func NewSDKClient(cc *grpc.ClientConn) SDKClient

type SDKServer

type SDKServer interface {
	// Call when a player has connected.
	PlayerConnect(context.Context, *PlayerId) (*Empty, error)
	// Call when a player has disconnected.
	PlayerDisconnect(context.Context, *PlayerId) (*Empty, error)
	// Change the player capacity to a new value.
	SetPlayerCapacity(context.Context, *Count) (*Empty, error)
	// Get the last player capacity that was set through the SDK.
	// If the player capacity is set from outside the SDK, use SDK.GameServer() instead.
	GetPlayerCapacity(context.Context, *Empty) (*Count, error)
	// get the current player count
	GetPlayerCount(context.Context, *Empty) (*Count, error)
}

SDKServer is the server API for SDK service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL