server

package
Version: v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 34 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// ErrInvalidPath is used if the HTTP path is not supported
	ErrInvalidPath = "Invalid path"

	// ErrInvalidMethod is used if the HTTP method is not supported
	ErrInvalidMethod = "Invalid http method"

	// ErrGetMethodRequired is used if the HTTP GET method is required"
	ErrGetMethodRequired = "GET method required"

	// ErrPutMethodRequired is used if the HTTP PUT/POST method is required"
	ErrPutMethodRequired = "PUT/POST method required"
)
View Source
const (
	// AnyInstance stands for OpenEBS
	// being able to act as a persistence
	// mechanism for any type of compute
	// instance
	AnyInstance = "any-compute"

	// AnyZone specifies OpenEBS' availability zone
	AnyZone = "any-zone"
)
View Source
const (
	// NamespaceKey is used in request headers to
	// get namespace
	NamespaceKey string = "namespace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPCodedError

type HTTPCodedError interface {
	error
	Code() int
}

HTTPCodedError is used to provide the HTTP error code

func CodedError

func CodedError(c int, msg string) HTTPCodedError

CodedError is used to provide HTTP error Code and corresponding error msg

func CodedErrorWrap

func CodedErrorWrap(code int, err error) HTTPCodedError

CodedErrorWrap is used to provide HTTP error Code and corresponding error

func CodedErrorWrapf

func CodedErrorWrapf(code int, err error, msg string, args ...interface{}) HTTPCodedError

CodedErrorWrapf is used to provide HTTP error Code and corresponding error as well additional details in a format decided by the caller

func CodedErrorf

func CodedErrorf(code int, msg string, args ...interface{}) HTTPCodedError

CodedErrorf is used to provide HTTP error Code and corresponding error details in a format decided by the caller

type HTTPServer

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

HTTPServer is used to wrap maya api server and expose it over an HTTP interface

func NewHTTPServer

func NewHTTPServer(maya *MayaApiServer, config *config.MayaConfig, logOutput io.Writer) (*HTTPServer, error)

NewHTTPServer starts new HTTP server over Maya server

func (*HTTPServer) MetaSpecificRequest

func (s *HTTPServer) MetaSpecificRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error)

MetaSpecificRequest is a handler responsible to perform validation and meta variable substitution into request paths

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown()

Shutdown is used to shutdown the HTTP server

type MayaApiServer

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

MayaApiServer is a long running stateless daemon that runs at openebs maya master(s)

func NewMayaApiServer

func NewMayaApiServer(config *config.MayaConfig, logOutput io.Writer) (*MayaApiServer, error)

NewMayaApiServer is used to create a new maya api server with the given configuration

func (*MayaApiServer) Leave

func (ms *MayaApiServer) Leave() error

Leave is used gracefully exit.

func (*MayaApiServer) Shutdown

func (ms *MayaApiServer) Shutdown() error

Shutdown is used to terminate MayaServer.

Jump to

Keyboard shortcuts

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