File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 11module github.com/redis/go-redis/v9
22
3- go 1.18
3+ go 1.19
44
55require (
66 github.com/bsm/ginkgo/v2 v2.12.0
Original file line number Diff line number Diff line change @@ -41,6 +41,20 @@ const (
4141 StateClosed
4242)
4343
44+ // Predefined state transition slices to avoid allocations on hot paths.
45+ // These are used by TryTransition and AwaitAndTransition to specify valid source states.
46+ var (
47+ // Common single-state transitions
48+ validFromIdle = []ConnState {StateIdle }
49+ validFromInUse = []ConnState {StateInUse }
50+
51+ // Common multi-state transitions
52+ validFromCreatedOrIdle = []ConnState {StateCreated , StateIdle }
53+ validFromInitializingOrUnusable = []ConnState {StateInitializing , StateUnusable }
54+ validFromCreatedIdleOrUnusable = []ConnState {StateCreated , StateIdle , StateUnusable }
55+ validFromInUseIdleOrCreated = []ConnState {StateInUse , StateIdle , StateCreated }
56+ )
57+
4458// String returns a human-readable string representation of the state.
4559func (s ConnState ) String () string {
4660 switch s {
You can’t perform that action at this time.
0 commit comments