route

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoHosts = errors.New("pfs: no hosts found")

Functions

func HashResource

func HashResource(resource string) uint64

func Match

func Match(resource, shardDesc string) (bool, error)

Match returns true of a resource hashes to the given shard.

func MultiReadCloser

func MultiReadCloser(readers ...io.ReadCloser) io.ReadCloser

MultiReadCloser returns a ReaderCloser that's the logical concatenation of the provided input readers. They're read sequentially. Once all inputs have returned EOF, Read will return EOF. If any of the readers return a non-nil, non-EOF error, Read will return that error. MultiReadCloser closes all of the input readers when it is closed. It also closes readers when they finish.

func Multicast

func Multicast(r *http.Request, etcdKey string) ([]*http.Response, error)

Multicast enables the Ogre Magi to rapidly cast his spells, giving them greater potency. Multicast sends a request to every host it finds under a key and returns a ReadCloser for each one.

func MulticastHttp

func MulticastHttp(w http.ResponseWriter, r *http.Request, etcdKey string, ret Return)

MulticastHttp sends r to every host it finds under etcdKey, then prints the response to w based on

func ParseShard

func ParseShard(shardDesc string) (uint64, uint64, error)

Parse a string descriving a shard, the string looks like: "0-4"

func Route

func Route(r *http.Request, etcdKey string, modulos uint64) (io.ReadCloser, error)

func RouteHttp

func RouteHttp(w http.ResponseWriter, r *http.Request, etcdKey string, modulos uint64)

Types

type Return

type Return int
const (
	// ReturnFirst returns only the first response
	ReturnOne Return = iota
	// ReturnAll returns all the responses
	ReturnAll Return = iota
)

Jump to

Keyboard shortcuts

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