showing more info on the "/all" endpoint

This commit is contained in:
Aaron Schlesinger
2018-02-25 16:21:49 -08:00
parent cf2b030d02
commit f58c06b030
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -4,5 +4,5 @@ package storage
type Lister interface {
// must return NotFoundErr if baseURL / module isn't found
List(baseURL, module string) ([]string, error)
All() ([]*RevInfo, error)
All() (map[string][]*RevInfo, error)
}
+4 -4
View File
@@ -21,13 +21,13 @@ func (l *Lister) List(basePath, module string) ([]string, error) {
return ret, nil
}
func (l *Lister) All() ([]*storage.RevInfo, error) {
ret := []*storage.RevInfo{}
func (l *Lister) All() (map[string][]*storage.RevInfo, error) {
ret := map[string][]*storage.RevInfo{}
entries.RLock()
defer entries.RUnlock()
for _, versions := range entries.versions {
for name, versions := range entries.versions {
for _, version := range versions {
ret = append(ret, &version.RevInfo)
ret[name] = append(ret[name], &version.RevInfo)
}
}
return ret, nil