aboutsummaryrefslogtreecommitdiff
path: root/pkg/worker
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-29 23:21:56 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-29 23:21:56 +0200
commit1ae70dbd9124675d4a510954619b01edd5f1f6c3 (patch)
treee6db7f5553a00094d048b6a4d03163853a5a4e7c /pkg/worker
parent024da3e546e98cbaeea5f7bc86af12b671996f41 (diff)
downloadlens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.tar.gz
lens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.tar.bz2
lens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.zip
ref: Move away other repositories
Finish moving all repositories to a repository package. This should reduce the amount of packages.
Diffstat (limited to 'pkg/worker')
-rw-r--r--pkg/worker/exif_scanner.go16
-rw-r--r--pkg/worker/file_scanner.go8
2 files changed, 12 insertions, 12 deletions
diff --git a/pkg/worker/exif_scanner.go b/pkg/worker/exif_scanner.go
index 91eed12..97790a0 100644
--- a/pkg/worker/exif_scanner.go
+++ b/pkg/worker/exif_scanner.go
@@ -3,27 +3,27 @@ package worker
import (
"context"
- "git.sr.ht/~gabrielgio/img/pkg/components/media"
"git.sr.ht/~gabrielgio/img/pkg/coroutine"
+ "git.sr.ht/~gabrielgio/img/pkg/database/repository"
"git.sr.ht/~gabrielgio/img/pkg/fileop"
)
type (
EXIFScanner struct {
- repository media.Repository
+ repository repository.MediaRepository
}
)
-var _ BatchProcessor[*media.Media] = &EXIFScanner{}
+var _ BatchProcessor[*repository.Media] = &EXIFScanner{}
-func NewEXIFScanner(repository media.Repository) *EXIFScanner {
+func NewEXIFScanner(repository repository.MediaRepository) *EXIFScanner {
return &EXIFScanner{
repository: repository,
}
}
-func (e *EXIFScanner) Query(ctx context.Context) ([]*media.Media, error) {
- medias, err := e.repository.GetEmptyEXIF(ctx, &media.Pagination{
+func (e *EXIFScanner) Query(ctx context.Context) ([]*repository.Media, error) {
+ medias, err := e.repository.GetEmptyEXIF(ctx, &repository.Pagination{
Page: 0,
Size: 100,
})
@@ -34,8 +34,8 @@ func (e *EXIFScanner) Query(ctx context.Context) ([]*media.Media, error) {
return medias, nil
}
-func (e *EXIFScanner) Process(ctx context.Context, m *media.Media) error {
- exif, err := coroutine.WrapProcess(ctx, func() (*media.MediaEXIF, error) { return fileop.ReadExif(m.Path) })
+func (e *EXIFScanner) Process(ctx context.Context, m *repository.Media) error {
+ exif, err := coroutine.WrapProcess(ctx, func() (*repository.MediaEXIF, error) { return fileop.ReadExif(m.Path) })
if err != nil {
return err
}
diff --git a/pkg/worker/file_scanner.go b/pkg/worker/file_scanner.go
index a51f60b..aa79035 100644
--- a/pkg/worker/file_scanner.go
+++ b/pkg/worker/file_scanner.go
@@ -9,19 +9,19 @@ import (
"path/filepath"
"strings"
- "git.sr.ht/~gabrielgio/img/pkg/components/media"
+ "git.sr.ht/~gabrielgio/img/pkg/database/repository"
)
type (
FileScanner struct {
root string
- repository media.Repository
+ repository repository.MediaRepository
}
)
var _ ChanProcessor[string] = &FileScanner{}
-func NewFileScanner(root string, repository media.Repository) *FileScanner {
+func NewFileScanner(root string, repository repository.MediaRepository) *FileScanner {
return &FileScanner{
root: root,
repository: repository,
@@ -77,7 +77,7 @@ func (f *FileScanner) Process(ctx context.Context, path string) error {
return nil
}
- return f.repository.Create(ctx, &media.CreateMedia{
+ return f.repository.Create(ctx, &repository.CreateMedia{
Name: name,
Path: path,
PathHash: str,