Skip to content

Commit

Permalink
doc(pkg/sshd/circuit.go): add more godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Schlesinger committed Feb 12, 2016
1 parent 2b8fc3b commit 8952b25
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/sshd/circuit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import (
"sync/atomic"
)

// CircuitState represents the state of a Circuit
type CircuitState uint32

const (
OpenState CircuitState = 0
// OpenState indicates that the circuit is in the open state, and thus non-functional
OpenState CircuitState = 0
// ClosedState indicates that the circuit is in the closed state, and thus functional
ClosedState CircuitState = 1
)

// String is the fmt.Stringer interface implementation
func (c CircuitState) String() string {
if c == OpenState {
return "OPEN"
Expand All @@ -31,11 +35,12 @@ func (s CircuitState) toUint32() uint32 {
// - OpenState - non functional
// - ClosedState - functional
//
//
// The circuit is intended as a point-in-time indicator of functionality. It has no backoff mechanism, jitter or ramp-up/ramp-down functionality
type Circuit struct {
bit uint32
}

// NewCircuit creates a new circuit, in the open (non-functional) state
func NewCircuit() *Circuit {
return &Circuit{bit: OpenState.toUint32()}
}
Expand Down

0 comments on commit 8952b25

Please sign in to comment.