placement

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServicesPathName is the services part of the API path.
	ServicesPathName = "services"
	// PlacementPathName is the placement part of the API path.
	PlacementPathName = "placement"
)
View Source
const (
	// AddHTTPMethod is the HTTP method used with this resource.
	AddHTTPMethod = http.MethodPost
)
View Source
const (
	// DeleteAllHTTPMethod is the HTTP method used with this resource.
	DeleteAllHTTPMethod = http.MethodDelete
)
View Source
const (

	// DeleteHTTPMethod is the HTTP method used with this resource.
	DeleteHTTPMethod = http.MethodDelete
)
View Source
const (
	// GetHTTPMethod is the HTTP method used with this resource.
	GetHTTPMethod = http.MethodGet
)
View Source
const (
	// ReplaceHTTPMethod is the HTTP method for the the replace endpoint.
	ReplaceHTTPMethod = http.MethodPost
)
View Source
const (
	// SetHTTPMethod is the HTTP method for the the upsert endpoint.
	SetHTTPMethod = http.MethodPost
)

Variables

View Source
var (
	// DeprecatedM3DBAddURL is the old url for the placement add handler, maintained for
	// backwards compatibility.
	DeprecatedM3DBAddURL = path.Join(handler.RoutePrefixV1, PlacementPathName)

	// M3DBAddURL is the url for the placement add handler (with the POST method)
	// for the M3DB service.
	M3DBAddURL = path.Join(handler.RoutePrefixV1, M3DBServicePlacementPathName)

	// M3AggAddURL is the url for the placement add handler (with the POST method)
	// for the M3Agg service.
	M3AggAddURL = path.Join(handler.RoutePrefixV1, M3AggServicePlacementPathName)

	// M3CoordinatorAddURL is the url for the placement add handler (with the POST method)
	// for the M3Coordinator service.
	M3CoordinatorAddURL = path.Join(handler.RoutePrefixV1, M3CoordinatorServicePlacementPathName)
)
View Source
var (
	// M3DBServicePlacementPathName is the M3DB service placement API path.
	M3DBServicePlacementPathName = path.Join(ServicesPathName,
		handleroptions.M3DBServiceName, PlacementPathName)
	// M3AggServicePlacementPathName is the M3Agg service placement API path.
	M3AggServicePlacementPathName = path.Join(ServicesPathName,
		handleroptions.M3AggregatorServiceName, PlacementPathName)
	// M3CoordinatorServicePlacementPathName is the M3Coordinator
	// service placement API path.
	M3CoordinatorServicePlacementPathName = path.Join(ServicesPathName,
		handleroptions.M3CoordinatorServiceName, PlacementPathName)
)
View Source
var (

	// DeprecatedM3DBDeleteURL is the old url for the placement delete handler, maintained
	// for backwards compatibility.
	DeprecatedM3DBDeleteURL = path.Join(handler.RoutePrefixV1, PlacementPathName, placementIDPath)

	// M3DBDeleteURL is the url for the placement delete handler for the M3DB service.
	M3DBDeleteURL = path.Join(handler.RoutePrefixV1, M3DBServicePlacementPathName, placementIDPath)

	// M3AggDeleteURL is the url for the placement delete handler for the M3Agg service.
	M3AggDeleteURL = path.Join(handler.RoutePrefixV1, M3AggServicePlacementPathName, placementIDPath)

	// M3CoordinatorDeleteURL is the url for the placement delete handler for the M3Coordinator service.
	M3CoordinatorDeleteURL = path.Join(handler.RoutePrefixV1, M3CoordinatorServicePlacementPathName, placementIDPath)
)
View Source
var (
	// DeprecatedM3DBDeleteAllURL is the old url for the handler to delete all placements, maintained
	// for backwards compatibility.
	DeprecatedM3DBDeleteAllURL = path.Join(handler.RoutePrefixV1, PlacementPathName)

	// M3DBDeleteAllURL is the url for the handler to delete all placements (with the DELETE method)
	// for the M3DB service.
	M3DBDeleteAllURL = path.Join(handler.RoutePrefixV1, M3DBServicePlacementPathName)

	// M3AggDeleteAllURL is the url for the handler to delete all placements (with the DELETE method)
	// for the M3Agg service.
	M3AggDeleteAllURL = path.Join(handler.RoutePrefixV1, M3AggServicePlacementPathName)

	// M3CoordinatorDeleteAllURL is the url for the handler to delete all placements (with the DELETE method)
	// for the M3Coordinator service.
	M3CoordinatorDeleteAllURL = path.Join(handler.RoutePrefixV1, M3CoordinatorServicePlacementPathName)
)
View Source
var (
	// DeprecatedM3DBGetURL is the old url for the placement get handler, maintained for
	// backwards compatibility.
	DeprecatedM3DBGetURL = path.Join(handler.RoutePrefixV1, PlacementPathName)

	// M3DBGetURL is the url for the placement get handler (with the GET method)
	// for the M3DB service.
	M3DBGetURL = path.Join(handler.RoutePrefixV1, M3DBServicePlacementPathName)

	// M3AggGetURL is the url for the placement get handler (with the GET method)
	// for the M3Agg service.
	M3AggGetURL = path.Join(handler.RoutePrefixV1, M3AggServicePlacementPathName)

	// M3CoordinatorGetURL is the url for the placement get handler (with the GET method)
	// for the M3Coordinator service.
	M3CoordinatorGetURL = path.Join(handler.RoutePrefixV1, M3CoordinatorServicePlacementPathName)
)
View Source
var (
	// DeprecatedM3DBInitURL is the old url for the placement init handler, maintained for backwards
	// compatibility. (with the POST method).
	DeprecatedM3DBInitURL = path.Join(handler.RoutePrefixV1, PlacementPathName, initPathName)

	// M3DBInitURL is the url for the placement init handler, (with the POST method).
	M3DBInitURL = path.Join(handler.RoutePrefixV1, M3DBServicePlacementPathName, initPathName)

	// M3AggInitURL is the url for the m3agg placement init handler (with the POST method).
	M3AggInitURL = path.Join(handler.RoutePrefixV1, M3AggServicePlacementPathName, initPathName)

	// M3CoordinatorInitURL is the url for the m3agg placement init handler (with the POST method).
	M3CoordinatorInitURL = path.Join(handler.RoutePrefixV1, M3CoordinatorServicePlacementPathName, initPathName)

	// InitHTTPMethod is the HTTP method used with this resource.
	InitHTTPMethod = http.MethodPost
)
View Source
var (
	// M3DBReplaceURL is the url for the m3db replace handler (method POST).
	M3DBReplaceURL = path.Join(handler.RoutePrefixV1,
		M3DBServicePlacementPathName, replacePathName)

	// M3AggReplaceURL is the url for the m3aggregator replace handler (method
	// POST).
	M3AggReplaceURL = path.Join(handler.RoutePrefixV1,
		M3AggServicePlacementPathName, replacePathName)

	// M3CoordinatorReplaceURL is the url for the m3coordinator replace handler
	// (method POST).
	M3CoordinatorReplaceURL = path.Join(handler.RoutePrefixV1,
		M3CoordinatorServicePlacementPathName, replacePathName)
)
View Source
var (
	// M3DBSetURL is the url for the m3db replace handler (method POST).
	M3DBSetURL = path.Join(handler.RoutePrefixV1,
		M3DBServicePlacementPathName, setPathName)

	// M3AggSetURL is the url for the m3aggregator replace handler (method
	// POST).
	M3AggSetURL = path.Join(handler.RoutePrefixV1,
		M3AggServicePlacementPathName, setPathName)

	// M3CoordinatorSetURL is the url for the m3coordinator replace handler
	// (method POST).
	M3CoordinatorSetURL = path.Join(handler.RoutePrefixV1,
		M3CoordinatorServicePlacementPathName, setPathName)
)

