httpsched

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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:

  • an error occurs while decoding an object from the subscription stream
  • mesos reports an ERROR-type scheduler.Event object via the subscription stream
  • an object on the stream does not decode to a *scheduler.Event (sanity check)

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 CandidateSelector added in v0.0.9

type CandidateSelector func() string

CandidateSelector returns the next endpoint to try if there are errors reaching the mesos master, or else an empty string if there are no such candidates.

type Notification added in v0.0.7

type Notification struct {
	Type NotificationType
}

Notification objects are sent to a registered client listener (see Listener) when the state of the scheduler client changes (e.g. from disconnected to connected).

type NotificationType added in v0.0.7

type NotificationType uint8
const (
	NotificationUndefined NotificationType = iota
	NotificationDisconnected
	NotificationConnected
)

func (NotificationType) String added in v0.0.7

func (t NotificationType) String() string

type Option

type Option func(*client) Option

Option is a functional configuration option type

func AllowReconnection added in v0.0.6

func AllowReconnection(v bool) Option

AllowReconnection allows a subsequent SUBSCRIBE call before a prior SUBSCRIBE has experienced a network or protocol error. Useful in concert with heartbeat detection and for other edge error cases not handled by the connection state machine.

func EndpointCandidates added in v0.0.9

func EndpointCandidates(cs CandidateSelector) Option

func Listener added in v0.0.7

func Listener(l func(Notification)) Option

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

Jump to

Keyboard shortcuts

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