calls

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept

func Accept(ops ...AcceptOpt) *scheduler.Call

Accept returns an accept call with the given parameters. Callers are expected to fill in the FrameworkID and Filters.

func AcceptInverseOffers

func AcceptInverseOffers(offerIDs ...mesos.OfferID) *scheduler.Call

AcceptInverseOffers returns an accept-inverse-offers call for the given offer IDs. Callers are expected to fill in the FrameworkID and Filters.

func Acknowledge

func Acknowledge(agentID, taskID string, uuid []byte) *scheduler.Call

Acknowledge returns an acknowledge call with the given parameters. Callers are expected to fill in the FrameworkID.

func CallNoData

func CallNoData(ctx context.Context, caller Caller, call *scheduler.Call) error

CallNoData is a convenience func that executes the given Call using the provided Caller and always drops the response data.

func Decline

func Decline(offerIDs ...mesos.OfferID) *scheduler.Call

Decline returns a decline call with the given parameters. Callers are expected to fill in the FrameworkID and Filters.

func DeclineInverseOffers

func DeclineInverseOffers(offerIDs ...mesos.OfferID) *scheduler.Call

DeclineInverseOffers returns a decline-inverse-offers call for the given offer IDs. Callers are expected to fill in the FrameworkID and Filters.

func Filters

func Filters(fo ...mesos.FilterOpt) scheduler.CallOpt

Filters sets a scheduler.Call's internal Filters, required for Accept and Decline calls.

func Framework

func Framework(id string) scheduler.CallOpt

Framework sets a scheduler.Call's FrameworkID

func Kill

func Kill(taskID, agentID string) *scheduler.Call

Kill returns a kill call with the given parameters. Callers are expected to fill in the FrameworkID.

func Message

func Message(agentID, executorID string, data []byte) *scheduler.Call

Message returns a message call with the given parameters. Callers are expected to fill in the FrameworkID.

func OpCreate

func OpCreate(rs ...mesos.Resource) mesos.Offer_Operation

func OpDestroy

func OpDestroy(rs ...mesos.Resource) mesos.Offer_Operation

func OpLaunch

func OpLaunch(ti ...mesos.TaskInfo) mesos.Offer_Operation

OpLaunch returns a launch operation builder for the given tasks

func OpLaunchGroup

func OpLaunchGroup(ei mesos.ExecutorInfo, ti ...mesos.TaskInfo) mesos.Offer_Operation

func OpReserve

func OpReserve(rs ...mesos.Resource) mesos.Offer_Operation

func OpUnreserve

func OpUnreserve(rs ...mesos.Resource) mesos.Offer_Operation

func Reconcile

func Reconcile(opts ...scheduler.ReconcileOpt) *scheduler.Call

Reconcile returns a reconcile call with the given parameters. See ReconcileTask. Callers are expected to fill in the FrameworkID.

func ReconcileTasks

func ReconcileTasks(tasks map[string]string) scheduler.ReconcileOpt

ReconcileTasks constructs a []Call_Reconcile_Task from the given mappings:

map[string]string{taskID:agentID}

Map keys (taskID's) are required to be non-empty, but values (agentID's) *may* be empty.

func RefuseSeconds

func RefuseSeconds(d time.Duration) scheduler.CallOpt

RefuseSeconds returns a calls.Filters option that sets RefuseSeconds to the given duration

func RefuseSecondsWithJitter

func RefuseSecondsWithJitter(r *rand.Rand, d time.Duration) scheduler.CallOpt

RefuseSecondsWithJitter returns a calls.Filters option that sets RefuseSeconds to a random number of seconds between 0 and the given duration.

func Request

func Request(requests ...mesos.Request) *scheduler.Call

Request returns a resource request call with the given parameters. Callers are expected to fill in the FrameworkID.

func Revive

func Revive() *scheduler.Call

Revive returns a revive call. Callers are expected to fill in the FrameworkID.

func Role

func Role(role string) scheduler.CallOpt

Role decorates Revive and Suppress calls; panics for any other call type.

func Shutdown

func Shutdown(executorID, agentID string) *scheduler.Call

Shutdown returns a shutdown call with the given parameters. Callers are expected to fill in the FrameworkID.

func Subscribe

func Subscribe(info *mesos.FrameworkInfo) *scheduler.Call

Subscribe returns a subscribe call with the given parameters. The call's FrameworkID is automatically filled in from the info specification.

func SubscribeTo

func SubscribeTo(frameworkID string) scheduler.CallOpt

SubscribeTo returns an option that configures a SUBSCRIBE call w/ a framework ID. If frameworkID is "" then the SUBSCRIBE call is cleared of all framework ID references. Panics if the call does not contain a non-nil Subscribe reference.

func Suppress

func Suppress() *scheduler.Call

Suppress returns a suppress call. Callers are expected to fill in the FrameworkID.

Types

type AcceptOpt

type AcceptOpt func(*acceptBuilder)

type AckError

type AckError struct {
	Ack   *scheduler.Call
	Cause error
}

AckError wraps a caller-generated error and tracks the call that failed.

func (*AckError) Error

func (err *AckError) Error() string

type Caller

type Caller interface {
	// Call issues a call to Mesos and properly manages call-specific HTTP response headers & data.
	Call(context.Context, *scheduler.Call) (mesos.Response, error)
}

Caller is the public interface this framework scheduler's should consume

type CallerFunc

type CallerFunc func(context.Context, *scheduler.Call) (mesos.Response, error)

CallerFunc is the functional adaptation of the Caller interface

func (CallerFunc) Call

func (f CallerFunc) Call(ctx context.Context, c *scheduler.Call) (mesos.Response, error)

Call implements the Caller interface for CallerFunc

type OfferOperations

type OfferOperations []mesos.Offer_Operation

func (OfferOperations) WithOffers

func (ob OfferOperations) WithOffers(ids ...mesos.OfferID) AcceptOpt

WithOffers allows a client to pair some set of OfferOperations with multiple resource offers. Example: calls.Accept(calls.OfferOperations{calls.OpLaunch(tasks...)}.WithOffers(offers...))

Jump to

Keyboard shortcuts

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