GetState returns the current state (lock-free read). This is the hot path - optimized for zero allocations and minimal overhead. Note: Zero allocations applies to state reads; converting the returned state to a string (via String()) may allocate if the state is unknown.
()
| 140 | // Note: Zero allocations applies to state reads; converting the returned state to a string |
| 141 | // (via String()) may allocate if the state is unknown. |
| 142 | func (sm *ConnStateMachine) GetState() ConnState { |
| 143 | return ConnState(sm.state.Load()) |
| 144 | } |
| 145 | |
| 146 | // TryTransitionFast is an optimized version for the hot path (Get/Put operations). |
| 147 | // It only handles simple state transitions without waiter notification. |