model

package
v0.0.0-...-ee9fa08 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProxyConfig

type ProxyConfig struct {
	ServiceName string
	Config      *service.Config
}

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.

func (*Service) DeepCopy

func (svc *Service) DeepCopy() *Service

DeepCopy creates a clone of Service.

type ServiceDependence

type ServiceDependence struct {
	Service      string
	Dependencies []string
}

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.

Jump to

Keyboard shortcuts

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