Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GOCBC-652: Add support for circuit breakers for KV
Motivation ---------- In order to help reduce the load on a server component which is already in distress we should implement client side circuit breakers. Changes ------- Add circuit breaker configuration properties and send them down to gocbcore on agent creation. Change-Id: Ib777dd4a64e3cd1554661eb11cf5e7fe1fe4010c Reviewed-on: http://review.couchbase.org/117059 Reviewed-by: Brett Lawson <brett19@gmail.com> Tested-by: Charles Dixon <chvckd@gmail.com>
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package gocb | ||
|
||
import "time" | ||
|
||
// CircuitBreakerCallback is the callback used by the circuit breaker to determine if an error should count toward | ||
// the circuit breaker failure count. | ||
type CircuitBreakerCallback func(error) bool | ||
|
||
// CircuitBreakerConfig are the settings for configuring circuit breakers. | ||
type CircuitBreakerConfig struct { | ||
Disabled bool | ||
VolumeThreshold int64 | ||
ErrorThresholdPercentage float64 | ||
SleepWindow time.Duration | ||
RollingWindow time.Duration | ||
CompletionCallback CircuitBreakerCallback | ||
CanaryTimeout time.Duration | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters