Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertInstancesProto(instancesProto []*placementpb.Instance) ([]placement.Instance, error)
- func RegisterRoutes(r *mux.Router, client clusterclient.Client, cfg config.Configuration)
- func Service(clusterClient clusterclient.Client, headers http.Header) (placement.Service, error)
- type AddHandler
- type DeleteAllHandler
- type DeleteHandler
- type GetHandler
- type Handler
- type InitHandler
Constants ¶
const ( // AddURL is the url for the placement add handler (with the POST method). AddURL = handler.RoutePrefixV1 + "/placement" // AddHTTPMethod is the HTTP method used with this resource. AddHTTPMethod = http.MethodPost )
const ( // DefaultServiceName is the default service ID name DefaultServiceName = "m3db" // DefaultServiceEnvironment is the default service ID environment DefaultServiceEnvironment = "default_env" // DefaultServiceZone is the default service ID zone DefaultServiceZone = "embedded" // HeaderClusterServiceName is the header used to specify the service name. HeaderClusterServiceName = "Cluster-Service-Name" // HeaderClusterEnvironmentName is the header used to specify the environment name. HeaderClusterEnvironmentName = "Cluster-Environment-Name" // HeaderClusterZoneName is the header used to specify the zone name. HeaderClusterZoneName = "Cluster-Zone-Name" )
const ( // DeleteAllURL is the url for the handler to delete all placements (with the DELETE method). DeleteAllURL = handler.RoutePrefixV1 + "/placement" // DeleteAllHTTPMethod is the HTTP method used with this resource. DeleteAllHTTPMethod = http.MethodDelete )
const ( // GetURL is the url for the placement get handler (with the GET method). GetURL = handler.RoutePrefixV1 + "/placement" // GetHTTPMethod is the HTTP method used with this resource. GetHTTPMethod = http.MethodGet )
const ( // InitURL is the url for the placement init handler (with the POST method). InitURL = handler.RoutePrefixV1 + "/placement/init" // InitHTTPMethod is the HTTP method used with this resource. InitHTTPMethod = http.MethodPost )
const ( // DeleteHTTPMethod is the HTTP method used with this resource. DeleteHTTPMethod = http.MethodDelete )
Variables ¶
var ( // DeleteURL is the url for the placement delete handler. DeleteURL = fmt.Sprintf("%s/placement/{%s}", handler.RoutePrefixV1, placementIDVar) )
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, client clusterclient.Client, cfg config.Configuration)
RegisterRoutes registers the placement routes
Types ¶
type AddHandler ¶
type AddHandler Handler
AddHandler is the handler for placement adds.
func NewAddHandler ¶
func NewAddHandler(client clusterclient.Client, cfg config.Configuration) *AddHandler
NewAddHandler returns a new instance of AddHandler.
func (*AddHandler) Add ¶
func (h *AddHandler) Add( httpReq *http.Request, req *admin.PlacementAddRequest, ) (placement.Placement, error)
Add adds a placement.
func (*AddHandler) ServeHTTP ¶
func (h *AddHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type DeleteAllHandler ¶
type DeleteAllHandler Handler
DeleteAllHandler is the handler to delete all placements.
func NewDeleteAllHandler ¶
func NewDeleteAllHandler(client clusterclient.Client, cfg config.Configuration) *DeleteAllHandler
NewDeleteAllHandler returns a new instance of DeleteAllHandler.
func (*DeleteAllHandler) ServeHTTP ¶
func (h *DeleteAllHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type DeleteHandler ¶
type DeleteHandler Handler
DeleteHandler is the handler for placement deletes.
func NewDeleteHandler ¶
func NewDeleteHandler(client clusterclient.Client, cfg config.Configuration) *DeleteHandler
NewDeleteHandler returns a new instance of DeleteHandler.
func (*DeleteHandler) ServeHTTP ¶
func (h *DeleteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type GetHandler ¶
type GetHandler Handler
GetHandler is the handler for placement gets.
func NewGetHandler ¶
func NewGetHandler(client clusterclient.Client, cfg config.Configuration) *GetHandler
NewGetHandler returns a new instance of GetHandler.
func (*GetHandler) ServeHTTP ¶
func (h *GetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler represents a generic handler for placement endpoints.
type InitHandler ¶
type InitHandler Handler
InitHandler is the handler for placement inits.
func NewInitHandler ¶
func NewInitHandler(client clusterclient.Client, cfg config.Configuration) *InitHandler
NewInitHandler returns a new instance of InitHandler.
func (*InitHandler) Init ¶
func (h *InitHandler) Init( httpReq *http.Request, req *admin.PlacementInitRequest, ) (placement.Placement, error)
Init initializes a placement.
func (*InitHandler) ServeHTTP ¶
func (h *InitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)