rest

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OpenEBSJivaRegestrationRequestDuration gets the response time of the
	// requested api.
	OpenEBSJivaRegestrationRequestDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "openebs_jiva_registration_request_duration_seconds",
			Help:    "Request response time of the /v1/register to register replicas.",
			Buckets: []float64{0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.5, 1, 2.5, 5, 10},
		},

		[]string{"code", "method"},
	)
	// OpenEBSJivaRegestrationRequestCounter Count the no of request Since a request has been made on /v1/volume
	OpenEBSJivaRegestrationRequestCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "openebs_jiva_registration_requests_total",
			Help: "Total number of /v1/register requests to register replicas.",
		},
		[]string{"code", "method"},
	)
)

Functions

func DencodeID

func DencodeID(id string) (string, error)

func EncodeID

func EncodeID(id string) string

func NewRouter

func NewRouter(s *Server) *mux.Router

func NewSchema

func NewSchema() *client.Schemas

Types

type Checkpoint added in v1.12.1

type Checkpoint struct {
	client.Resource
	Snapshot string `json:"snapshot"`
}

type DeleteReplicaOutput

type DeleteReplicaOutput struct {
	client.Resource
	DeletedReplicas
}

func SetDeleteReplicaOutput

func SetDeleteReplicaOutput(deletedReplicas DeletedReplicas) *DeleteReplicaOutput

SetDeleteReplicaOutput returns the output containing the list of deleted replicas and other details related to it.

type DeletedReplica

type DeletedReplica struct {
	Replica string `json:"replica"`
	Error   string `json:"error,omitempty"`
	Msg     string `json:"msg"`
}

type DeletedReplicas

type DeletedReplicas struct {
	DeletedReplicasInfo []DeletedReplica `json:"replicas"`
}

type DiskCollection

type DiskCollection struct {
	client.Collection
	Data []string `json:"data"`
}

type JournalInput

type JournalInput struct {
	client.Resource
	Limit int `json:"limit"`
}

type LoggingInput

type LoggingInput struct {
	client.Resource
	LogToFile util.LogToFile `json:"logtofile"`
}

type PrepareRebuildOutput

type PrepareRebuildOutput struct {
	client.Resource
	Disks []string `json:"disks"`
}

type RegReplica

type RegReplica struct {
	client.Resource
	Address  string        `json:"Address"`
	RevCount string        `json:"RevCount"`
	RepType  string        `json:"RepType"`
	RepState string        `json:"RepState"`
	UpTime   time.Duration `json:"UpTime"`
}

type Replica

type Replica struct {
	client.Resource
	Address string `json:"address"`
	Mode    string `json:"mode"`
}

func NewReplica

func NewReplica(context *api.ApiContext, rep types.Replica) *Replica

NewReplica ...

type ReplicaCollection

type ReplicaCollection struct {
	client.Collection
	Data []Replica `json:"data"`
}

type ResizeInput

type ResizeInput struct {
	client.Resource
	Name string `json:"name"`
	Size string `json:"size"`
}

type RevertInput

type RevertInput struct {
	client.Resource
	Name string `json:"name"`
}

type Server

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

func NewServer

func NewServer(c *controller.Controller) *Server

func (*Server) AddTimeout

func (s *Server) AddTimeout(rw http.ResponseWriter, req *http.Request) error

func (*Server) CreateQuorumReplica

func (s *Server) CreateQuorumReplica(rw http.ResponseWriter, req *http.Request) error

func (*Server) CreateReplica

func (s *Server) CreateReplica(rw http.ResponseWriter, req *http.Request) error

func (*Server) DeleteReplica

func (s *Server) DeleteReplica(rw http.ResponseWriter, req *http.Request) error

func (*Server) DeleteSnapshot

func (s *Server) DeleteSnapshot(rw http.ResponseWriter, req *http.Request) error

DeleteSnapshot ...

func (*Server) DeleteVolume

func (s *Server) DeleteVolume(rw http.ResponseWriter, req *http.Request) error

DeleteVolume handles the delete request call from the controller's client. It checks for the replication factor before deleting the replicas. If the replica count is equal to the replication factor then it will proceed to delete. If not, it returns a response explaining the cause of error in response.

func (*Server) GetCheckpoint added in v1.12.1

func (s *Server) GetCheckpoint(rw http.ResponseWriter, req *http.Request) error

func (*Server) GetController added in v1.12.1

func (s *Server) GetController() *controller.Controller

func (*Server) GetReplica

func (s *Server) GetReplica(rw http.ResponseWriter, req *http.Request) error