Functions

func ConvertInstancesProto

func ConvertInstancesProto(instancesProto []*placementpb.Instance) ([]placement.Instance, error)

ConvertInstancesProto converts a slice of protobuf `Instance`s to `placement.Instance`s

func RegisterRoutes

func RegisterRoutes(
	r *mux.Router,
	defaults []handleroptions.ServiceOptionsDefault,
	opts HandlerOptions,
)

RegisterRoutes registers the placement routes

func Service

func Service(
	clusterClient clusterclient.Client,
	opts handleroptions.ServiceOptions,
	now time.Time,
	validationFn placement.ValidateFn,
) (placement.Service, error)

Service gets a placement service from m3cluster client

func ServiceWithAlgo added in v0.4.6

func ServiceWithAlgo(
	clusterClient clusterclient.Client,
	opts handleroptions.ServiceOptions,
	now time.Time,
	validationFn placement.ValidateFn,
) (placement.Service, placement.Algorithm, error)

ServiceWithAlgo gets a placement service from m3cluster client and additionally returns an algorithm instance for callers that need fine-grained control over placement updates.

Types

type AddHandler

type AddHandler Handler

AddHandler is the handler for placement adds.

func NewAddHandler

func NewAddHandler(opts HandlerOptions) *AddHandler

NewAddHandler returns a new instance of AddHandler.

