Donut dummy services - StorageStats, RebalaceStats

master
Krishna Srinivas 9 years ago
parent 099b6fcf92
commit 2607ab559a
  1. 15
      controller-rpc.go
  2. 17
      rpc-definitions.go

@ -34,6 +34,8 @@ type controllerRPCService struct {
serverList []ServerRep serverList []ServerRep
} }
const tb = (1024 * 1024 * 1024 * 1024)
func makeDonut(args *DonutArgs, reply *DefaultRep) *probe.Error { func makeDonut(args *DonutArgs, reply *DefaultRep) *probe.Error {
conf := &donut.Config{Version: "0.0.1"} conf := &donut.Config{Version: "0.0.1"}
conf.DonutName = args.Name conf.DonutName = args.Name
@ -56,6 +58,19 @@ func (s *controllerRPCService) MakeDonut(r *http.Request, args *DonutArgs, reply
return nil return nil
} }
// StorageStats returns dummy storage stats
func (s *controllerRPCService) StorageStats(r *http.Request, args *DonutArgs, reply *StorageStatsRep) error {
reply.Buckets = []BucketStorage{{"bucket1", 4 * tb}, {"bucket2", 120 * tb}, {"bucket3", 45 * tb}}
return nil
}
// RebalaceStats returns dummy rebalance stats
func (s *controllerRPCService) RebalanceStats(r *http.Request, args *DonutArgs, reply *RebalanceStatsRep) error {
reply.Inprogress = []string{"bucket1/obj1", "bucket2/obj2", "bucket3/obj3"}
reply.Done = []string{"bucket1/rebobj1", "bucket2/rebobj2", "bucket3/rebobj3"}
return nil
}
// generateAuth generate new auth keys for a user // generateAuth generate new auth keys for a user
func generateAuth(args *AuthArgs, reply *AuthRep) *probe.Error { func generateAuth(args *AuthArgs, reply *AuthRep) *probe.Error {
config, err := auth.LoadConfig() config, err := auth.LoadConfig()

@ -115,3 +115,20 @@ type AuthRep struct {
AccessKeyID string `json:"accessKeyId"` AccessKeyID string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"` SecretAccessKey string `json:"secretAccessKey"`
} }
// BucketStorage bucket-name and storage used
type BucketStorage struct {
Name string `json:"name"`
Used uint64 `json:"used"`
}
// StorageStatsRep array of buckets-storage-stats
type StorageStatsRep struct {
Buckets []BucketStorage `json:"buckets"`
}
// RebalanceStatsRep rebalance information
type RebalanceStatsRep struct {
Inprogress []string `json:"inprogress"`
Done []string `json:"done"`
}

Loading…
Cancel
Save