Documentation
¶
Index ¶
Constants ¶
View Source
const ( // CodeSuccess success code CodeSuccess = 0 // CodeError error code CodeError = 1 )
View Source
const (
// APIPrefix url prefix for api
APIPrefix = "/pd"
)
Variables ¶
This section is empty.
Functions ¶
func NewAPIHandler ¶
NewAPIHandler returns a HTTP handler for API.
Types ¶
type CellInfo ¶
type CellInfo struct {
Meta metapb.Cell `json:"meta"`
LeaderPeer *metapb.Peer `json:"leader"`
DownPeers []pdpb.PeerStats `json:"downPeers"`
PendingPeers []metapb.Peer `json:"pendingPeers"`
}
CellInfo The cell info
type InitParams ¶
type InitParams struct {
InitCellCount uint64 `json:"initCellCount"`
CellCapacity uint64 `json:"cellCapacity"`
}
InitParams initialize the elasticell cluster
type Result ¶
type Result struct {
Code int `json:"code"`
Error string `json:"error, omitempty"`
Value interface{} `json:"value, omitempty"`
}
Result is the return value of api server
type Service ¶
type Service interface {
Name() string
IsLeader() bool
GetLeader() (*pdpb.Leader, error)
GetSystem() (*System, error)
InitCluster(params *InitParams) error
ListStore() ([]*StoreInfo, error)
GetStore(id uint64) (*StoreInfo, error)
DeleteStore(id uint64, force bool) error
SetStoreLogLevel(set *SetLogLevel) error
ListCellInStore(storeID uint64) ([]*CellInfo, error)
ListCell() ([]*CellInfo, error)
GetCell(id uint64) (*CellInfo, error)
TransferLeader(transfer *TransferLeader) error
GetOperator(id uint64) (interface{}, error)
GetOperators() ([]interface{}, error)
ListIndex() ([]*pdpb.IndexDef, error)
GetIndex(id string) (*pdpb.IndexDef, error)
CreateIndex(idxDef *pdpb.IndexDef) error
DeleteIndex(id string) error
}
Service service interface
type SetLogLevel ¶
SetLogLevel set log level for components
type StoreInfo ¶
type StoreInfo struct {
Meta metapb.Store `json:"meta"`
Status *StoreStatus `json:"status"`
}
StoreInfo store info
type StoreStatus ¶
type StoreStatus struct {
Stats *pdpb.StoreStats `json:"stats"`
LeaderCount uint32 `json:"leaderCount"`
LastHeartbeatTS int64 `json:"lastHeartbeatTS"`
}
StoreStatus store status
type System ¶
type System struct {
AlreadyBootstrapped bool `json:"alreadyBootstrapped"`
InitParams *InitParams `json:"initParams, omitempty"`
MaxReplicas uint32 `json:"maxReplicas, omitempty"`
StoreCount int `json:"storeCount, omitempty"`
OfflineStoreCount int `json:"offlineStoreCount, omitempty"`
TombStoneStoreCount int `json:"tombStoneStoreCount, omitempty"`
CellCount int `json:"cellCount, omitempty"`
ReplicasNotFullCellCount int `json:"replicasNotFullCellCount, omitempty"`
StorageCapacity uint64 `json:"storageCapacity, omitempty"`
StorageAvailable uint64 `json:"storageAvailable, omitempty"`
OperatorCount int `json:"operatorCount, omitempty"`
}
System The system info of the elasticell cluster
type TransferLeader ¶
TransferLeader transfer leader to spec peer
Click to show internal directories.
Click to hide internal directories.