feat(policy): add Google Drive Oauth client

This commit is contained in:
Aaron Liu
2023-05-24 14:39:54 +08:00
parent 4c18e5acd1
commit 37926e3133
22 changed files with 524 additions and 79 deletions

View File

@@ -0,0 +1,25 @@
package oauth
import "sync"
// CredentialLock 针对存储策略凭证的锁
type CredentialLock interface {
Lock(uint)
Unlock(uint)
}
var GlobalMutex = mutexMap{}
type mutexMap struct {
locks sync.Map
}
func (m *mutexMap) Lock(id uint) {
lock, _ := m.locks.LoadOrStore(id, &sync.Mutex{})
lock.(*sync.Mutex).Lock()
}
func (m *mutexMap) Unlock(id uint) {
lock, _ := m.locks.LoadOrStore(id, &sync.Mutex{})
lock.(*sync.Mutex).Unlock()
}