cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache collects the most recent set of endpoints from a service discovery system via a subscriber, and makes them available to consumers. Cache is meant to be embedded inside of a concrete subscriber, and can serve Service invocations directly.

func New

func New(factory sd.Factory, logger log.Logger) *Cache

New returns a new, empty endpoint cache.

func (*Cache) Endpoints

func (c *Cache) Endpoints() []endpoint.Endpoint

Endpoints yields the current set of (presumably identical) endpoints, ordered lexicographically by the corresponding instance string.

func (*Cache) Update

func (c *Cache) Update(instances []string)

Update should be invoked by clients with a complete set of current instance strings whenever that set changes. The cache manufactures new endpoints via the factory, closes old endpoints when they disappear, and persists existing endpoints if they survive through an update.

Jump to

Keyboard shortcuts

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