registry

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2015 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package registry defines the Registry interface which can be used with goproxy.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceNotFound = errors.New("service name/version not found")
)

Common errors.

Functions

This section is empty.

Types

type DefaultRegistry

type DefaultRegistry map[string]map[string][]string

DefaultRegistry is a basic registry using the following format:

{
  "serviceName": {
    "serviceVersion": [
      "endpoint1:port",
      "endpoint2:port"
    ],
  },
}

func (DefaultRegistry) Add

func (r DefaultRegistry) Add(name, version, endpoint string)

Add adds the given endpoit for the service name/version.

func (DefaultRegistry) Delete

func (r DefaultRegistry) Delete(name, version, endpoint string)

Delete removes the given endpoit for the service name/version.

func (DefaultRegistry) Failure

func (r DefaultRegistry) Failure(name, version, endpoint string, err error)

Failure marks the given endpoint for service name/version as failed.

func (DefaultRegistry) Lookup

func (r DefaultRegistry) Lookup(name, version string) ([]string, error)

Lookup return the endpoint list for the given service name/version.

type Registry

type Registry interface {
	Add(name, version, endpoint string)                // Add an endpoint to our registry
	Delete(name, version, endpoint string)             // Remove an endpoint to our registry
	Failure(name, version, endpoint string, err error) // Mark an endpoint as failed.
	Lookup(name, version string) ([]string, error)     // Return the endpoint list for the given service name/version
}

Registry is an interface used to lookup the target host for a given service name / version pair.

Jump to

Keyboard shortcuts

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