Skip to content

Commit

Permalink
pool: Add noop statistic
Browse files Browse the repository at this point in the history
close #431

Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Jun 20, 2023
1 parent d8e66c9 commit 27b315f
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions pool/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package pool

import (
"time"
)

// noOpClientStatusMonitor is using by default for pool.
type noOpClientStatusMonitor struct {
addr string
}

func newNoOpClientStatusMonitor(addr string) noOpClientStatusMonitor {
return noOpClientStatusMonitor{addr: addr}
}

func (n noOpClientStatusMonitor) updateErrorRate(_ error) {
}

func (n noOpClientStatusMonitor) incRequests(_ time.Duration, _ MethodIndex) {
}

func (n noOpClientStatusMonitor) isHealthy() bool {
return true
}

func (n noOpClientStatusMonitor) setUnhealthy() {
}

func (n noOpClientStatusMonitor) setHealthy() {
}

func (n noOpClientStatusMonitor) address() string {
return n.addr
}

func (n noOpClientStatusMonitor) currentErrorRate() uint32 {
return 0
}

func (n noOpClientStatusMonitor) overallErrorRate() uint64 {
return 0
}

func (n noOpClientStatusMonitor) methodsStatus() []statusSnapshot {
return nil
}

0 comments on commit 27b315f

Please sign in to comment.