redis

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowKeyNotFound bool = true

Functions

This section is empty.

Types

type Discovery added in v0.0.6

type Discovery struct {

	// -1 means it always retry to watch until zookeeper is ok, 0 means no retry.
	RetriesAfterWatchFailed int
	// contains filtered or unexported fields
}

Discovery is a redis service discovery. It always returns the registered servers in redis.

func NewDiscovery added in v0.0.6

func NewDiscovery(basePath string, servicePath string, redisAddr []string, options *store.Config) (*Discovery, error)

NewDiscovery returns a new Discovery.

func NewDiscoveryStore added in v0.0.6

func NewDiscoveryStore(basePath string, kv store.Store) (*Discovery, error)

NewDiscoveryStore return a new Discovery with specified store.

func NewRedisDiscoveryTemplate

func NewRedisDiscoveryTemplate(basePath string, redisAddr []string, options *store.Config) (*Discovery, error)

NewRedisDiscoveryTemplate returns a new Discovery template.

func (*Discovery) Clone added in v0.0.6

func (d *Discovery) Clone(servicePath string) (client.ServiceDiscovery, error)

Clone clones this ServiceDiscovery with new servicePath.

func (*Discovery) Close added in v0.0.6

func (d *Discovery) Close()

func (*Discovery) GetServices added in v0.0.6

func (d *Discovery) GetServices() []*client.KVPair

GetServices returns the servers

func (*Discovery) RemoveWatcher added in v0.0.6

func (d *Discovery) RemoveWatcher(ch chan []*client.KVPair)

func (*Discovery) SetFilter added in v0.0.6

func (d *Discovery) SetFilter(filter client.ServiceDiscoveryFilter)

SetFilter sets the filer.

func (*Discovery) WatchService added in v0.0.6

func (d *Discovery) WatchService() chan []*client.KVPair

WatchService returns a nil chan.

type Register added in v0.0.6

type Register struct {
	// service address, for example, tcp@127.0.0.1:8972, quic@127.0.0.1:1234
	ServiceAddress string
	// redis addresses
	RedisServers []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
}

Register implements redis registry.

func (*Register) HandleConnAccept added in v0.0.6

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

HandleConnAccept handles connections from clients

func (*Register) PreCall added in v0.0.6

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

PreCall handles rpc call from clients

func (*Register) Register added in v0.0.6

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

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

func (*Register) Start added in v0.0.6

func (p *Register) Start() error

Start starts to connect redis cluster

func (*Register) Stop added in v0.0.6

func (p *Register) Stop() error

Stop unregister all services.

func (*Register) Unregister added in v0.0.6

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

Jump to

Keyboard shortcuts

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