Documentation ¶
Index ¶
- Variables
- func AddServer(info ServiceInfo)
- func BuildPrefixKey(name, version string) string
- func GetLocalIP() (string, error)
- func GetPublicIP() (string, error)
- func Register(ctx context.Context, eCfg EtcdConfig, info *ServiceInfo)
- func RemoveServer(info ServiceInfo)
- func ServerActive(srvID uint32) bool
- func Servers() map[uint32]string
- type EtcdConfig
- type RegistryInfo
- type Resolver
- type ServerManager
- type Service
- type ServiceInfo
- type WatchFn
- type Watcher
Constants ¶
This section is empty.
Variables ¶
View Source
var Log *lg.Logger
Functions ¶
func AddServer ¶ added in v1.1.0
func AddServer(info ServiceInfo)
func BuildPrefixKey ¶ added in v1.1.0
func GetLocalIP ¶ added in v1.1.0
func GetPublicIP ¶ added in v1.1.0
func Register ¶ added in v1.1.0
func Register(ctx context.Context, eCfg EtcdConfig, info *ServiceInfo)
Register 注册服务
func RemoveServer ¶ added in v1.1.0
func RemoveServer(info ServiceInfo)
func ServerActive ¶ added in v1.1.0
Types ¶
type EtcdConfig ¶ added in v1.1.0
type RegistryInfo ¶ added in v1.1.0
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver(ctx context.Context, eCfg EtcdConfig, prefix string) *Resolver
func (*Resolver) Build ¶
func (r *Resolver) Build(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error)
func (*Resolver) ResolveNow ¶
func (r *Resolver) ResolveNow(resolver.ResolveNowOptions)
type ServerManager ¶ added in v1.1.0
type ServerManager struct {
// contains filtered or unexported fields
}
ServerManager 用于读写极其极端的情况下(10000:1),读基本无锁
func NewServerManager ¶ added in v1.1.0
func NewServerManager() *ServerManager
func (*ServerManager) AddServer ¶ added in v1.1.0
func (mgr *ServerManager) AddServer(srvID uint32, uuid string)
func (*ServerManager) RemoveServer ¶ added in v1.1.0
func (mgr *ServerManager) RemoveServer(srvID uint32, uuid string)
func (*ServerManager) ServerActive ¶ added in v1.1.0
func (mgr *ServerManager) ServerActive(srvID uint32) bool
type Service ¶
type Service struct { ServiceInfo *ServiceInfo // contains filtered or unexported fields }
type ServiceInfo ¶
type ServiceInfo struct { ID int64 `json:"id" toml:"id"` Type int64 `json:"type" toml:"type"` Name string `json:"name" toml:"name"` UUID string `json:"uuid" toml:"uuid"` Version string `json:"version" toml:"version"` Internal string `json:"internal" toml:"internal"` External string `json:"external" toml:"external"` Ext map[string]any `json:"ext" toml:"ext"` // 新增扩展信息 }
ServiceInfo 服务信息
type Watcher ¶ added in v0.0.4
type Watcher struct {
// contains filtered or unexported fields
}
func NewWatcher ¶ added in v0.0.4
Click to show internal directories.
Click to hide internal directories.