Documentation ¶
Overview ¶
Package scheduler implements a distributed consensus scheduler with etcd.
Index ¶
Constants ¶
const ( // DefaultSessionTTL is the number of seconds to wait before a dead or // unresponsive host is removed from the scheduled pool. DefaultSessionTTL = 10 // seconds // DefaultMaxCount is the maximum number of hosts to schedule on if not // specified. DefaultMaxCount = 1 // TODO: what is the logical value to choose? +Inf? )
Variables ¶
var ErrEndOfResults = errors.New("scheduler: end of results")
ErrEndOfResults is a sentinel that represents no more results will be coming.
Functions ¶
Types ¶
type Option ¶
type Option func(*schedulerOptions)
Option is a type that can be used to configure the scheduler.
func HostsFilter ¶
HostsFilter specifies a manual list of hosts, to use as a subset of whatever was auto-discovered. XXX: think more about this idea...
func ReuseLease ¶
ReuseLease specifies whether we should try and re-use the lease between runs. Ordinarily it would get discarded with each new version (deploy) of the code.
func SessionTTL ¶
SessionTTL is the amount of time to delay before expiring a key on abrupt host disconnect of if ReuseLease is true.
func StrategyKind ¶
StrategyKind sets the scheduler strategy used.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is what is returned when you request a scheduler. You can call methods on it, and it stores the necessary state while you're running. When one of these is produced, the scheduler has already kicked off running for you automatically.
func Schedule ¶
Schedule returns a scheduler result which can be queried with it's available methods. This automatically causes different etcd clients sharing the same path to discover each other and be part of the scheduled set. On close the keys expire and will get removed from the scheduled set. Different options can be passed in to customize the behaviour. Hostname represents the unique identifier for the caller. The behaviour is undefined if this is run more than once with the same path and hostname simultaneously.