servers

package
v0.0.0-...-e43fadc Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ST_RUNNING   = "running"
	ST_STOP      = "stop"
	ST_PAUSE     = "pause"
	SRV_TP_API   = "api"
	SRV_FILE_API = "file"
	SRV_TP_RPC   = "rpc"
	SRV_TP_CRON  = "cron"
	SRV_TP_MQ    = "mq"
	SRV_TP_WEB   = "web"
)
View Source
var IsDebug = false

Functions

func Register

func Register(identifier string, resolver IServerResolver)

Register 注册服务器生成器

func Trace

func Trace(print func(f string, args ...interface{}), args ...interface{})

Trace 打印跟踪信息

func TraceIf

func TraceIf(b bool, okPrint func(f string, args ...interface{}), print func(f string, args ...interface{}), args ...interface{})

TraceIf 根据条件打印跟踪信息

func Tracef

func Tracef(print func(f string, args ...interface{}), format string, args ...interface{})

Tracef 根据格式打印跟踪信息

Types

type IExecuteHandler

type IExecuteHandler func(ctx *context.Context) (rs interface{})

func (IExecuteHandler) Execute

func (i IExecuteHandler) Execute(ctx *context.Context) (rs interface{})

type IExecuter

type IExecuter interface {
	Execute(ctx *context.Context) (rs interface{})
}

type IRegistryEngine

type IRegistryEngine interface {
	context.IContainer
	IExecuter
	GetComponent() component.IComponent
	SetHandler(h component.IComponentHandler) error
	UpdateVarConf(conf conf.IServerConf)
	GetServices() map[string][]string
	Fallback(c *context.Context) (rs interface{})
}

IRegistryEngine 基于注册中心的执行引擎

type IRegistryServer

type IRegistryServer interface {
	Notify(conf.IServerConf) error
	Start() error
	GetAddress() string
	GetServices() map[string][]string
	Restarted() bool
	GetStatus() string
	Shutdown()
	SetPb(f func(component.IContainer, *grpc.Server))
}

IRegistryServer 基于注册中心的服务器

func NewRegistryServer

func NewRegistryServer(identifier string, registryAddr string, conf conf.IServerConf, log *logger.Logger) (IRegistryServer, error)

NewRegistryServer 根据服务标识创建服务器

type IServerResolver

type IServerResolver interface {
	Resolve(registryAddr string, conf conf.IServerConf, log *logger.Logger) (IRegistryServer, error)
}

IServerResolver 服务器生成器

type IServerResolverHandler

type IServerResolverHandler func(registryAddr string, conf conf.IServerConf, log *logger.Logger) (IRegistryServer, error)

func (IServerResolverHandler) Resolve

func (i IServerResolverHandler) Resolve(registryAddr string, conf conf.IServerConf, log *logger.Logger) (IRegistryServer, error)

Resolve 创建服务器实例

Directories

Path Synopsis
pkg
rpc
pb

Jump to

Keyboard shortcuts

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