plain

package
v0.0.0-...-7d43bac Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2017 License: MIT Imports: 16 Imported by: 3

Documentation

Overview

Package plain provides support for self-hosted, in-memory, client-server plain discovery service mechanism.

Index

Constants

View Source
const (
	// RegisterServiceURL is endpoint url for service registration.
	RegisterServiceURL = "/register"
	// UnregisterServiceURL is endpoint url for service deregistration.
	UnregisterServiceURL = "/unregister"
	// ListServicesURL is endpoint url for registered services list.
	ListServicesURL = "/services"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceDiscovery

type ServiceDiscovery struct {
	// contains filtered or unexported fields
}

ServiceDiscovery represents plain, in-memory, client-server service discovery mechanism.

func NewServiceDiscovery

func NewServiceDiscovery(address string) *ServiceDiscovery

NewServiceDiscovery creates plain, in-memory, client-server service registration and localization mechanism.

func (*ServiceDiscovery) DeregisterService

func (sd *ServiceDiscovery) DeregisterService(options ...discovery.Option) error

DeregisterService unregisters service in service discovery catalog.

func (*ServiceDiscovery) Dispose

func (sd *ServiceDiscovery) Dispose()

Dispose cleans up ServiceDiscovery instance.

func (*ServiceDiscovery) GetServiceAddress

func (sd *ServiceDiscovery) GetServiceAddress(options ...discovery.Option) (*url.URL, error)

GetServiceAddress gets service address from service discovery catalog.

func (*ServiceDiscovery) RegisterService

func (sd *ServiceDiscovery) RegisterService(options ...discovery.Option) error

RegisterService registers service in service discovery catalog.

func (*ServiceDiscovery) Serve

func (sd *ServiceDiscovery) Serve(address string) error

Serve starts service discovery HTTP host.

func (*ServiceDiscovery) Stop

func (sd *ServiceDiscovery) Stop()

Stop stops service discovery HTTP host.

type ServiceInfo

type ServiceInfo struct {
	Address string   `json:"address"` // service address
	Name    string   `json:"name"`    // service name
	Tags    []string `json:"tags"`    // service tags
	Version string   `json:"version"` // service version
}

ServiceInfo represents information about service to be registered in service discovery catalog.

Jump to

Keyboard shortcuts

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