discovery

package
v1.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FILE   string = "file"
	NACOS  string = "nacos"
	ETCD   string = "etcd"
	EUREKA string = "eureka"
	REDIS  string = "redis"
	ZK     string = "zk"
	CONSUL string = "consul"
	SOFA   string = "sofa"
)

Variables

This section is empty.

Functions

func InitRegistry

func InitRegistry(serviceConfig *ServiceConfig, registryConfig *RegistryConfig)

Types

type ConsulRegistryService

type ConsulRegistryService struct{}

func (*ConsulRegistryService) Close

func (s *ConsulRegistryService) Close()

func (*ConsulRegistryService) Lookup

func (s *ConsulRegistryService) Lookup(key string) ([]*ServiceInstance, error)

type Etcd3Config

type Etcd3Config struct {
	Cluster    string `yaml:"cluster" json:"cluster" koanf:"cluster"`
	ServerAddr string `yaml:"server-addr" json:"server-addr" koanf:"server-addr"`
}

func (*Etcd3Config) RegisterFlagsWithPrefix

func (cfg *Etcd3Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type EtcdRegistryService

type EtcdRegistryService struct {
	// contains filtered or unexported fields
}

func (*EtcdRegistryService) Close

func (s *EtcdRegistryService) Close()

func (*EtcdRegistryService) Lookup

func (s *EtcdRegistryService) Lookup(key string) ([]*ServiceInstance, error)

type EurekaRegistryService

type EurekaRegistryService struct{}

func (*EurekaRegistryService) Close

func (s *EurekaRegistryService) Close()

func (*EurekaRegistryService) Lookup

func (s *EurekaRegistryService) Lookup(key string) ([]*ServiceInstance, error)

type FileConfig

type FileConfig struct {
	Name string `yaml:"name" json:"name" koanf:"name"`
}

func (*FileConfig) RegisterFlagsWithPrefix

func (cfg *FileConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type FileRegistryService

type FileRegistryService struct {
	// contains filtered or unexported fields
}

func (*FileRegistryService) Close

func (s *FileRegistryService) Close()

func (*FileRegistryService) Lookup

func (s *FileRegistryService) Lookup(key string) ([]*ServiceInstance, error)

type NacosConfig

type NacosConfig struct {
	Application string `yaml:"application" json:"application" koanf:"application"`
	ServerAddr  string `yaml:"server-addr" json:"server-addr" koanf:"server-addr"`
	Group       string `yaml:"group" json:"group" koanf:"group"`
	Namespace   string `yaml:"namespace" json:"namespace" koanf:"namespace"`
	Username    string `yaml:"username" json:"username" koanf:"username"`
	Password    string `yaml:"password" json:"password" koanf:"password"`
	AccessKey   string `yaml:"access-key" json:"access-key" koanf:"access-key"`
	SecretKey   string `yaml:"secret-key" json:"secret-key" koanf:"secret-key"`
}

func (*NacosConfig) RegisterFlagsWithPrefix

func (cfg *NacosConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type NacosRegistryService

type NacosRegistryService struct{}

func (NacosRegistryService) Close

func (NacosRegistryService) Close()

func (*NacosRegistryService) Lookup

func (s *NacosRegistryService) Lookup(key string) ([]*ServiceInstance, error)

type RedisRegistryService

type RedisRegistryService struct{}

func (RedisRegistryService) Close

func (RedisRegistryService) Close()

func (*RedisRegistryService) Lookup

func (s *RedisRegistryService) Lookup(key string) ([]*ServiceInstance, error)

type RegistryConfig

type RegistryConfig struct {
	Type  string      `yaml:"type" json:"type" koanf:"type"`
	File  FileConfig  `yaml:"file" json:"file" koanf:"file"`
	Nacos NacosConfig `yaml:"nacos" json:"nacos" koanf:"nacos"`
	Etcd3 Etcd3Config `yaml:"etcd3" json:"etcd3" koanf:"etcd3"`
}

func (*RegistryConfig) RegisterFlagsWithPrefix

func (cfg *RegistryConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type RegistryService

type RegistryService interface {
	Lookup(key string) ([]*ServiceInstance, error)
	Close()
}

func GetRegistry

func GetRegistry() RegistryService

type ServiceConfig

type ServiceConfig struct {
	VgroupMapping            flagext.StringMap `yaml:"vgroup-mapping" json:"vgroup-mapping" koanf:"vgroup-mapping"`
	Grouplist                flagext.StringMap `yaml:"grouplist" json:"grouplist" koanf:"grouplist"`
	EnableDegrade            bool              `yaml:"enable-degrade" json:"enable-degrade" koanf:"enable-degrade"`
	DisableGlobalTransaction bool              `yaml:"disable-global-transaction" json:"disable-global-transaction" koanf:"disable-global-transaction"`
}

func (*ServiceConfig) RegisterFlagsWithPrefix

func (cfg *ServiceConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type ServiceInstance

type ServiceInstance struct {
	Addr string
	Port int
}

type SofaRegistryService

type SofaRegistryService struct{}

func (*SofaRegistryService) Close

func (s *SofaRegistryService) Close()

func (*SofaRegistryService) Lookup

func (s *SofaRegistryService) Lookup(key string) ([]*ServiceInstance, error)

type ZkRegistryService

type ZkRegistryService struct{}

func (*ZkRegistryService) Close

func (s *ZkRegistryService) Close()

func (*ZkRegistryService) Lookup

func (s *ZkRegistryService) Lookup(key string) ([]*ServiceInstance, error)

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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