diff --git a/controller-rpc.go b/controller-rpc.go index 4d2357f11..56cee5f0d 100644 --- a/controller-rpc.go +++ b/controller-rpc.go @@ -34,6 +34,8 @@ type controllerRPCService struct { serverList []ServerRep } +const tb = (1024 * 1024 * 1024 * 1024) + func makeDonut(args *DonutArgs, reply *DefaultRep) *probe.Error { conf := &donut.Config{Version: "0.0.1"} conf.DonutName = args.Name @@ -56,6 +58,19 @@ func (s *controllerRPCService) MakeDonut(r *http.Request, args *DonutArgs, reply 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 func generateAuth(args *AuthArgs, reply *AuthRep) *probe.Error { config, err := auth.LoadConfig() diff --git a/rpc-definitions.go b/rpc-definitions.go index 741db7ca7..689e80f96 100644 --- a/rpc-definitions.go +++ b/rpc-definitions.go @@ -115,3 +115,20 @@ type AuthRep struct { AccessKeyID string `json:"accessKeyId"` 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"` +}