1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 12:45:38 +01:00
Files
glusterd2/plugins/glustershd/init.go
Vishal Pandey 933aa93c8f split brain operations API and CLI
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
2018-11-23 19:46:46 +05:30

57 lines
1.7 KiB
Go

package glustershd
import (
"github.com/gluster/glusterd2/glusterd2/servers/rest/route"
"github.com/gluster/glusterd2/glusterd2/transaction"
"github.com/gluster/glusterd2/pkg/utils"
glustershdapi "github.com/gluster/glusterd2/plugins/glustershd/api"
)
// Plugin is a structure which implements GlusterdPlugin interface
type Plugin struct {
}
// Name returns name of plugin
func (p *Plugin) Name() string {
return "glustershd"
}
// RestRoutes returns list of REST API routes to register with Glusterd
func (p *Plugin) RestRoutes() route.Routes {
return route.Routes{
route.Route{
Name: "SelfHealInfo",
Method: "GET",
Pattern: "/volumes/{volname}/{opts}/heal-info",
Version: 1,
ResponseType: utils.GetTypeString(([]glustershdapi.BrickHealInfo)(nil)),
HandlerFunc: selfhealInfoHandler},
route.Route{
Name: "SelfHealInfo2",
Method: "GET",
Pattern: "/volumes/{volname}/heal-info",
Version: 1,
ResponseType: utils.GetTypeString(([]glustershdapi.BrickHealInfo)(nil)),
HandlerFunc: selfhealInfoHandler},
route.Route{
Name: "SelfHeal",
Method: "POST",
Pattern: "/volumes/{volname}/heal",
Version: 1,
HandlerFunc: selfHealHandler},
route.Route{
Name: "Split-Brain-Operations",
Method: "POST",
Pattern: "/volumes/{volname}/split-brain/{operation}",
Version: 1,
RequestType: utils.GetTypeString(([]glustershdapi.SplitBrainReq)(nil)),
HandlerFunc: splitBrainOperationHandler},
}
}
// RegisterStepFuncs registers transaction step functions with
// Glusterd Transaction framework
func (p *Plugin) RegisterStepFuncs() {
transaction.RegisterStepFunc(txnSelfHeal, "selfheal.Heal")
}