blob: e500bec76817da48f550b7c7f591e2fc06116db3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package service
import (
"context"
"errors"
"github.com/RanXom/galleryd/internal/gallery"
)
// Gallery scans the configured roots and builds the gallery.
func (s *galleryService) Gallery(ctx context.Context) ([]gallery.Photo, error) {
select {
case <-ctx.Done():
return nil, ctx.Err()
default:
}
if s.index.byID == nil {
return nil, errors.New("gallery not loaded")
}
return s.index.photos, nil
}
|