server

package
v0.0.0-...-ec68995 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrInvalidMethod is used if the HTTP method is not supported
	ErrInvalidMethod     = "Invalid method"
	ErrGetMethodRequired = "GET method required"
	ErrPutMethodRequired = "PUT/POST method required"
)
View Source
const (
	// OpenEBS can be used as a persistence mechanism for
	// any type of compute instance
	AnyInstance = "any-compute"

	// TODO We shall see how to construct an Availability Zone
	AnyZone = "any-zone"
)

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, s string) HTTPCodedError

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)

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown()

Shutdown is used to shutdown the HTTP server

func (*HTTPServer) SnapshotCreate

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

SnapshotCreate is http handler which handles snaphsot-create request

func (*HTTPServer) SnapshotList

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

SnapshotList is http handler for listing all created snapshot specific to particular volume

func (*HTTPServer) SnapshotRevert

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

SnapshotRevert is http handler for handling snapshot-revert request. Volume and existing snapshot name will be passed as struct fields to revert to that particular snapshot

func (*HTTPServer) SnapshotSpecificRequest

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

SnapshotSpecificRequest deals with snapshot API request w.r.t a Volume

func (*HTTPServer) VSMSpecificRequest

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

VSMSpecificRequest is a http handler implementation. It deals with HTTP requests w.r.t a single VSM.

TODO

Should it return specific types than interface{} ?

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) BootstrapPlugins

func (ms *MayaApiServer) BootstrapPlugins() error

TODO Create a Bootstrap interface that facilitates initialization Create another Bootstraped interface that provides the initialized instances Perhaps at lib/bootstrap MayaServer struct will make use of above interfaces & hence specialized structs that cater to bootstraping & bootstraped features.

NOTE:

The current implementation is tightly coupled & cannot be unit tested.

NOTE:

Mayaserver should be entrusted to registering all possible variants of

volume plugins.

A volume plugin variant is composed of:

volume plugin + orchestrator of volume plugin + region of orchestrator

In addition, Mayaserver should initialize the `default volume plugin` instance with its `default orchestrator` & `default region` of the orchestrator. User initiated requests requiring specific variants should be initialized at runtime.

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