Merge pull request #865 from krishnasrinivas/dummydonutstats
Donut dummy services - StorageStats, RebalaceStats
This commit is contained in:
commit
c92145c3df
2 changed files with 32 additions and 0 deletions
|
@ -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()
|
||||
|
|
|
@ -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"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue