appmain

package
v1.8.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package appmain contains the common application initialization code for Open Match servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunApplication

func RunApplication(serviceName string, bindService Bind)

RunApplication starts and runs the given application forever. For use in main functions to run the full application.

Types

type App

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

App is used internally, and public only for apptest. Do not use, and use apptest instead.

func NewApplication

func NewApplication(serviceName string, bindService Bind, getCfg func() (config.View, error), listen func(network, address string) (net.Listener, error)) (*App, error)

NewApplication is used internally, and public only for apptest. Do not use, and use apptest instead.

func (*App) Stop

func (a *App) Stop() error

Stop is used internally, and public only for apptest. Do not use, and use apptest instead.

type Bind

type Bind func(p *Params, b *Bindings) error

Bind is a function which starts an application, and binds it to serving.

type Bindings

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

Bindings allows applications to bind various functions to the running servers.

func (*Bindings) AddCloser

func (b *Bindings) AddCloser(c func())

AddCloser specifies a function to be called when the application is being stopped. Closers are called in reverse order.

func (*Bindings) AddCloserErr

func (b *Bindings) AddCloserErr(c func() error)

AddCloserErr specifies a function to be called when the application is being stopped. Closers are called in reverse order. The first error returned by a closer will be logged.

func (*Bindings) AddHandleFunc

func (b *Bindings) AddHandleFunc(handlerFunc rpc.GrpcHandler, grpcProxyHandler rpc.GrpcProxyHandler)

AddHandleFunc adds a protobuf service to the grpc server which is starting.

func (*Bindings) AddHealthCheckFunc

func (b *Bindings) AddHealthCheckFunc(f func(context.Context) error)

AddHealthCheckFunc allows an application to check if it is healthy, and contribute to the overall server health.

func (*Bindings) RegisterViews

func (b *Bindings) RegisterViews(v ...*view.View)

RegisterViews begins collecting data for the given views.

func (*Bindings) TelemetryHandle

func (b *Bindings) TelemetryHandle(pattern string, handler http.Handler)

TelemetryHandle adds a handler to the mux for serving debug info and metrics.

func (*Bindings) TelemetryHandleFunc

func (b *Bindings) TelemetryHandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

TelemetryHandleFunc adds a handlerfunc to the mux for serving debug info and metrics.

type Params

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

Params are inputs to starting an application.

func (*Params) Config

func (p *Params) Config() config.View

Config provides the configuration for the application.

func (*Params) ServiceName

func (p *Params) ServiceName() string

ServiceName is a name for the currently running binary specified by RunApplication.

Directories

Path Synopsis
Package apptest allows testing of binded services within memory.
Package apptest allows testing of binded services within memory.

Jump to

Keyboard shortcuts

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