filter

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2017 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("Not found")
	ErrTooManyResults = errors.New("Too many results")
)

Functions

func AsAgent

func AsAgent(msg proto.Message, err error) (*mesos.AgentInfo, error)

func AsAgents

func AsAgents(msgs []proto.Message) []*mesos.AgentInfo

func AsExecutor

func AsExecutor(msg proto.Message, err error) (*mesos.ExecutorInfo, error)

func AsExecutors

func AsExecutors(msgs []proto.Message) []*mesos.ExecutorInfo

func AsFramework

func AsFramework(msg proto.Message, err error) (*mesos.FrameworkInfo, error)

func AsFrameworks

func AsFrameworks(msgs []proto.Message) []*mesos.FrameworkInfo

func AsTask

func AsTask(msg proto.Message, err error) (*mesos.Task, error)

func AsTasks

func AsTasks(msgs []proto.Message) []*mesos.Task

Types

type ErrInvalidMessage

type ErrInvalidMessage struct {
	// contains filtered or unexported fields
}

ErrInvalidMessage is returned when we expect one type of proto.Message but get another.

func (ErrInvalidMessage) Error

func (e ErrInvalidMessage) Error() string

type Filter

type Filter func(proto.Message) bool

Filter is used to query a State and match a single protobuf message.

func AgentAnyFilter

func AgentAnyFilter() Filter

func AgentIDFilter

func AgentIDFilter(agentID string, fuzzy bool) Filter

func ExecutorIDFilter

func ExecutorIDFilter(executorID string, fuzzy bool) Filter

func FrameworkIDFilter

func FrameworkIDFilter(frameworkID string, fuzzy bool) Filter

func TaskIDFilter

func TaskIDFilter(taskID string, fuzzy bool) Filter

func TaskStateFilter

func TaskStateFilter(states []*mesos.TaskState) Filter

type Messages

type Messages []proto.Message

Messages is a filterable array of protobuf.Message.

func FromAgent

func FromAgent(resp *agent.Response) Messages

func FromMaster

func FromMaster(resp *master.Response) Messages

func (Messages) FindAny

func (messages Messages) FindAny(filters ...Filter) (proto.Message, error)

FindAny will return the first message where all filters return true. If no messages match we will return ErrNotFound.

func (Messages) FindMany

func (messages Messages) FindMany(filters ...Filter) Messages

FindMany will return as many messages in which all of the filters match true. If no messages match all the filters we will return an empty []proto.Message.

func (Messages) FindOne

func (messages Messages) FindOne(filters ...Filter) (proto.Message, error)

FindOne will a single message where all filters return true. If more than one message matches return ErrTooManyResults. If no messages match all filters we will return ErrNotFound.

Jump to

Keyboard shortcuts

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