add endpoint for listing repos while serving in api mode and add more metrics

This commit is contained in:
Markus Muellner
2023-03-20 17:14:45 +01:00
committed by Benj Fassbind
parent 0fdba29d51
commit 9c6f896666
7 changed files with 189 additions and 12 deletions
+23
View File
@@ -423,6 +423,29 @@ func (p *PublishedRepo) Components() []string {
return result
}
// Components returns sorted list of published repo source names
func (p *PublishedRepo) SourceNames() []string {
var sources = []string{}
for _, component := range p.Components() {
var source string
item := p.sourceItems[component]
if item.snapshot != nil {
source = item.snapshot.Name
} else if item.localRepo != nil {
source = item.localRepo.Name
} else {
panic("no snapshot/localRepo")
}
sources = append(sources, fmt.Sprintf("%s:%s", source, component))
}
sort.Strings(sources)
return sources
}
// UpdateLocalRepo updates content from local repo in component
func (p *PublishedRepo) UpdateLocalRepo(component string) {
if p.SourceKind != SourceLocalRepo {