consistent

package
v0.9.17 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyWorkers = errors.New("config not found or workers empty")
View Source
var InvalidWorkers = errors.New("workers must be an array of string")
View Source
var WorkerMissing = errors.New("the specified worker was not found in the config")

Functions

func ConsistentHashFilter

func ConsistentHashFilter(name string, workers []string) (gtm.OpFilter, error)

ConsistentHashFilter returns an operation filter which uses a consistent hash to determine if the operation will be accepted for processing. can be used to distribute work. name: the name of the worker creating this filter. e.g. "Harry" workers: a slice of strings representing the available worker names

func ConsistentHashFilterFromDocument

func ConsistentHashFilterFromDocument(name string, document map[string]interface{}) (gtm.OpFilter, error)

ConsistentHashFilterFromDocument returns an operation filter which uses a consistent hash to determine if the operation will be accepted for processing. can be used to distribute work. name: the name of the worker creating this filter. e.g. "Harry" document: a map with a string key 'workers' which has a corresponding

slice of string representing the available workers

func ConsistentHashFilterFromFile

func ConsistentHashFilterFromFile(name string, configFile string) (gtm.OpFilter, error)

ConsistentHashFilterFromFile returns an operation filter which uses a consistent hash to determine if the operation will be accepted for processing. can be used to distribute work. name: the name of the worker creating this filter. e.g. "Harry" configFile: a file path to a TOML document. the document should contain a property named 'Workers' which is a list of all the workers participating. e.g. workers = [ "Tom", "Dick", "Harry" ]

Types

type ConfigOptions

type ConfigOptions struct {
	Workers []string
}

Jump to

Keyboard shortcuts

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