diff options
author | Nick White <git@njw.name> | 2021-07-13 11:49:58 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2021-07-13 11:49:58 +0100 |
commit | e22c16ca84163636d674fb0935156f466169e1a3 (patch) | |
tree | 6d29d1ebea4a89dad706df79d40c6a37df2d4b01 /internal/pipeline/get.go | |
parent | 05fbc6c65c8556d89d8b7fdb645f3ef3b273b5e9 (diff) |
internal/pipeline: Reorganise interfaces so that functions only declare what they need
We were using Pipeliner as a catch-all, but it's nicer if the functions
can just state that e.g. they need download functionality, so decompose
things so that that's how we do things now.
Diffstat (limited to 'internal/pipeline/get.go')
-rw-r--r-- | internal/pipeline/get.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/pipeline/get.go b/internal/pipeline/get.go index 0db5cf2..960c8f7 100644 --- a/internal/pipeline/get.go +++ b/internal/pipeline/get.go @@ -12,7 +12,7 @@ import ( "strings" ) -func DownloadBestPages(dir string, name string, conn Pipeliner, pluspngs bool) error { +func DownloadBestPages(dir string, name string, conn Downloader, pluspngs bool) error { key := filepath.Join(name, "best") fn := filepath.Join(dir, "best") err := conn.Download(conn.WIPStorageId(), key, fn) @@ -54,7 +54,7 @@ func DownloadBestPages(dir string, name string, conn Pipeliner, pluspngs bool) e return nil } -func DownloadPdfs(dir string, name string, conn Pipeliner) error { +func DownloadPdfs(dir string, name string, conn Downloader) error { for _, suffix := range []string{".colour.pdf", ".binarised.pdf"} { key := filepath.Join(name, name+suffix) fn := filepath.Join(dir, name+suffix) @@ -66,7 +66,7 @@ func DownloadPdfs(dir string, name string, conn Pipeliner) error { return nil } -func DownloadAnalyses(dir string, name string, conn Pipeliner) error { +func DownloadAnalyses(dir string, name string, conn Downloader) error { for _, a := range []string{"conf", "graph.png"} { key := filepath.Join(name, a) fn := filepath.Join(dir, a) @@ -78,7 +78,7 @@ func DownloadAnalyses(dir string, name string, conn Pipeliner) error { return nil } -func DownloadAll(dir string, name string, conn Pipeliner) error { +func DownloadAll(dir string, name string, conn DownloadLister) error { objs, err := conn.ListObjects(conn.WIPStorageId(), name) if err != nil { return fmt.Errorf("Failed to get list of files for book %s: %v", name, err) |