swarm/storage/feed/lookup: fix typos

This commit is contained in:
Javier Peletier 2019-04-23 13:48:27 +02:00
parent 709cc6f3ea
commit 1109b73603
3 changed files with 7 additions and 7 deletions

View file

@ -41,7 +41,7 @@ const enablePrintMetrics = false // set to true to display algorithm benchmarkin
func printMetric(metric string, store *Store, elapsed time.Duration) { func printMetric(metric string, store *Store, elapsed time.Duration) {
if enablePrintMetrics { if enablePrintMetrics {
fmt.Printf("metric=%s, readcount=%d (successful=%d, failed=%d), cached=%d, canceled=%d, maxSimult=%d, elapsed=%s\n", metric, fmt.Printf("metric=%s, readcount=%d (successful=%d, failed=%d), cached=%d, canceled=%d, maxSimult=%d, elapsed=%s\n", metric,
store.reads, store.sucessful, store.failed, store.cacheHits, store.canceled, store.maxSimultaneous, elapsed) store.reads, store.successful, store.failed, store.cacheHits, store.canceled, store.maxSimultaneous, elapsed)
} }
} }

View file

@ -42,7 +42,7 @@ type StoreCounters struct {
reads int reads int
cacheHits int cacheHits int
failed int failed int
sucessful int successful int
canceled int canceled int
maxSimultaneous int maxSimultaneous int
} }
@ -122,7 +122,7 @@ func (s *Store) Get(ctx context.Context, epoch lookup.Epoch, now uint64) (value
if item != nil { if item != nil {
s.cacheHits++ s.cacheHits++
if item.Time <= now { if item.Time <= now {
s.sucessful++ s.successful++
return item, nil return item, nil
} }
return nil, nil return nil, nil
@ -133,7 +133,7 @@ func (s *Store) Get(ctx context.Context, epoch lookup.Epoch, now uint64) (value
item = s.data[epochID] item = s.data[epochID]
if item != nil { if item != nil {
operationTime += s.SuccessfulReadTime operationTime += s.SuccessfulReadTime
s.sucessful++ s.successful++
s.cache[epochID] = item s.cache[epochID] = item
if item.Time <= now { if item.Time <= now {
return item, nil return item, nil

View file

@ -58,9 +58,9 @@ func (s *Stopwatch) Tick() {
} }
} }
// GetTimer returns a new timer that will trigger after `duration` elapses in the // NewTimer returns a new timer that will trigger after `duration` elapses in the
// simulation // simulation
func (s *Stopwatch) GetTimer(duration time.Duration) <-chan time.Time { func (s *Stopwatch) NewTimer(duration time.Duration) <-chan time.Time {
s.lock.Lock() s.lock.Lock()
defer s.lock.Unlock() defer s.lock.Unlock()
@ -78,7 +78,7 @@ func (s *Stopwatch) GetTimer(duration time.Duration) <-chan time.Time {
// TimeAfter returns a simulated timer factory that can replace `time.After` // TimeAfter returns a simulated timer factory that can replace `time.After`
func (s *Stopwatch) TimeAfter() func(d time.Duration) <-chan time.Time { func (s *Stopwatch) TimeAfter() func(d time.Duration) <-chan time.Time {
return func(d time.Duration) <-chan time.Time { return func(d time.Duration) <-chan time.Time {
return s.GetTimer(d) return s.NewTimer(d)
} }
} }