resolver

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2016 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package resolver provides a mechanism to resolve a vtworker or vtctld hostname to multiple addresses. This is useful for trying to execute a command on all available tasks e.g. if multiple vtworker instances are running.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(prefix string, resolver Resolver)

Register will register "resolver" for all hostnames matching "prefix".

func Resolve

func Resolve(hostname string) ([]string, error)

Resolve tries to resolve "hostname" to all available addresses ("ip:port") and returns them. From all registered Resolvers, it uses the first one whose registration key matches the prefix of the hostname. If the resolver returned no results, an error will be returned. If no resolver did match, the hostname will be returned as the only address. If multiple addresses are returned, the list will be shuffled.

Types

type Resolver

type Resolver interface {
	Resolve(hostname string) ([]string, error)
}

Resolver can be implemented to resolve a "hostname" to all available addresses (list of "ip:port" strings).

Jump to

Keyboard shortcuts

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