mpb

package
v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 20 Imported by: 24

Documentation

Index

Constants

View Source
const (
	Encoding transport.Encoding = "json"

	// ContentTypeJSON header
	ContentTypeJSON = "json"

	// ContentTypeProtobuf header
	ContentTypeProtobuf = "x-protobuf"
)

Encoding is the name of this encoding.

Variables

This section is empty.

Functions

func MarshalPbMessage

func MarshalPbMessage(msg proto.Message, contentType string) (string, error)

MarshalPbMessage marshal a protobuf message to string based on given content type.

func Register

func Register(d *yarpc.Dispatcher, svc string, registrant Registrant)

Register registers the procedures defined by the given JSON registrant with the given registry.

Handlers must have a signature similar to the following or the system will panic.

f(reqMeta yarpc.ReqMeta, body $reqBody) ($resBody, yarpc.ResMeta, error)

Where $reqBody and $resBody are a map[string]interface{} or pointers to structs.

func UnmarshalPbMessage

func UnmarshalPbMessage(
	data []byte, event reflect.Value, contentType string) error

UnmarshalPbMessage unmarshals a protobuf message from a string based on given content type.

Types

type EventType

type EventType interface {
	String() string
}

EventType is an interface for auto-generated event types from Mesos HTTP API such as mesos/v1/scheduler.proto

type MasterOperatorClient

type MasterOperatorClient interface {
	Agents() (*mesos_master.Response_GetAgents, error)
	GetTasksAllocation(ID string) ([]*mesos.Resource, []*mesos.Resource, error)
	AllocatedResources(ID string) ([]*mesos.Resource, error)
	GetMaintenanceSchedule() (*mesos_master.Response_GetMaintenanceSchedule, error)
	GetMaintenanceStatus() (*mesos_master.Response_GetMaintenanceStatus, error)
	StartMaintenance([]*mesos.MachineID) error
	StopMaintenance([]*mesos.MachineID) error
	GetQuota(role string) ([]*mesos.Resource, error)
	UpdateMaintenanceSchedule(*mesos_v1_maintenance.Schedule) error
}

MasterOperatorClient makes Mesos JSON requests to Mesos Master endpoint(s)

func NewMasterOperatorClient

func NewMasterOperatorClient(
	c transport.ClientConfig,
	contentType string) MasterOperatorClient

NewMasterOperatorClient builds a new Mesos Master Operator JSON client.

type MesosEvent

type MesosEvent interface {
	GetType() EventType
}

MesosEvent is an interface for auto-generated events from Mesos HTTP API such as mesos/v1/scheduler.proto

type MesosEventReader

type MesosEventReader struct {
	Event reflect.Value // Decoded Mesos event
	Type  EventType     // Mesos event type such as offers, rescind etc
}

MesosEventReader decodes a Mesos Event object from RecordIO frame

func NewMesosEventReader

func NewMesosEventReader(data []byte, typ reflect.Type, contentType string) (
	*MesosEventReader, error)

NewMesosEventReader creates a new MesosEventReader

func (MesosEventReader) Read

func (r MesosEventReader) Read(p []byte) (_ int, _ error)

type Registrant

type Registrant interface {
	// contains filtered or unexported methods
}

Registrant is used for types that define or know about different JSON procedures.

func Procedure

func Procedure(name string, handler interface{}) Registrant

Procedure builds a Registrant with a single procedure in it. handler must be a function with a signature similar to,

f(reqMeta yarpc.ReqMeta, body $reqBody) ($resBody, yarpc.ResMeta, error)

Where $reqBody and $resBody are a map[string]interface{} or pointers to structs.

type SchedulerClient

type SchedulerClient interface {
	// Call performs an outbound Mesos JSON request.
	// Returns an error if the request failed.
	Call(mesosStreamID string, msg *mesos_v1_scheduler.Call) error
}

SchedulerClient makes Mesos JSON requests to Mesos endpoint

func NewSchedulerClient

func NewSchedulerClient(c transport.ClientConfig, contentType string) SchedulerClient

NewSchedulerClient builds a new Mesos Scheduler JSON client.

Jump to

Keyboard shortcuts

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