rpc

package
v0.0.0-...-466853b Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidJSON  = lobby.Error("invalid_json")
	ErrInternal     = lobby.Error("internal_error")
	ErrEmptyContent = lobby.Error("empty_content")
)

HTTP errors

Variables

This section is empty.

Functions

func LoadBackendPlugin

func LoadBackendPlugin(ctx context.Context, name, cmdPath, dataDir, configFile string) (lobby.Backend, lobby.Plugin, error)

LoadBackendPlugin loads a backend plugin.

func LoadPlugin

func LoadPlugin(ctx context.Context, name, cmdPath, dataDir, configFile string) (lobby.Plugin, error)

LoadPlugin loads a plugin.

func NewServer

func NewServer(logger *log.Logger, services ...func(*grpc.Server, *log.Logger)) lobby.Server

NewServer returns a configured gRPC server.

func WithRegistryService

func WithRegistryService(r lobby.Registry) func(*grpc.Server, *log.Logger)

WithRegistryService enables the RegistryService.

func WithTopicService

func WithTopicService(b lobby.Backend) func(*grpc.Server, *log.Logger)

WithTopicService enables the TopicService.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is a gRPC backend.

func NewBackend

func NewBackend(conn *grpc.ClientConn) (*Backend, error)

NewBackend returns a gRPC backend. It is used to communicate with external backends.

func (*Backend) Close

func (s *Backend) Close() error

Close does nothing.

func (*Backend) Topic

func (s *Backend) Topic(name string) (lobby.Topic, error)

Topic returns the topic associated with the given name.

type Registry

type Registry struct {
	lobby.Backend
	// contains filtered or unexported fields
}

Registry is a gRPC Registry.

func NewRegistry

func NewRegistry(conn *grpc.ClientConn) (*Registry, error)

NewRegistry returns a gRPC Registry. It is used to communicate with external Registries.

func (*Registry) Close

func (s *Registry) Close() error

Close the connexion to the Registry.

func (*Registry) Create

func (s *Registry) Create(backendName, topicName string) error

Create a topic and register it to the Registry.

func (*Registry) RegisterBackend

func (s *Registry) RegisterBackend(_ string, _ lobby.Backend)

RegisterBackend should never be called on this type.

func (*Registry) Topic

func (s *Registry) Topic(name string) (lobby.Topic, error)

Topic returns the topic associated with the given id.

type Topic

type Topic struct {
	// contains filtered or unexported fields
}

Topic is a gRPC implementation of a topic.

func NewTopic

func NewTopic(name string, client proto.TopicServiceClient) *Topic

NewTopic returns a Topic.

func (*Topic) Close

func (t *Topic) Close() error

Close the topic session.

func (*Topic) Send

func (t *Topic) Send(message *lobby.Message) error

Send a message to the topic.

Directories

Path Synopsis
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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