func (*Server) GetReplicaInfo

func (s *Server) GetReplicaInfo(replicas []types.Replica) []types.ReplicaInfo

func (*Server) GetVolume

func (s *Server) GetVolume(rw http.ResponseWriter, req *http.Request) error

func (*Server) GetVolumeStats

func (s *Server) GetVolumeStats(rw http.ResponseWriter, req *http.Request) error

func (*Server) ListJournal

func (s *Server) ListJournal(rw http.ResponseWriter, req *http.Request) error

ListJournal flushes operation journal (replica read/write, ping, etc.) accumulated since previous flush

func (*Server) ListReplicas

func (s *Server) ListReplicas(rw http.ResponseWriter, req *http.Request) error

func (*Server) ListVolumes

func (s *Server) ListVolumes(rw http.ResponseWriter, req *http.Request) error

func (*Server) PostSetLoggingRequest

func (s *Server) PostSetLoggingRequest(replicas []types.Replica, lf util.LogToFile, errList []error)

func (*Server) PrepareRebuildReplica

func (s *Server) PrepareRebuildReplica(rw http.ResponseWriter, req *http.Request) error

func (*Server) RegisterReplica

func (s *Server) RegisterReplica(rw http.ResponseWriter, req *http.Request) error

func (*Server) ResizeVolume

func (s *Server) ResizeVolume(rw http.ResponseWriter, req *http.Request) error

func (*Server) RevertVolume

func (s *Server) RevertVolume(rw http.ResponseWriter, req *http.Request) error

func (*Server) SetLogging

func (s *Server) SetLogging(rw http.ResponseWriter, req *http.Request) error

func (*Server) ShutdownVolume

func (s *Server) ShutdownVolume(rw http.ResponseWriter, req *http.Request) error

func (*Server) SnapshotVolume

func (s *Server) SnapshotVolume(rw http.ResponseWriter, req *http.Request) error

func (*Server) StartVolume

func (s *Server) StartVolume(rw http.ResponseWriter, req *http.Request) error

func (*Server) UpdateReplica

func (s *Server) UpdateReplica(rw http.ResponseWriter, req *http.Request) error

func (*Server) VerifyRebuildReplica

func (s *Server) VerifyRebuildReplica(rw http.ResponseWriter, req *http.Request) error

type SnapshotInput

type SnapshotInput struct {
	client.Resource
	Name string `json:"name"`
}

type SnapshotOutput

type SnapshotOutput struct {
	client.Resource
	Message string `json:"message"`
}

type StartInput

type StartInput struct {
	client.Resource
	Replicas []string `json:"replicas"`
}

type Timeout

type Timeout struct {
	client.Resource
	Timeout        string `json:"timeout"`
	RPCPingTimeout string `json:"rpcPingTimeout"`
}

type Volume

type Volume struct {
	client.Resource
	Name         string `json:"name"`
	ReplicaCount int    `json:"replicaCount"`
	ReadOnly     string `json:"readOnly"`
}

func NewVolume

func NewVolume(context *api.ApiContext, name string, readOnly bool, replicas int) *Volume

NewVolume ...

type VolumeCollection

type VolumeCollection struct {
	client.Collection
	Data []Volume `json:"data"`
}

type VolumeStats

type VolumeStats struct {
	client.Resource
	IsClientConnected bool          `json:"IsClientConnected"`
	RevisionCounter   int64         `json:"RevisionCounter"`
	ReplicaCounter    int           `json:"ReplicaCounter"`
	SCSIIOCount       map[int]int64 `json:"SCSIIOCount"`

	ReadIOPS            string `json:"ReadIOPS"`
	TotalReadTime       string `json:"TotalReadTime"`
	TotalReadBlockCount string `json:"TotalReadBlockCount"`

	WriteIOPS            string `json:"WriteIOPS"`
	TotalWriteTime       string `json:"TotalWriteTime"`
	TotalWriteBlockCount string `json:"TotalWriteBlockCount"`

	UsedLogicalBlocks string              `json:"UsedLogicalBlocks"`
	UsedBlocks        string              `json:"UsedBlocks"`
	SectorSize        string              `json:"SectorSize"`
	Size              string              `json:"Size"`
	UpTime            string              `json:"UpTime"`
	Name              string              `json:"Name"`
	Replica           []types.Replica     `json:"Replicas"`
	ReplicaInfo       []types.ReplicaInfo `json:"ReplicaInfo"`
	ControllerStatus  string              `json:"Status"`
}

Jump to

Keyboard shortcuts

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