mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-01 18:33:19 +02:00
atomicutil: use atomicutil.Value wherever possible (#3517)
* atomicutil: use atomicutil.Value wherever possible * fix test * fix mux router
This commit is contained in:
parent
5c14d2c994
commit
0ac7e45a21
23 changed files with 121 additions and 215 deletions
|
@ -3,7 +3,6 @@ package authorize
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
|
||||
googlegrpc "google.golang.org/grpc"
|
||||
|
||||
|
@ -79,21 +78,3 @@ func newAuthorizeStateFromConfig(cfg *config.Config, store *store.Store) (*autho
|
|||
|
||||
return state, nil
|
||||
}
|
||||
|
||||
type atomicAuthorizeState struct {
|
||||
value atomic.Value
|
||||
}
|
||||
|
||||
func newAtomicAuthorizeState(state *authorizeState) *atomicAuthorizeState {
|
||||
aas := new(atomicAuthorizeState)
|
||||
aas.Store(state)
|
||||
return aas
|
||||
}
|
||||
|
||||
func (aas *atomicAuthorizeState) Load() *authorizeState {
|
||||
return aas.value.Load().(*authorizeState)
|
||||
}
|
||||
|
||||
func (aas *atomicAuthorizeState) Store(state *authorizeState) {
|
||||
aas.value.Store(state)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue