discovery

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SERVICE_DIR = "/pub/pjoc/pay/services"

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoveryService

type DiscoveryService interface {
	RegisterService(serviceName string, endpoint ServiceEndpoint) error

	GetService(serviceName string) *Service
}

func InitEtcdDiscoveryService

func InitEtcdDiscoveryService(etcd *etcdv3.EtcdConfig, serviceDir string) DiscoveryService

type EtcdDiscovery

type EtcdDiscovery struct {
	ServiceDir string
	// contains filtered or unexported fields
}

func (*EtcdDiscovery) AddShutdownHook

func (d *EtcdDiscovery) AddShutdownHook(serviceName string, endpoint ServiceEndpoint)

func (*EtcdDiscovery) Delete

func (d *EtcdDiscovery) Delete(serviceName string, endpoint ServiceEndpoint) error

func (*EtcdDiscovery) GetService

func (d *EtcdDiscovery) GetService(serviceName string) *Service

func (*EtcdDiscovery) RegisterService

func (d *EtcdDiscovery) RegisterService(serviceName string, endpoint ServiceEndpoint) error

func (*EtcdDiscovery) Update

func (d *EtcdDiscovery) Update(service *Service) error

type Service

type Service struct {
	ServiceName string            `json:"service_name"`
	Endpoints   []ServiceEndpoint `json:"endpoints"`
	sync.Mutex
}

type ServiceEndpoint

type ServiceEndpoint struct {
	Ip   string `json:"ip"`
	Port string `json:"port"`
}

Jump to

Keyboard shortcuts

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