Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorTracker ¶
type ErrorTracker interface { // IncrReadErr increases read errors by 1 IncrReadErr(nodeStorage string) // IncrWriteErr increases write errors by 1 IncrWriteErr(nodeStorage string) // ReadThresholdReached returns whether or not the read threshold was reached ReadThresholdReached(nodeStorage string) bool // WriteThresholdReached returns whether or not the read threshold was reached WriteThresholdReached(nodeStorage string) bool }
ErrorTracker allows tracking how many read/write errors have occurred, and whether or not it has exceeded a configured threshold in a configured time window
type HealthClient ¶
type HealthClient struct { grpc_health_v1.HealthClient // contains filtered or unexported fields }
HealthClient wraps a gRPC HealthClient and circuit breaks its health checks if the error threshold has been reached.
func NewHealthClient ¶
func NewHealthClient(client grpc_health_v1.HealthClient, storage string, tracker ErrorTracker) HealthClient
NewHealthClient returns the HealthClient wrapped with error threshold circuit breaker.
func (HealthClient) Check ¶
func (hc HealthClient) Check(ctx context.Context, req *grpc_health_v1.HealthCheckRequest, opts ...grpc.CallOption) (*grpc_health_v1.HealthCheckResponse, error)
Check circuit breaks the health check if write or read error thresholds have been reached. If not, it performs the health check.
Click to show internal directories.
Click to hide internal directories.