Rename stuttered service names and make them appropriate

master
Harshavardhana 10 years ago
parent 18a8891a15
commit a3ccb9d405
  1. 6
      pkg/server/router.go
  2. 12
      pkg/server/rpc/diskinfo.go
  3. 12
      pkg/server/rpc/sysinfo.go

@ -117,9 +117,9 @@ func getAPIHandler(conf api.Config) (http.Handler, api.Minio) {
func getRPCHandler() http.Handler { func getRPCHandler() http.Handler {
s := rpc.NewServer() s := rpc.NewServer()
s.RegisterJSONCodec() s.RegisterJSONCodec()
s.RegisterService(new(rpc.VersionService), "") s.RegisterService(new(rpc.VersionService), "Version")
s.RegisterService(new(rpc.GetSysInfoService), "") s.RegisterService(new(rpc.SysInfoService), "SysInfo")
s.RegisterService(new(rpc.GetDiskInfoService), "") s.RegisterService(new(rpc.DiskInfoService), "DiskInfo")
// Add new services here // Add new services here
return registerRPC(router.NewRouter(), s) return registerRPC(router.NewRouter(), s)
} }

@ -24,17 +24,17 @@ import (
"github.com/minio/minio/pkg/utils/scsi" "github.com/minio/minio/pkg/utils/scsi"
) )
// GetDiskInfoService disk info service // DiskInfoService disk info service
type GetDiskInfoService struct{} type DiskInfoService struct{}
// GetDiskInfoReply disk info reply for disk info service // DiskInfoReply disk info reply for disk info service
type GetDiskInfoReply struct { type DiskInfoReply struct {
Hostname string `json:"hostname"` Hostname string `json:"hostname"`
Disks []string `json:"disks"` Disks []string `json:"disks"`
DiskAttributes map[string]scsi.Attributes `json:"disk-attrs"` DiskAttributes map[string]scsi.Attributes `json:"disk-attrs"`
} }
func setDiskInfoReply(sis *GetDiskInfoReply) error { func setDiskInfoReply(sis *DiskInfoReply) error {
var err error var err error
sis.Hostname, err = os.Hostname() sis.Hostname, err = os.Hostname()
if err != nil { if err != nil {
@ -53,6 +53,6 @@ func setDiskInfoReply(sis *GetDiskInfoReply) error {
} }
// Get method // Get method
func (s *GetDiskInfoService) Get(r *http.Request, args *Args, reply *GetDiskInfoReply) error { func (s *DiskInfoService) Get(r *http.Request, args *Args, reply *DiskInfoReply) error {
return setDiskInfoReply(reply) return setDiskInfoReply(reply)
} }

@ -24,11 +24,11 @@ import (
"github.com/minio/minio/pkg/iodine" "github.com/minio/minio/pkg/iodine"
) )
// GetSysInfoService - // SysInfoService -
type GetSysInfoService struct{} type SysInfoService struct{}
// GetSysInfoReply - // SysInfoReply -
type GetSysInfoReply struct { type SysInfoReply struct {
Hostname string `json:"hostname"` Hostname string `json:"hostname"`
SysARCH string `json:"sys.arch"` SysARCH string `json:"sys.arch"`
SysOS string `json:"sys.os"` SysOS string `json:"sys.os"`
@ -38,7 +38,7 @@ type GetSysInfoReply struct {
MemStats runtime.MemStats `json:"memstats"` MemStats runtime.MemStats `json:"memstats"`
} }
func setSysInfoReply(sis *GetSysInfoReply) error { func setSysInfoReply(sis *SysInfoReply) error {
sis.SysARCH = runtime.GOARCH sis.SysARCH = runtime.GOARCH
sis.SysOS = runtime.GOOS sis.SysOS = runtime.GOOS
sis.SysCPUS = runtime.NumCPU() sis.SysCPUS = runtime.NumCPU()
@ -59,6 +59,6 @@ func setSysInfoReply(sis *GetSysInfoReply) error {
} }
// Get method // Get method
func (s *GetSysInfoService) Get(r *http.Request, args *Args, reply *GetSysInfoReply) error { func (s *SysInfoService) Get(r *http.Request, args *Args, reply *SysInfoReply) error {
return setSysInfoReply(reply) return setSysInfoReply(reply)
} }

Loading…
Cancel
Save