You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Circuit is a concurrency-safe data structure that can take one of two states at any point in time:
//
// - OpenState - non functional
// - ClosedState - functional
//
//
typeCircuitstruct {
bituint32
}
funcNewCircuit() *Circuit {
return&Circuit{bit: OpenState.toUint32()}
}
// State returns the current state of the circuit. Note that concurrent modifications may be happening, so the state may be different than what's returned
func (c*Circuit) State() CircuitState {
returnCircuitState(atomic.LoadUint32(&c.bit))
}
// Close closes the circuit if it wasn't already closed. Returns true if it had to be closed, false if it was already closed