nodes

package
v0.0.0-...-170def7 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalAddress

func LocalAddress(target string) (net.IP, error)

LocalAddress is a helper function to return the local IP address that would be used to connect to a specified target. Useful to get the IP that should be advertised externally.

Types

type NodeTracker

type NodeTracker interface {
	// Runs the node tracker until the context is closed.
	Run(ctx context.Context)

	// List returns a list of all nodes being tracked.  The list returned will be
	// a copy of the underlying list of nodes.  Intended for admin interfaces,
	// not performance critical code.  Thread safe.
	List() []string

	// Select will use the provided key to pick a node from the list of tracked
	// nodes and return it.  Returns an error if there are no nodes available.
	// Thread safe.
	Select(key uint64) (string, error)
}

NodeTracker is an interface for tracking and selecting nodes in a cluster

func NewRedisNodeTracker

func NewRedisNodeTracker(redisAddr, namespace, nodeid string, updateInterval, expiryInterval time.Duration) NodeTracker

NewRedisNodeTracker returns a NodeTracker based on a Redis backend

Jump to

Keyboard shortcuts

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