package offers
import "github.com/mesos/mesos-go/api/v1/lib/extras/scheduler/offers"
Index ¶
- Variables
- func KeyFuncByOfferID(o *mesos.Offer) interface{}
- type Filter
- func ByAttributes(f func(attr []mesos.Attribute) bool) Filter
- func ByExecutors(f func(exec []mesos.ExecutorID) bool) Filter
- func ByHostname(hostname string) Filter
- func ByUnavailability(f func(u *mesos.Unavailability) bool) Filter
- func ContainsResources(wanted mesos.Resources) Filter
- type FilterFunc
- type Index
- func NewIndex(slice []mesos.Offer, kf KeyFunc) Index
- func (offers Index) Filter(filter Filter) (result Index)
- func (offers Index) FilterNot(filter Filter) Index
- func (offers Index) Find(filter Filter) *mesos.Offer
- func (offers Index) IDs() []mesos.OfferID
- func (offers Index) ToSlice() (slice Slice)
- type KeyFunc
- type Slice
Variables ¶
var DefaultKeyFunc = KeyFunc(KeyFuncByOfferID)
DefaultKeyFunc indexes offers by their OfferID.
Functions ¶
func KeyFuncByOfferID ¶
func KeyFuncByOfferID(o *mesos.Offer) interface{}
Types ¶
type Filter ¶
type Filter interface { Accept(*mesos.Offer) bool }
Filter accepts or rejects a mesos Offer
func ByAttributes ¶
ByAttributes returns a Filter that accepts offers with an attribute set accepted by the provided Attribute filter func.
func ByExecutors ¶
func ByHostname ¶
ByHostname returns a Filter that accepts offers with a matching Hostname
func ByUnavailability ¶
func ContainsResources ¶
func ContainsResources(wanted mesos.Resources) Filter
ContainsResources returns a filter that returns true if the Resources of an Offer contain the wanted Resources.
type FilterFunc ¶
type FilterFunc func(*mesos.Offer) bool
FilterFunc returns true if the given Offer passes the filter
func (FilterFunc) Accept ¶
func (f FilterFunc) Accept(o *mesos.Offer) bool
Accept implements Filter for FilterFunc
type Index ¶
type Index map[interface{}]*mesos.Offer
Index is a convenience type wrapper for a dictionary of Offer messages
func NewIndex ¶
NewIndex returns a new Index constructed from the list of mesos offers. If the KeyFunc is nil then offers are indexed by DefaultKeyFunc. The values of the returned Index are pointers to (not copies of) the offers of the slice receiver.
func (Index) Filter ¶
Filter returns the subset of the Index that matches the given filter.
func (Index) FilterNot ¶
FilterNot returns the subset of the Index that does not match the given filter.
func (Index) Find ¶
Find returns the first Offer that passes the given filter function, or else nil if there are no passing offers.
func (Index) IDs ¶
func (offers Index) IDs() []mesos.OfferID
IDs extracts the ID field from a Index of offers
func (Index) ToSlice ¶
ToSlice returns a Slice from the offers in the Index. The returned slice will contain shallow copies of the offers from the Index.
type KeyFunc ¶
type KeyFunc func(*mesos.Offer) interface{}
KeyFunc generates a key used for indexing offers
type Slice ¶
type Slice []mesos.Offer
Slice is a convenience type wrapper for a slice of mesos Offer messages
func (Slice) Filter ¶
Filter returns the subset of the Slice that matches the given filter.
func (Slice) FilterNot ¶
FilterNot returns the subset of the Slice that does not match the given filter.
func (Slice) Find ¶
Find returns the first Offer that passes the given filter function, or else nil if there are no passing offers.
func (Slice) IDs ¶
func (offers Slice) IDs() []mesos.OfferID
IDs extracts the ID field from a Slice of offers
Source Files ¶
- Version
- v0.0.11 (latest)
- Published
- May 15, 2020
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 11 hours ago –
Tools for package owners.