package httpsched

import "github.com/mesos/mesos-go/api/v1/lib/httpcli/httpsched"

Index

Variables

var CodesIndicatingSubscriptionLoss = func(codes ...apierrors.Code) map[apierrors.Code]struct{} {
	result := make(map[apierrors.Code]struct{}, len(codes))
	for _, code := range codes {
		result[code] = struct{}{}
	}
	return result
}(

	apierrors.CodeUnsubscribed,
)

CodesIndicatingSubscriptionLoss is a set of apierror.Code entries which each indicate that the event subscription stream has been severed between the scheduler and mesos. It's respresented as a public map variable so that clients can program additional error codes (if such are discovered) without hacking the code of the mesos-go library directly.

var (
	DefaultRedirectSettings = RedirectSettings{
		MaxAttempts:      9,
		MaxBackoffPeriod: 13 * time.Second,
		MinBackoffPeriod: 500 * time.Millisecond,
	}
)
var DisconnectionDetector = func(disconnect func()) mesos.ResponseDecorator {
	return mesos.ResponseDecoratorFunc(func(resp mesos.Response) mesos.Response {
		return &mesos.ResponseWrapper{
			Response: resp,
			Decoder:  disconnectionDecoder(resp, disconnect),
		}
	})
}

DisconnectionDetector is a programmable response decorator that attempts to detect errors that should transition the state from "connected" to "disconnected". Detector implementations are expected to invoke the `disconnect` callback in order to initiate the disconnection.

The default implementation will transition to a disconnected state when:

Consumers of this package may choose to override default behavior by overwriting the default value of this var, but should exercise caution: failure to properly transition to a disconnected state may cause subsequent Call operations to fail (without recourse).

Functions

func NewCaller

func NewCaller(cl *httpcli.Client, opts ...Option) calls.Caller

NewCaller returns a scheduler API Client in the form of a Caller. Concurrent invocations of Call upon the returned caller are safely executed in a serial fashion. It is expected that there are no other users of the given Client since its state may be modified by this impl.

Types

type Caller

type Caller interface {
	calls.Caller
	// contains filtered or unexported methods
}

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

type Option

type Option func(*client) Option

Option is a functional configuration option type

func MaxRedirects

func MaxRedirects(mr int) Option

MaxRedirects is a functional option that sets the maximum number of per-call HTTP redirects for a scheduler client

type RedirectSettings

type RedirectSettings struct {
	MaxAttempts      int           // per httpDo invocation
	MaxBackoffPeriod time.Duration // should be more than minBackoffPeriod
	MinBackoffPeriod time.Duration // should be less than maxBackoffPeriod
}

type StateError

type StateError string

func (StateError) Error

func (err StateError) Error() string

Source Files

httpsched.go state.go

Version
v0.0.3
Published
Jun 19, 2017
Platform
windows/amd64
Imports
13 packages
Last checked
39 minutes ago

Tools for package owners.