Files
Mustansir a633174c3b [INS-206] Store Gitlab Project ID in secret location metadata (#4601)
* add wrapper reporter to append project details to chunk metadata

* use cache to store project details

* revert unnecessary change

* delete from cache when done with scanning in ChunkUnit, implement PR suggestions

* query project details using repo instead of having it in source unit

* revert removal of build tag

* Incorporated PR comments
2025-12-22 10:45:42 +05:00

30 lines
431 B
Go

package gitlab
import "sync"
type project struct {
id int
name string
owner string
}
type repoToProjectCache struct {
sync.RWMutex
cache map[string]*project
}
func (r *repoToProjectCache) get(repo string) (*project, bool) {
r.RLock()
defer r.RUnlock()
proj, ok := r.cache[repo]
return proj, ok
}
func (r *repoToProjectCache) set(repo string, proj *project) {
r.Lock()
defer r.Unlock()
r.cache[repo] = proj
}