Import path:
gitlab.soludian.com/soludian/fountain/libs/sd/fregistry
fregistry
import "gitlab.soludian.com/soludian/fountain/libs/sd/fregistry"Index
- Constants
- func GetServiceKey(prefix string, s runnable.ServerInstance) string
- func GetServiceValue(s runnable.ServerInstance) string
- type Configuration
- type ConsumerConfig
- type Endpoints
- type Nop
- func (n Nop) Close() error
- func (n Nop) ListServices(ctx context.Context, target Target) ([]runnable.ServerInstance, error)
- func (n Nop) RegisterService(context.Context, runnable.ServerInstance) error
- func (n Nop) SyncServices(context.Context, SyncServicesOptions) error
- func (n Nop) UnregisterService(context.Context, runnable.ServerInstance) error
- func (n Nop) WatchServices(ctx context.Context, target Target) (chan Endpoints, error)
- type ProviderConfig
- type Registry
- type Route
- type RouteConfig
- type ServiceDiscoveryClientConfig
- type SyncServicesOptions
- type Target
- type Upstream
- type WeightGroup
Constants
const (
ProtocolGRPC = "grpc"
ProtocolHTTP = "http"
ProtocolTPC = "tcp"
ProtocolUDP = "udp"
)func GetServiceKey
func GetServiceKey(prefix string, s runnable.ServerInstance) stringGetServiceKey ETCD registration needs to be used Deprecated: Use *server.ServiceInfo.GetServiceKey()
func GetServiceValue
func GetServiceValue(s runnable.ServerInstance) stringGetServiceValue ETCD registration needs to use Deprecated: Use *server.ServiceInfo.GetServiceValue()
type Configuration
Configuration...
type Configuration struct {
Routes []Route `json:"routes" conf:"routes"` // Configure client routing strategy
Labels map[string]string `json:"labels" conf:"labels"` // Configure server labels: grouping
}type ConsumerConfig
ConsumerConfig config of consumer The client calls the app's configuration
type ConsumerConfig struct {
ID string `json:"id" conf:"id"`
Scheme string `json:"scheme" conf:"scheme"`
Host string `json:"host" conf:"host"`
}type Endpoints
Endpoints...
type Endpoints struct {
// Nodes service node list
Servers map[string]runnable.ServerInstance `json:"servers"`
// RouteConfigs routing configuration
RouteConfigs map[string]RouteConfig `json:"route_configs"`
// ConsumerConfigs consumer metadata
ConsumerConfigs map[string]ConsumerConfig `json:"consumer_configs"`
// ProviderConfigs service meta information
ProviderConfigs map[string]ProviderConfig `json:"provider_configs"`
}func (*Endpoints) DeepCopy
func (in *Endpoints) DeepCopy() *EndpointsDeepCopy...
type Nop
Nop registry, used for local development/debugging
type Nop struct{}func (Nop) Close
func (n Nop) Close() errorClose ...
func (Nop) ListServices
func (n Nop) ListServices(ctx context.Context, target Target) ([]runnable.ServerInstance, error)ListServices ...
func (Nop) RegisterService
func (n Nop) RegisterService(context.Context, runnable.ServerInstance) errorRegisterService ...
func (Nop) SyncServices
func (n Nop) SyncServices(context.Context, SyncServicesOptions) errorSyncServices syncs all services
func (Nop) UnregisterService
func (n Nop) UnregisterService(context.Context, runnable.ServerInstance) errorUnregisterService ...
func (Nop) WatchServices
func (n Nop) WatchServices(ctx context.Context, target Target) (chan Endpoints, error)WatchServices ...
type ProviderConfig
ProviderConfig config of provider Through this configuration, modify the properties of the provider
type ProviderConfig struct {
ID string `json:"id" conf:"id"`
Scheme string `json:"scheme" conf:"scheme"`
Host string `json:"host" conf:"host"`
Region string `json:"region" conf:"region"`
Zone string `json:"zone" conf:"zone"`
Deployment string `json:"deployment" conf:"deployment"`
Metadata map[string]string `json:"metadata" conf:"metadata"`
Enable bool `json:"enable" conf:"enable"`
}type Registry
Registry register/unregister service registry impl should control rpc timeout
type Registry interface {
RegisterService(context.Context, runnable.ServerInstance) error
UnregisterService(context.Context, runnable.ServerInstance) error
ListServices(context.Context, Target) ([]runnable.ServerInstance, error)
WatchServices(context.Context, Target) (chan Endpoints, error)
SyncServices(context.Context, SyncServicesOptions) error
io.Closer
}type Route
Route represents route configuration
type Route struct {
// route method name
Method string `json:"method" conf:"method"`
// Route weight groups, distribute traffic among weight groups according to the ratio
WeightGroups []WeightGroup `json:"weightGroups" conf:"weightGroups"`
// Route the deployment group, import traffic to the deployment group
Deployment string `json:"deployment" conf:"deployment"`
}type RouteConfig
RouteConfig...
type RouteConfig struct {
ID string `json:"id" conf:"id"`
Scheme string `json:"scheme" conf:"scheme"`
Host string `json:"host" conf:"host"`
Deployment string `json:"deployment" conf:"deployment"`
URI string `json:"uri" conf:"uri"`
Upstream Upstream `json:"upstream" conf:"upstream"`
}func (RouteConfig) String
func (config RouteConfig) String() stringString...
type ServiceDiscoveryClientConfig
ServiceDiscoveryClientConfig func
type ServiceDiscoveryClientConfig struct {
DCName string
ServiceName string
EtcdAddrs []string
Balancer string
}type SyncServicesOptions
SyncServicesOptions...
type SyncServicesOptions struct {
GrpcResolverNowOptions resolver.ResolveNowOptions
}type Target
Target...
type Target struct {
Protocol constants.ServerProtocol // "http"|"grpc"|"tcp"|"udp"
Scheme string // "etcd"|"k8s"|"dns"
Endpoint string // service name
Authority string
}type Upstream
Upstream represents upstream balancing config
type Upstream struct {
Nodes map[string]int `json:"nodes"`
Groups map[string]int `json:"groups"`
}type WeightGroup
WeightGroup...
type WeightGroup struct {
Group string `json:"group" conf:"group"`
Weight int `json:"weight" conf:"weight"`
}Generated by gomarkdoc