memory

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package memory provides an in-memory registry

Index

Constants

This section is empty.

Variables

View Source
var (
	// mock data
	Data = map[string][]*registry.Service{
		"foo": []*registry.Service{
			{
				Name:    "foo",
				Version: "1.0.0",
				Nodes: []*registry.Node{
					{
						Id:      "foo-1.0.0-123",
						Address: "localhost",
						Port:    9999,
					},
					{
						Id:      "foo-1.0.0-321",
						Address: "localhost",
						Port:    9999,
					},
				},
			},
			{
				Name:    "foo",
				Version: "1.0.1",
				Nodes: []*registry.Node{
					{
						Id:      "foo-1.0.1-321",
						Address: "localhost",
						Port:    6666,
					},
				},
			},
			{
				Name:    "foo",
				Version: "1.0.3",
				Nodes: []*registry.Node{
					{
						Id:      "foo-1.0.3-345",
						Address: "localhost",
						Port:    8888,
					},
				},
			},
		},
	}
)

Functions

func NewRegistry

func NewRegistry(opts ...registry.Option) registry.Registry

Types

type Registry

type Registry struct {
	sync.RWMutex
	Services map[string][]*registry.Service
}

func (*Registry) Deregister

func (m *Registry) Deregister(s *registry.Service) error

func (*Registry) GetService

func (m *Registry) GetService(service string) ([]*registry.Service, error)

func (*Registry) Init

func (m *Registry) Init(opts ...registry.Option) error

func (*Registry) ListServices

func (m *Registry) ListServices() ([]*registry.Service, error)

func (*Registry) Options

func (m *Registry) Options() registry.Options

func (*Registry) Register

func (m *Registry) Register(s *registry.Service, opts ...registry.RegisterOption) error

func (*Registry) Setup

func (m *Registry) Setup()

Setup sets mock data

func (*Registry) String

func (m *Registry) String() string

func (*Registry) Watch

func (m *Registry) Watch(opts ...registry.WatchOption) (registry.Watcher, error)

Jump to

Keyboard shortcuts

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