hosting

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRunning  error = errors.New("host already running")
	ErrModuleDuplicate error = errors.New("module already exists")
	ErrModuleNotFound  error = errors.New("module not found")
)

Functions

This section is empty.

Types

type Database

type Database interface {
	LoadConfig(configPath string) error
}

type GrpcConfig

type GrpcConfig interface {
	GetBindAddress() string
}

type Host

type Host interface {
	Run() error
	GetConfig() HostConfig
	GetConfigPath() string
	SetConfigPath(configPath string)
	GetHttpRouter() *mux.Router
	SetHttpRouter(router *mux.Router)
	GetGrpcServer() *grpc.Server
	SetGrpcServer(server *grpc.Server)
	UseMiddleware(middleware MiddlewareFunc)
	AddModule(name string, module Module) error
	GetModule(name string) (Module, error)
	IsRunning() bool
}

func NewHost

func NewHost() Host

type HostConfig

type HostConfig interface {
	Load(configPath string) error
	GetHttpConfig() HttpConfig
	GetGrpcConfig() GrpcConfig
}

type HttpConfig

type HttpConfig interface {
	GetBindAddress() string
}

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type Module

type Module interface {
	LoadConfig(configPath string) error
	RegisterApiRoutes(router *mux.Router) error
	RegisterGrpcServices(server *grpc.Server) error
}

Jump to

Keyboard shortcuts

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