From 1d8266f2f71de6cc26404ccfb1bbd69c8c7b0130 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Tue, 20 Jun 2023 14:08:36 +0400 Subject: [PATCH] pool: Add noop statistic Signed-off-by: Evgenii Baidakov --- pool/status.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 pool/status.go diff --git a/pool/status.go b/pool/status.go new file mode 100644 index 00000000..2964690a --- /dev/null +++ b/pool/status.go @@ -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 +}