serverplugin

package
v0.0.0-...-99cd9a4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsulOpt

type ConsulOpt func(*ConsulRegisterPlugin)

func WithConsulMetrics

func WithConsulMetrics(me metrics.Registry) ConsulOpt

func WithConsulNodeId

func WithConsulNodeId(basePath string) ConsulOpt

func WithConsulOptions

func WithConsulOptions(options *store.Config) ConsulOpt

func WithConsulServers

func WithConsulServers(consulServers []string) ConsulOpt

func WithConsulServiceAddress

func WithConsulServiceAddress(serviceAddress string) ConsulOpt

func WithConsulTags

func WithConsulTags(tags ...string) ConsulOpt

func WithConsulUpdateInterval

func WithConsulUpdateInterval(updateInterval time.Duration) ConsulOpt

type ConsulRegisterPlugin

type ConsulRegisterPlugin struct {
	// service address, for example, tcp@127.0.0.1:8972, quic@127.0.0.1:1234
	ServiceAddress string
	ServiceHost    string
	ServicePort    int
	// consul addresses
	ConsulServers []string
	// base path for rpcx server, for example com/example/rpcx
	NodeId  string
	Metrics metrics.Registry
	// Registered services
	Services       []string
	Tags           []string
	UpdateInterval time.Duration

	Options *store.Config
	// contains filtered or unexported fields
}

ConsulRegisterPlugin implements consul registry.

func NewConsulRegisterPlugin

func NewConsulRegisterPlugin(o ...ConsulOpt) *ConsulRegisterPlugin

func (*ConsulRegisterPlugin) HandleConnAccept

func (p *ConsulRegisterPlugin) HandleConnAccept(conn net.Conn) (net.Conn, bool)

HandleConnAccept handles connections from clients

func (*ConsulRegisterPlugin) PreCall

func (p *ConsulRegisterPlugin) PreCall(_ context.Context, _, _ string, args interface{}) (interface{}, error)

PreCall handles rpc call from clients

func (*ConsulRegisterPlugin) Register

func (p *ConsulRegisterPlugin) Register(name string, rcvr interface{}, metadata string) (err error)

Register handles registering event. this service is registered at BASE/serviceName/thisIpAddress node

func (*ConsulRegisterPlugin) RegisterFunction

func (p *ConsulRegisterPlugin) RegisterFunction(serviceName, fname string, fn interface{}, metadata string) error

func (*ConsulRegisterPlugin) Stop

func (p *ConsulRegisterPlugin) Stop() error

Stop unregister all services.

func (*ConsulRegisterPlugin) Unregister

func (p *ConsulRegisterPlugin) Unregister(name string) (err error)

Jump to

Keyboard shortcuts

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