offers

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2015 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expired

func Expired(offerId, hostname string, ttl time.Duration) *expiredOffer

Types

type Filter

type Filter func(*mesos.Offer) bool

type Perishable

type Perishable interface {
	// returns true if this offer has expired
	HasExpired() bool
	// if not yet expired, return mesos offer details; otherwise nil
	Details() *mesos.Offer
	// mark this offer as acquired, returning true if it was previously unacquired. thread-safe.
	Acquire() bool
	// mark this offer as un-acquired. thread-safe.
	Release()

	// return a unique identifier for this offer
	Id() string
	// return the slave host for this offer
	Host() string
	// contains filtered or unexported methods
}

type Registry

type Registry interface {
	// Initialize the instance, spawning necessary housekeeping go routines.
	Init()
	Add([]*mesos.Offer)

	// Listen for arriving offers that are acceptable to the filter, sending
	// a signal on (by closing) the returned channel. A listener will only
	// ever be notified once, if at all.
	Listen(id string, f Filter) <-chan struct{}

	// invoked when offers are rescinded or expired
	Delete(string)

	Get(offerId string) (Perishable, bool)

	Walk(Walker) error

	// invalidate one or all (when offerId="") offers; offers are not declined,
	// but are simply flagged as expired in the offer history
	Invalidate(offerId string)
}

func CreateRegistry

func CreateRegistry(c RegistryConfig) Registry

type RegistryConfig

type RegistryConfig struct {
	DeclineOffer  func(offerId string) error
	TTL           time.Duration // determines a perishable offer's expiration deadline: now+ttl
	LingerTTL     time.Duration // if zero, offers will not linger in the FIFO past their expiration deadline
	ListenerDelay time.Duration // specifies the sleep time between offer listener notifications
}

type Walker

type Walker func(offer Perishable) (stop bool, err error)

callback that is invoked during a walk through a series of live offers, returning with stop=true (or err != nil) if the walk should stop permaturely.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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