redis

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 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 RedisDiscovery

type RedisDiscovery struct {

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

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

func NewRedisDiscovery

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

NewRedisDiscovery returns a new RedisDiscovery.

func NewRedisDiscoveryStore

func NewRedisDiscoveryStore(basePath string, kv store.Store) (*RedisDiscovery, error)

NewRedisDiscoveryStore return a new RedisDiscovery with specified store.

func NewRedisDiscoveryTemplate

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

NewRedisDiscoveryTemplate returns a new RedisDiscovery template.

func (*RedisDiscovery) Clone

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

Clone clones this ServiceDiscovery with new servicePath.

func (*RedisDiscovery) Close

func (d *RedisDiscovery) Close()

func (*RedisDiscovery) GetServices

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

GetServices returns the servers

func (*RedisDiscovery) RemoveWatcher

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

func (*RedisDiscovery) SetFilter

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

SetFilter sets the filer.

func (*RedisDiscovery) WatchService

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

WatchService returns a nil chan.

type RedisRegisterPlugin

type RedisRegisterPlugin 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
}

RedisRegisterPlugin implements redis registry.

func (*RedisRegisterPlugin) HandleConnAccept

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

HandleConnAccept handles connections from clients

func (*RedisRegisterPlugin) PreCall

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

PreCall handles rpc call from clients

func (*RedisRegisterPlugin) Register

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

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

func (*RedisRegisterPlugin) Start

func (p *RedisRegisterPlugin) Start() error

Start starts to connect redis cluster

func (*RedisRegisterPlugin) Stop

func (p *RedisRegisterPlugin) Stop() error

Stop unregister all services.

func (*RedisRegisterPlugin) Unregister

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

Jump to

Keyboard shortcuts

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