seaweedfs/weed/server/master_server_handlers_ui.go

59 lines
1.4 KiB
Go
Raw Normal View History

2015-03-20 01:39:22 +08:00
package weed_server
import (
"net/http"
"time"
2015-03-20 01:39:22 +08:00
2022-04-07 22:37:40 +08:00
hashicorpRaft "github.com/hashicorp/raft"
"github.com/seaweedfs/raft"
2022-04-07 22:37:40 +08:00
ui "github.com/seaweedfs/seaweedfs/weed/server/master_ui"
"github.com/seaweedfs/seaweedfs/weed/stats"
"github.com/seaweedfs/seaweedfs/weed/util"
2015-03-20 01:39:22 +08:00
)
func (ms *MasterServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
2015-03-23 03:50:04 +08:00
infos := make(map[string]interface{})
infos["Up Time"] = time.Now().Sub(startTime).String()
infos["Max Volume Id"] = ms.Topo.GetMaxVolumeId()
ms.Topo.RaftServerAccessLock.RLock()
defer ms.Topo.RaftServerAccessLock.RUnlock()
2022-04-07 22:37:40 +08:00
if ms.Topo.RaftServer != nil {
args := struct {
Version string
Topology interface{}
RaftServer raft.Server
Stats map[string]interface{}
Counters *stats.ServerStats
VolumeSizeLimitMB uint32
}{
util.Version(),
ms.Topo.ToInfo(),
2022-04-07 22:37:40 +08:00
ms.Topo.RaftServer,
infos,
serverStats,
ms.option.VolumeSizeLimitMB,
}
ui.StatusTpl.Execute(w, args)
} else if ms.Topo.HashicorpRaft != nil {
args := struct {
Version string
Topology interface{}
RaftServer *hashicorpRaft.Raft
Stats map[string]interface{}
Counters *stats.ServerStats
VolumeSizeLimitMB uint32
}{
util.Version(),
ms.Topo.ToInfo(),
2022-04-07 22:37:40 +08:00
ms.Topo.HashicorpRaft,
infos,
serverStats,
ms.option.VolumeSizeLimitMB,
}
ui.StatusNewRaftTpl.Execute(w, args)
2015-03-20 01:39:22 +08:00
}
}