Documentation ¶
Index ¶
- Variables
- type RedisDiscovery
- func NewRedisDiscovery(basePath string, servicePath string, redisAddr []string, options *store.Config) (*RedisDiscovery, error)
- func NewRedisDiscoveryStore(basePath string, kv store.Store) (*RedisDiscovery, error)
- func NewRedisDiscoveryTemplate(basePath string, redisAddr []string, options *store.Config) (*RedisDiscovery, error)
- func (d *RedisDiscovery) Clone(servicePath string) (client.ServiceDiscovery, error)
- func (d *RedisDiscovery) Close()
- func (d *RedisDiscovery) GetServices() []*client.KVPair
- func (d *RedisDiscovery) RemoveWatcher(ch chan []*client.KVPair)
- func (d *RedisDiscovery) SetFilter(filter client.ServiceDiscoveryFilter)
- func (d *RedisDiscovery) WatchService() chan []*client.KVPair
- type RedisRegisterPlugin
- func (p *RedisRegisterPlugin) HandleConnAccept(conn net.Conn) (net.Conn, bool)
- func (p *RedisRegisterPlugin) PreCall(_ context.Context, _, _ string, args interface{}) (interface{}, error)
- func (p *RedisRegisterPlugin) Register(name string, rcvr interface{}, metadata string) (err error)
- func (p *RedisRegisterPlugin) Start() error
- func (p *RedisRegisterPlugin) Stop() error
- func (p *RedisRegisterPlugin) Unregister(name string) (err error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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)