placementhandler

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package placementhandler provides debug/admin placement operations via HTTP

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 (
	// RemoveHTTPMethod is the HTTP method used with this resource.
	RemoveHTTPMethod = http.MethodPost
)
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 (
	// M3DBAddURL is the url for the placement add handler (with the POST method)
	// for the M3DB service.
	M3DBAddURL = path.Join(route.Prefix, M3DBServicePlacementPathName)

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

	// M3CoordinatorAddURL is the url for the placement add handler (with the POST method)
	// for the M3Coordinator service.
	M3CoordinatorAddURL = path.Join(route.Prefix, 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 (

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

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

	// M3CoordinatorDeleteURL is the url for the placement delete handler for the M3Coordinator service.
	M3CoordinatorDeleteURL = path.Join(route.Prefix, M3CoordinatorServicePlacementPathName, placementIDPath)
)
View Source
var (
	// M3DBDeleteAllURL is the url for the handler to delete all placements (with the DELETE method)
	// for the M3DB service.
	M3DBDeleteAllURL = path.Join(route.Prefix, M3DBServicePlacementPathName)

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

	// M3CoordinatorDeleteAllURL is the url for the handler to delete all placements (with the DELETE method)
	// for the M3Coordinator service.
	M3CoordinatorDeleteAllURL = path.Join(route.Prefix, M3CoordinatorServicePlacementPathName)
)
View Source
var (
	// M3DBGetURL is the url for the placement get handler (with the GET method)
	// for the M3DB service.
	M3DBGetURL = path.Join(route.Prefix, M3DBServicePlacementPathName)

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

	// M3CoordinatorGetURL is the url for the placement get handler (with the GET method)
	// for the M3Coordinator service.
	M3CoordinatorGetURL = path.Join(route.Prefix, M3CoordinatorServicePlacementPathName)
)
View Source
var (
	// M3DBInitURL is the url for the placement init handler, (with the POST method).
	M3DBInitURL = path.Join(route.Prefix, M3DBServicePlacementPathName, initPathName)

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

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

	// InitHTTPMethod is the HTTP method used with this resource.
	InitHTTPMethod = http.MethodPost
)
View Source
var (
	// M3DBRemoveURL is the url for the placement Remove handler (with the POST method)
	// for the M3DB service.
	M3DBRemoveURL = path.Join(route.Prefix, M3DBServicePlacementPathName, removePathName)

	// M3AggRemoveURL is the url for the placement Remove handler (with the POST method)
	// for the M3Agg service.
	M3AggRemoveURL = path.Join(route.Prefix, M3AggServicePlacementPathName, removePathName)

	// M3CoordinatorRemoveURL is the url for the placement Remove handler (with the POST method)
	// for the M3Coordinator service.
	M3CoordinatorRemoveURL = path.Join(route.Prefix, M3CoordinatorServicePlacementPathName, removePathName)
)
View Source
var (
	// M3DBReplaceURL is the url for the m3db replace handler (method POST).
	M3DBReplaceURL = path.Join(route.Prefix,
		M3DBServicePlacementPathName, replacePathName)

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

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

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

	// M3CoordinatorSetURL is the url for the m3coordinator replace handler
	// (method POST).
	M3CoordinatorSetURL = path.Join(route.Prefix,
		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 Service

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

Service gets a placement service from m3cluster client

func ServiceWithAlgo

func ServiceWithAlgo(
	clusterClient clusterclient.Client,
	opts handleroptions.ServiceOptions,
	pConfig placement.Configuration,
	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

func (h *GetHandler) Get(
	svc handleroptions.ServiceNameAndDefaults,
	httpReq *http.Request,
) (placement placement.Placement, 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.

func (Handler) PlacementConfig

func (h Handler) PlacementConfig() placement.Configuration

PlacementConfig returns the placement config.

func (Handler) PlacementConfigCopy

func (h Handler) PlacementConfigCopy() (placement.Configuration, error)

PlacementConfigCopy returns a copy of the placement config.

type HandlerOptions

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

HandlerOptions is the options struct for the handler.

func NewHandlerOptions

func NewHandlerOptions(
	client clusterclient.Client,
	placement placement.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 RemoveHandler

type RemoveHandler Handler

RemoveHandler is the handler for placement removes.

func NewRemoveHandler

func NewRemoveHandler(opts HandlerOptions) *RemoveHandler

NewRemoveHandler returns a new instance of RemoveHandler.

func (*RemoveHandler) Remove

Remove removes an instance.

func (*RemoveHandler) ServeHTTP

ServeHTTP serves HTTP requests. nolint: dupl

type ReplaceHandler

type ReplaceHandler Handler

ReplaceHandler is the type for placement replaces.

func NewReplaceHandler

func NewReplaceHandler(opts HandlerOptions) *ReplaceHandler

NewReplaceHandler returns a new ReplaceHandler.

func (*ReplaceHandler) Replace

Replace replaces instances.

func (*ReplaceHandler) ServeHTTP

type Route

type Route struct {
	Paths   []string
	Methods []string
	Handler http.Handler
}

Route stores paths from this handler that can be registered by clients.

func MakeRoutes

func MakeRoutes(
	defaults []handleroptions.ServiceOptionsDefault,
	opts HandlerOptions,
) []Route

MakeRoutes creates routes for registration in http handlers

type SetHandler

type SetHandler Handler

SetHandler is the type for manually setting a placement value. If none currently exists, this will set the initial placement. Otherwise it will override the existing placement.

func NewSetHandler

func NewSetHandler(opts HandlerOptions) *SetHandler

NewSetHandler returns a new SetHandler.

func (*SetHandler) ServeHTTP

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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