File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,13 +5,17 @@ import (
55 "sync/atomic"
66)
77
8+ // CircuitState represents the state of a Circuit
89type CircuitState uint32
910
1011const (
11- OpenState CircuitState = 0
12+ // OpenState indicates that the circuit is in the open state, and thus non-functional
13+ OpenState CircuitState = 0
14+ // ClosedState indicates that the circuit is in the closed state, and thus functional
1215 ClosedState CircuitState = 1
1316)
1417
18+ // String is the fmt.Stringer interface implementation
1519func (c CircuitState ) String () string {
1620 if c == OpenState {
1721 return "OPEN"
@@ -31,11 +35,12 @@ func (s CircuitState) toUint32() uint32 {
3135// - OpenState - non functional
3236// - ClosedState - functional
3337//
34- //
38+ // The circuit is intended as a point-in-time indicator of functionality. It has no backoff mechanism, jitter or ramp-up/ramp-down functionality
3539type Circuit struct {
3640 bit uint32
3741}
3842
43+ // NewCircuit creates a new circuit, in the open (non-functional) state
3944func NewCircuit () * Circuit {
4045 return & Circuit {bit : OpenState .toUint32 ()}
4146}
You can’t perform that action at this time.
0 commit comments