backbone

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(c Server, svcDisc ServiceRegisterInterface, cancel context.CancelFunc) error

func StartServer

func StartServer(ctx context.Context, cancel context.CancelFunc, e *Engine, HTTPHandler http.Handler, pprofEnabled bool) error

Types

type BackboneParameter

type BackboneParameter struct {
	// ConfigUpdate handle process config change
	ConfigUpdate cc.ProcHandlerFunc
	ExtraUpdate  cc.ProcHandlerFunc

	// service component addr
	Regdiscv string
	// config path
	ConfigPath string
	// http server parameter
	SrvInfo *types.ServerInfo
}

BackboneParameter Used to constrain different services to ensure consistency of service startup capabilities

type CCContextInterface

type CCContextInterface interface {
	WithCancel() (context.Context, context.CancelFunc)
}

type Config

type Config struct {
	RegisterPath string
	RegisterInfo types.ServerInfo
	CoreAPI      apimachinery.ClientSetInterface
}

type Engine

type Engine struct {
	CoreAPI apimachinery.ClientSetInterface

	ServiceManageInterface discovery.ServiceManageInterface
	SvcDisc                ServiceRegisterInterface

	sync.Mutex

	ServerInfo types.ServerInfo

	Language language.CCLanguageIf
	CCErr    errors.CCErrorIf
	CCCtx    CCContextInterface
	// contains filtered or unexported fields
}

func New

func New(c *Config, disc ServiceRegisterInterface) (*Engine, error)

func NewBackbone

func NewBackbone(ctx context.Context, input *BackboneParameter) (*Engine, error)

func NewMockBackbone

func NewMockBackbone(c *Config) (*Engine, error)

func (*Engine) ApiMachineryConfig

func (e *Engine) ApiMachineryConfig() *util.APIMachineryConfig

func (*Engine) Discovery

func (e *Engine) Discovery() discovery.DiscoveryInterface

func (*Engine) Metric

func (e *Engine) Metric() *metrics.Service

func (*Engine) Ping

func (e *Engine) Ping() error

func (*Engine) ServiceManageClient

func (e *Engine) ServiceManageClient() *zk.ZkClient

func (*Engine) WithMongo

func (e *Engine) WithMongo(prefixes ...string) (mongo.Config, error)

func (*Engine) WithRedis

func (e *Engine) WithRedis(prefixes ...string) (redis.Config, error)

type Server

type Server struct {
	ListenAddr   string
	ListenPort   uint
	Handler      http.Handler
	TLS          TLSConfig
	PProfEnabled bool
}

type ServiceRegisterInterface

type ServiceRegisterInterface interface {
	// Ping to ping server
	Ping() error
	// register local server info, it can only be called for once.
	Register(path string, c types.ServerInfo) error
	// Cancel to stop server register and discover
	Cancel()
	// ClearRegisterPath to delete server register path from zk
	ClearRegisterPath() error
}

func NewServiceRegister

func NewServiceRegister(client *zk.ZkClient) (ServiceRegisterInterface, error)

type TLSConfig

type TLSConfig struct {
	// Server should be accessed without verifying the TLS certificate. For testing only.
	InsecureSkipVerify bool
	// Server requires TLS client certificate authentication
	CertFile string
	// Server requires TLS client certificate authentication
	KeyFile string
	// Trusted root certificates for server
	CAFile string
	// the password to decrypt the certificate
	Password string
}

Directories

Path Synopsis
service_mange
zk

Jump to

Keyboard shortcuts

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