func (*AddHandler) Add

Add adds a placement.

func (*AddHandler) ServeHTTP

type DeleteAllHandler

type DeleteAllHandler Handler

DeleteAllHandler is the handler to delete all placements.

func NewDeleteAllHandler

func NewDeleteAllHandler(opts HandlerOptions) *DeleteAllHandler

NewDeleteAllHandler returns a new instance of DeleteAllHandler.

func (*DeleteAllHandler) ServeHTTP

type DeleteHandler

type DeleteHandler Handler

DeleteHandler is the handler for placement deletes.

func NewDeleteHandler

func NewDeleteHandler(opts HandlerOptions) *DeleteHandler

NewDeleteHandler returns a new instance of DeleteHandler.

func (*DeleteHandler) ServeHTTP

type GetHandler

type GetHandler Handler

GetHandler is the handler for placement gets.

func NewGetHandler

func NewGetHandler(opts HandlerOptions) *GetHandler

NewGetHandler returns a new instance of GetHandler.

func (*GetHandler) Get added in v0.6.0

func (h *GetHandler) Get(
	svc handleroptions.ServiceNameAndDefaults,
	httpReq *http.Request,
) (placement placement.Placement, badRequest bool, err error)

Get gets a placement.

func (*GetHandler) ServeHTTP

type Handler

type Handler struct {
	HandlerOptions
	// contains filtered or unexported fields
}

Handler represents a generic handler for placement endpoints.

type HandlerOptions added in v0.4.7

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

HandlerOptions is the options struct for the handler.

func NewHandlerOptions added in v0.4.7

func NewHandlerOptions(
	client clusterclient.Client,
	cfg config.Configuration,
	m3AggOpts *handleroptions.M3AggServiceOptions,
	instrumentOpts instrument.Options,
) (HandlerOptions, error)

NewHandlerOptions is the constructor function for HandlerOptions.

type InitHandler

type InitHandler Handler

InitHandler is the handler for placement inits.

func NewInitHandler

func NewInitHandler(opts HandlerOptions) *InitHandler

NewInitHandler returns a new instance of InitHandler.

func (*InitHandler) Init

Init initializes a placement.

func (*InitHandler) ServeHTTP

type ReplaceHandler added in v0.4.8

type ReplaceHandler Handler

ReplaceHandler is the type for placement replaces.

func NewReplaceHandler added in v0.4.8

func NewReplaceHandler(opts HandlerOptions) *ReplaceHandler

NewReplaceHandler returns a new ReplaceHandler.

func (*ReplaceHandler) Replace added in v0.4.8

Replace replaces instances.

func (*ReplaceHandler) ServeHTTP added in v0.4.8

type SetHandler added in v0.15.0

type SetHandler Handler

SetHandler is the type for placement replaces.

func NewSetHandler added in v0.15.0

func NewSetHandler(opts HandlerOptions) *SetHandler

NewSetHandler returns a new SetHandler.

func (*SetHandler) ServeHTTP added in v0.15.0

Jump to

Keyboard shortcuts

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