Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProxyConfig ¶
ProxyConfig represents a config of service.
func NewProxyConfig ¶
func NewProxyConfig(name string, config *service.Config) *ProxyConfig
NewProxyConfig return a new ProxyConfig.
type Service ¶
type Service struct { Name string Instances map[string]*ServiceInstance }
Service represents a service.
func NewService ¶
func NewService(name string, insts ...*ServiceInstance) *Service
NewService creates a service.
type ServiceDependence ¶
ServiceDependence contain all dependencies of a services.
func NewServiceDependence ¶
func NewServiceDependence(name string, dependencies []string) *ServiceDependence
NewServiceDependence return a new ServiceDependence.
type ServiceInstance ¶
type ServiceInstance struct { IP string `json:"ip"` Port uint16 `json:"port"` State ServiceInstanceState `json:"state"` Meta map[string]string `json:"meta"` }
ServiceInstance represents an instance of service.
func NewServiceInstance ¶
func NewServiceInstance(ip string, port uint16) *ServiceInstance
NewServerInstance creates a plain service instance.
func (*ServiceInstance) Addr ¶
func (inst *ServiceInstance) Addr() string
Addr returns the instance address.
func (*ServiceInstance) DeepCopy ¶
func (inst *ServiceInstance) DeepCopy() *ServiceInstance
DeepCopy creates a clone of service instance.
func (*ServiceInstance) Equal ¶
func (inst *ServiceInstance) Equal(another *ServiceInstance) bool
Equal returns whether the two instances are equal.
type ServiceInstanceState ¶
type ServiceInstanceState uint8
ServiceInstanceState indicates the state of service instance.
const ( StateHealthy ServiceInstanceState = iota StateUnhealthy )
The following shows the available states of service instance.
type ServiceRegistry ¶
type ServiceRegistry interface { // Run runs the registry until a stop signal received. Run(ctx context.Context) // List returns all registered service names. List() ([]string, error) // Get gets the service info with the given name. Get(name string) (*Service, error) }
ServiceRegistry represents a service registry.