Documentation ¶
Overview ¶
Package registry is for service registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterService ¶
type ClusterService struct { Discover string `yaml:"discover"` HealthCheck string `yaml:"health_check"` Monitor string `yaml:"monitor"` }
ClusterService is cluster service.
type Config ¶
type Config struct { // ServiceToken Service Access Token. ServiceToken string // Protocol Server access method, support http grpc, default grpc. Protocol string // HeartBeat Reporting heartbeat time interval, the default is recommended as TTL/2. HeartBeat int // EnableRegister By default, only report heartbeat, do not register service, if true, start registration. EnableRegister bool // Weight. Weight *int // TTL Unit s, the cycle for the server to check whether the periodic instance is healthy. TTL int // InstanceID instance name. InstanceID string // Namespace namespace. Namespace string // ServiceName Service Name. ServiceName string // BindAddress specifies reporting address. BindAddress string // Metadata User-defined metadata information. Metadata map[string]string // DisableHealthCheck disables healthcheck. DisableHealthCheck bool // InstanceLocation is the geographic location of the instance. InstanceLocation *model.Location }
Config is registry configuration.
type FactoryConfig ¶
type FactoryConfig struct { EnableRegister bool `yaml:"register_self"` Protocol string `yaml:"protocol"` HeartbeatInterval int `yaml:"heartbeat_interval"` Services []Service `yaml:"service"` Debug bool `yaml:"debug"` AddressList string `yaml:"address_list"` ClusterService ClusterService `yaml:"cluster_service"` ConnectTimeout int `yaml:"connect_timeout"` MessageTimeout *time.Duration `yaml:"message_timeout"` DisableHealthCheck bool `yaml:"disable_health_check"` InstanceLocation *model.Location `yaml:"instance_location"` }
FactoryConfig is factory configuration.
type Registry ¶
type Registry struct { // Provider: public for user custom. Provider api.ProviderAPI // contains filtered or unexported fields }
Registry is service registration.
func NewRegistry ¶
func NewRegistry(provider api.ProviderAPI, cfg *Config) (*Registry, error)
NewRegistry provides an externally accessible new instance interface.
func (*Registry) Deregister ¶
Deregister anti-registration.
type RegistryFactory ¶
type RegistryFactory struct {
// contains filtered or unexported fields
}
RegistryFactory is registered factory.
func (*RegistryFactory) FlexDependsOn ¶
func (f *RegistryFactory) FlexDependsOn() []string
FlexDependsOn makes sure that register is initialized after selector, which may set some global status of SDK, such as log directories.
func (*RegistryFactory) GetSDKCtx ¶
func (f *RegistryFactory) GetSDKCtx() api.SDKContext
GetSDKCtx returns the stored sdk context.
func (*RegistryFactory) Setup ¶
func (f *RegistryFactory) Setup(name string, configDec plugin.Decoder) error
Setup starts loading configuration and registers log.
func (*RegistryFactory) Type ¶
func (f *RegistryFactory) Type() string
Type returns registration type.
type Service ¶
type Service struct { Namespace string `yaml:"namespace"` ServiceName string `yaml:"name"` Token string `yaml:"token"` InstanceID string `yaml:"instance_id"` Weight *int `yaml:"weight"` BindAddress string `yaml:"bind_address"` MetaData map[string]string `yaml:"metadata"` }
Service is service configuration.
Click to show internal directories.
Click to hide internal directories.