MCPcopy Index your code
hub / github.com/coder/coder / State

Method State

aibridge/keypool/keypool.go:128–140  ·  view source on GitHub ↗

State returns the current state of the key, derived from its permanent flag and cooldown deadline.

()

Source from the content-addressed store, hash-verified

126// State returns the current state of the key, derived from its
127// permanent flag and cooldown deadline.
128func (k *Key) State() KeyState {
129 k.mu.RLock()
130 defer k.mu.RUnlock()
131
132 if k.permanent {
133 return KeyStatePermanent
134 }
135 // Cooldown still active: key is temporarily unavailable.
136 if k.clock.Now().Before(k.cooldownUntil) {
137 return KeyStateTemporary
138 }
139 return KeyStateValid
140}
141
142// stateAndCooldown returns the key's state and remaining
143// cooldown as a single atomic snapshot.

Callers 11

TestMarkKeyOnErrorFunction · 0.45
TestMarkKeyOnErrorFunction · 0.45
TestMarkKeyOnErrorFunction · 0.45
PoolStateMethod · 0.45
NextMethod · 0.45
TestMarkKeyOnStatusFunction · 0.45
TestNewKeyPoolFunction · 0.45
TestStateFunction · 0.45
TestMarkTemporaryFunction · 0.45
TestMarkPermanentFunction · 0.45
TestKeyConcurrentFunction · 0.45

Calls

no outgoing calls

Tested by 9

TestMarkKeyOnErrorFunction · 0.36
TestMarkKeyOnErrorFunction · 0.36
TestMarkKeyOnErrorFunction · 0.36
TestMarkKeyOnStatusFunction · 0.36
TestNewKeyPoolFunction · 0.36
TestStateFunction · 0.36
TestMarkTemporaryFunction · 0.36
TestMarkPermanentFunction · 0.36
TestKeyConcurrentFunction · 0.36