Skip to content

Commit

Permalink
type XxxReports
Browse files Browse the repository at this point in the history
  • Loading branch information
XieBiao committed Jan 2, 2018
1 parent 8453ff5 commit 7fbe88f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ type Report struct {
AvgTtl uint64
}

type DBReports map[uint64][]Report

type KeyReports map[string]Report

type SortReports []Report

type Analysis struct {
redis *RedisClient
Reports map[uint64][]Report
Reports DBReports
}

type SortReports []Report

func (sr SortReports) Len() int {
return len(sr)
}
Expand All @@ -37,7 +41,7 @@ func (sr SortReports) Swap(i, j int) {
}

func NewAnalysis(redis *RedisClient) *Analysis {
return &Analysis{redis, map[uint64][]Report{}}
return &Analysis{redis, DBReports{}}
}

func (analysis Analysis) Start(delimiters []string, limit uint64) {
Expand All @@ -52,12 +56,12 @@ func (analysis Analysis) Start(delimiters []string, limit uint64) {
ttl int64
length uint64
sr SortReports
mr map[string]Report
mr KeyReports
)

for db, _ := range databases {
cursor = 0
mr = map[string]Report{}
mr = KeyReports{}

analysis.redis.Select(db)

Expand Down

0 comments on commit 7fbe88f

Please sign in to comment.