Implement configurable scaling PoC

This commit is contained in:
2015-10-27 03:33:04 +03:00
parent b0142de4a7
commit 4eae1c3b8d
2 changed files with 61 additions and 12 deletions
+9 -5
View File
@@ -10,7 +10,8 @@ import (
type Manager interface {
Publisher
Fetcher
Fetch(name string) Stats
Reset()
}
type Publisher interface {
@@ -18,10 +19,6 @@ type Publisher interface {
Error(name string)
}
type Fetcher interface {
Fetch(name string) Stats
}
type Stats interface {
Processed() int64
Errors() int64
@@ -62,6 +59,13 @@ func (b *base) Fetch(name string) Stats {
return b.metrics(name)
}
func (b *base) Reset() {
for _, s := range b.stats {
s.time.Clear()
s.errors.Clear()
}
}
func (s *baseStats) Processed() int64 {
return s.time.Count()
}