serverplugin

package
v0.0.0-...-d205316 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ZooKeeperOpt

type ZooKeeperOpt func(o *ZooKeeperRegisterPlugin)

func WithZKBasePath

func WithZKBasePath(basePath string) ZooKeeperOpt

func WithZKMetrics

func WithZKMetrics(me metrics.Registry) ZooKeeperOpt

func WithZKServersAddress

func WithZKServersAddress(zkServers []string) ZooKeeperOpt

func WithZKServiceAddress

func WithZKServiceAddress(serviceAddress string) ZooKeeperOpt

func WithZkOptions

func WithZkOptions(Options *store.Config) ZooKeeperOpt

func WithZkUpdateInterval

func WithZkUpdateInterval(updateInterval time.Duration) ZooKeeperOpt

type ZooKeeperRegisterPlugin

type ZooKeeperRegisterPlugin struct {
	// service address, for example, tcp@127.0.0.1:8972, quic@127.0.0.1:1234
	ServiceAddress string
	// zookeeper addresses
	ZooKeeperServers []string
	// base path for rpcx server, for example com/example/rpcx
	BasePath string
	Metrics  metrics.Registry
	// Registered services
	Services []string

	UpdateInterval time.Duration

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

ZooKeeperRegisterPlugin implements zookeeper registry.

func NewZooKeeperRegisterPlugin

func NewZooKeeperRegisterPlugin(opts ...ZooKeeperOpt) *ZooKeeperRegisterPlugin

func (*ZooKeeperRegisterPlugin) HandleConnAccept

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

HandleConnAccept handles connections from clients

func (*ZooKeeperRegisterPlugin) PreCall

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

PreCall handles rpc call from clients

func (*ZooKeeperRegisterPlugin) Register

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

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

func (*ZooKeeperRegisterPlugin) RegisterFunction

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

func (*ZooKeeperRegisterPlugin) Start

func (p *ZooKeeperRegisterPlugin) Start() error

Start starts to connect zookeeper cluster

func (*ZooKeeperRegisterPlugin) Stop

func (p *ZooKeeperRegisterPlugin) Stop() error

Stop unregister all services.

func (*ZooKeeperRegisterPlugin) Unregister

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

Jump to

Keyboard shortcuts

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