asab

package
v0.0.0-...-af81d15 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// This is a global configuration (also accessible by `App.Config`)
	// It is a global because application can have only one configuration
	// and the config object has to exists before the application is initialized
	Config *ini.File
)

Functions

func AddConfigDefaults

func AddConfigDefaults(section string, values map[string]string)

func GenerateBase64Token

func GenerateBase64Token(n int) string

Generate random token using Base64 characters

func GetEnv

func GetEnv(name string, default_value string) string

os.GetEnv with default value

Types

type Application

type Application struct {
	ReturnCode int

	Hostname string
	Config   *ini.File

	PubSub PubSub
	// contains filtered or unexported fields
}

func (*Application) Finalize

func (app *Application) Finalize()

func (*Application) Initialize

func (app *Application) Initialize()

func (*Application) LocateService

func (app *Application) LocateService(service_name string) ServiceI

func (*Application) RegisterService

func (app *Application) RegisterService(svc ServiceI, service_name string)

func (*Application) Run

func (app *Application) Run()

func (*Application) Stop

func (app *Application) Stop()

Ask the application to stop and exit

func (*Application) SubscribeSignal

func (app *Application) SubscribeSignal(signo syscall.Signal)

func (*Application) UnregisterService

func (app *Application) UnregisterService(svc ServiceI)

type PubSub

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

func (*PubSub) Initialize

func (ps *PubSub) Initialize()

func (*PubSub) Publish

func (ps *PubSub) Publish(message PubSubMessage)

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe(message_type string, handler func(PubSubMessage))

type PubSubMessage

type PubSubMessage struct {
	Name string
	I    interface{}
}

type Service

type Service struct {
	App *Application
}

func (*Service) Finalize

func (svc *Service) Finalize()

func (*Service) Initialize

func (svc *Service) Initialize(app *Application)

type ServiceI

type ServiceI interface {
	Finalize()
}

type WebService

type WebService struct {
	Service

	Router *mux.Router
	Server *nbhttp.Server
	// contains filtered or unexported fields
}

func (*WebService) Debug

func (svc *WebService) Debug(format string, v ...interface{})

func (*WebService) Error

func (svc *WebService) Error(format string, v ...interface{})

func (*WebService) Finalize

func (svc *WebService) Finalize()

func (*WebService) Info

func (svc *WebService) Info(format string, v ...interface{})

func (*WebService) Initialize

func (svc *WebService) Initialize(app *Application)

func (*WebService) SetLevel

func (svc *WebService) SetLevel(lvl int)

func (*WebService) Warn

func (svc *WebService) Warn(format string, v ...interface{})

type ZookeeperService

type ZookeeperService struct {
	Service

	Address    []string
	BasePath   string
	Connection *zk.Conn
	// contains filtered or unexported fields
}

func (*ZookeeperService) Initialize

func (svc *ZookeeperService) Initialize(app *Application)

func (*ZookeeperService) Printf

func (svc *ZookeeperService) Printf(message string, v ...interface{})

Jump to

Keyboard shortcuts

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