Move all IAM storage functionality into iam store type (#13541)

- Ensure all actions accessing storage lock properly.

- Behavior change: policies can be deleted only when they 
  are not associated with any active credentials.
This commit is contained in:
Aditya Manthramurthy
2021-11-01 21:58:07 -07:00
committed by GitHub
parent 26f55472c6
commit caadcc3ed8
10 changed files with 1978 additions and 1653 deletions

View File

@@ -27,22 +27,37 @@ import (
type iamDummyStore struct {
sync.RWMutex
*iamCache
usersSysType UsersSysType
}
func (ids *iamDummyStore) lock() {
func newIAMDummyStore(usersSysType UsersSysType) *iamDummyStore {
return &iamDummyStore{
iamCache: newIamCache(),
usersSysType: usersSysType,
}
}
func (ids *iamDummyStore) rlock() *iamCache {
ids.RLock()
return ids.iamCache
}
func (ids *iamDummyStore) runlock() {
ids.RUnlock()
}
func (ids *iamDummyStore) lock() *iamCache {
ids.Lock()
return ids.iamCache
}
func (ids *iamDummyStore) unlock() {
ids.Unlock()
}
func (ids *iamDummyStore) rlock() {
ids.RLock()
}
func (ids *iamDummyStore) runlock() {
ids.RUnlock()
func (ids *iamDummyStore) getUsersSysType() UsersSysType {
return ids.usersSysType
}
func (ids *iamDummyStore) migrateBackendFormat(context.Context) error {