module

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	Options() Options
	Registry() registry.Registry
	Run(mods ...Module) error
	Logger() *glog.Logger
	GetRouteServer(filter string) (ServerSession, error) //获取经过筛选过的服务
	Call(ctx context.Context, serviceName string, fnc func(context.Context, *grpc.ClientConn) error) error
}

type Module

type Module interface {
	GetType() string //模块类型
	OnDestroy()
	OnInit(app App)
	Run(closeSig chan bool)
}

type Option

type Option func(*Options)

Option 配置项

func Debug

func Debug(t bool) Option

func KillWaitTTL

func KillWaitTTL(t time.Duration) Option

KillWaitTTL specifies the interval on which to re-register

func Port

func Port(port int) Option

func RPCExpired

func RPCExpired(t time.Duration) Option

RPC超时时间

func RegisterInterval

func RegisterInterval(t time.Duration) Option

RegisterInterval specifies the interval on which to re-register

func RegisterTTL

func RegisterTTL(t time.Duration) Option

RegisterTTL specifies the TTL to use when registering the service

func Registry

func Registry(r registry.Registry) Option

Registry sets the registry for the service and the underlying components

func RegistryEnable

func RegistryEnable(status bool) Option

RegistryEnable sets the registry for the service status open or close

func Tracing

func Tracing(t Trace) Option

func Version

func Version(version string) Option

type Options

type Options struct {
	Version          string
	Debug            bool
	Tracing          Trace
	Log              *glog.Logger
	KillWaitTTL      time.Duration
	RegistryEnable   bool //是否使用注册中心
	Registry         registry.Registry
	RegisterInterval time.Duration
	RegisterTTL      time.Duration
	Port             int
	Selector         selector.Selector
	RPCExpired       time.Duration
}

type RPCModule

type RPCModule interface {
	context.Context
	Module
}

type ServerSession

type ServerSession interface {
	GetID() string
	GetName() string
	GetClient() *grpc.ClientConn
	GetApp() App
	GetNode() *registry.Node
	SetNode(node *registry.Node) (err error)
	Call(serviceName string, fnc func(*grpc.ClientConn, context.Context)) error
}

ServerSession 服务代理

type Trace

type Trace struct {
	Status bool
	Name   string
	URL    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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