From e9c2de26a5d56716f46b22517070ad5610e41b04 Mon Sep 17 00:00:00 2001 From: David Christofas Date: Thu, 26 Mar 2020 09:49:37 +0100 Subject: [PATCH] rename package --- pkg/service/v0/service.go | 20 +++++++++---------- pkg/{thumbnails => thumbnail}/encoding.go | 2 +- .../imgsource/imgsource.go | 0 .../imgsource/webdav.go | 0 .../resolution}/resolution.go | 2 +- .../resolution}/resolution_test.go | 2 +- .../resolution}/resolutions.go | 2 +- .../resolution}/resolutions_test.go | 2 +- .../storage/filesystem.go | 0 .../storage/inmemory.go | 0 .../storage/storage.go | 4 ++-- pkg/{thumbnails => thumbnail}/thumbnails.go | 8 ++++---- 12 files changed, 21 insertions(+), 21 deletions(-) rename pkg/{thumbnails => thumbnail}/encoding.go (98%) rename pkg/{thumbnails => thumbnail}/imgsource/imgsource.go (100%) rename pkg/{thumbnails => thumbnail}/imgsource/webdav.go (100%) rename pkg/{thumbnails/resolutions => thumbnail/resolution}/resolution.go (98%) rename pkg/{thumbnails/resolutions => thumbnail/resolution}/resolution_test.go (97%) rename pkg/{thumbnails/resolutions => thumbnail/resolution}/resolutions.go (98%) rename pkg/{thumbnails/resolutions => thumbnail/resolution}/resolutions_test.go (99%) rename pkg/{thumbnails => thumbnail}/storage/filesystem.go (100%) rename pkg/{thumbnails => thumbnail}/storage/inmemory.go (100%) rename pkg/{thumbnails => thumbnail}/storage/storage.go (74%) rename pkg/{thumbnails => thumbnail}/thumbnails.go (91%) diff --git a/pkg/service/v0/service.go b/pkg/service/v0/service.go index ca68414f4..914968c8d 100644 --- a/pkg/service/v0/service.go +++ b/pkg/service/v0/service.go @@ -6,22 +6,22 @@ import ( "github.com/owncloud/ocis-pkg/v2/log" v0proto "github.com/owncloud/ocis-thumbnails/pkg/proto/v0" - "github.com/owncloud/ocis-thumbnails/pkg/thumbnails" - "github.com/owncloud/ocis-thumbnails/pkg/thumbnails/imgsource" - "github.com/owncloud/ocis-thumbnails/pkg/thumbnails/resolutions" - "github.com/owncloud/ocis-thumbnails/pkg/thumbnails/storage" + "github.com/owncloud/ocis-thumbnails/pkg/thumbnail" + "github.com/owncloud/ocis-thumbnails/pkg/thumbnail/imgsource" + "github.com/owncloud/ocis-thumbnails/pkg/thumbnail/resolution" + "github.com/owncloud/ocis-thumbnails/pkg/thumbnail/storage" ) // NewService returns a service implementation for Service. func NewService(opts ...Option) v0proto.ThumbnailServiceHandler { options := newOptions(opts...) logger := options.Logger - resolutions, err := resolutions.New(options.Config.Thumbnail.Resolutions) + resolutions, err := resolution.New(options.Config.Thumbnail.Resolutions) if err != nil { logger.Fatal().Err(err).Msg("resolutions not configured correctly") } svc := Thumbnail{ - manager: thumbnails.NewSimpleManager( + manager: thumbnail.NewSimpleManager( storage.NewFileSystemStorage( options.Config.Thumbnail.FileSystemStorage, logger, @@ -38,21 +38,21 @@ func NewService(opts ...Option) v0proto.ThumbnailServiceHandler { // Thumbnail implements the GRPC handler. type Thumbnail struct { - manager thumbnails.Manager - resolutions resolutions.Resolutions + manager thumbnail.Manager + resolutions resolution.Resolutions source imgsource.Source logger log.Logger } // GetThumbnail retrieves a thumbnail for an image func (g Thumbnail) GetThumbnail(ctx context.Context, req *v0proto.GetRequest, rsp *v0proto.GetResponse) error { - encoder := thumbnails.EncoderForType(req.Filetype.String()) + encoder := thumbnail.EncoderForType(req.Filetype.String()) if encoder == nil { // TODO: better error responses return fmt.Errorf("can't be encoded. filetype %s not supported", req.Filetype.String()) } r := g.resolutions.ClosestMatch(int(req.Width), int(req.Height)) - tr := thumbnails.Request{ + tr := thumbnail.Request{ Resolution: r, ImagePath: req.Filepath, Encoder: encoder, diff --git a/pkg/thumbnails/encoding.go b/pkg/thumbnail/encoding.go similarity index 98% rename from pkg/thumbnails/encoding.go rename to pkg/thumbnail/encoding.go index a4d4647bb..d8d2d358b 100644 --- a/pkg/thumbnails/encoding.go +++ b/pkg/thumbnail/encoding.go @@ -1,4 +1,4 @@ -package thumbnails +package thumbnail import ( "image" diff --git a/pkg/thumbnails/imgsource/imgsource.go b/pkg/thumbnail/imgsource/imgsource.go similarity index 100% rename from pkg/thumbnails/imgsource/imgsource.go rename to pkg/thumbnail/imgsource/imgsource.go diff --git a/pkg/thumbnails/imgsource/webdav.go b/pkg/thumbnail/imgsource/webdav.go similarity index 100% rename from pkg/thumbnails/imgsource/webdav.go rename to pkg/thumbnail/imgsource/webdav.go diff --git a/pkg/thumbnails/resolutions/resolution.go b/pkg/thumbnail/resolution/resolution.go similarity index 98% rename from pkg/thumbnails/resolutions/resolution.go rename to pkg/thumbnail/resolution/resolution.go index 14acab7e3..514fe8574 100644 --- a/pkg/thumbnails/resolutions/resolution.go +++ b/pkg/thumbnail/resolution/resolution.go @@ -1,4 +1,4 @@ -package resolutions +package resolution import ( "fmt" diff --git a/pkg/thumbnails/resolutions/resolution_test.go b/pkg/thumbnail/resolution/resolution_test.go similarity index 97% rename from pkg/thumbnails/resolutions/resolution_test.go rename to pkg/thumbnail/resolution/resolution_test.go index ae407163f..b8c3e6c88 100644 --- a/pkg/thumbnails/resolutions/resolution_test.go +++ b/pkg/thumbnail/resolution/resolution_test.go @@ -1,4 +1,4 @@ -package resolutions +package resolution import "testing" diff --git a/pkg/thumbnails/resolutions/resolutions.go b/pkg/thumbnail/resolution/resolutions.go similarity index 98% rename from pkg/thumbnails/resolutions/resolutions.go rename to pkg/thumbnail/resolution/resolutions.go index c6858aacf..2a83d45e7 100644 --- a/pkg/thumbnails/resolutions/resolutions.go +++ b/pkg/thumbnail/resolution/resolutions.go @@ -1,4 +1,4 @@ -package resolutions +package resolution import ( "fmt" diff --git a/pkg/thumbnails/resolutions/resolutions_test.go b/pkg/thumbnail/resolution/resolutions_test.go similarity index 99% rename from pkg/thumbnails/resolutions/resolutions_test.go rename to pkg/thumbnail/resolution/resolutions_test.go index 9a7583c56..1190cc942 100644 --- a/pkg/thumbnails/resolutions/resolutions_test.go +++ b/pkg/thumbnail/resolution/resolutions_test.go @@ -1,4 +1,4 @@ -package resolutions +package resolution import ( "testing" diff --git a/pkg/thumbnails/storage/filesystem.go b/pkg/thumbnail/storage/filesystem.go similarity index 100% rename from pkg/thumbnails/storage/filesystem.go rename to pkg/thumbnail/storage/filesystem.go diff --git a/pkg/thumbnails/storage/inmemory.go b/pkg/thumbnail/storage/inmemory.go similarity index 100% rename from pkg/thumbnails/storage/inmemory.go rename to pkg/thumbnail/storage/inmemory.go diff --git a/pkg/thumbnails/storage/storage.go b/pkg/thumbnail/storage/storage.go similarity index 74% rename from pkg/thumbnails/storage/storage.go rename to pkg/thumbnail/storage/storage.go index 48953a329..a23a757d3 100644 --- a/pkg/thumbnails/storage/storage.go +++ b/pkg/thumbnail/storage/storage.go @@ -1,12 +1,12 @@ package storage -import "github.com/owncloud/ocis-thumbnails/pkg/thumbnails/resolutions" +import "github.com/owncloud/ocis-thumbnails/pkg/thumbnail/resolution" // Request combines different attributes needed for storage operations. type Request struct { ETag string Types []string - Resolution resolutions.Resolution + Resolution resolution.Resolution } // Storage defines the interface for a thumbnail store. diff --git a/pkg/thumbnails/thumbnails.go b/pkg/thumbnail/thumbnails.go similarity index 91% rename from pkg/thumbnails/thumbnails.go rename to pkg/thumbnail/thumbnails.go index 2a0600795..846cd6013 100644 --- a/pkg/thumbnails/thumbnails.go +++ b/pkg/thumbnail/thumbnails.go @@ -1,4 +1,4 @@ -package thumbnails +package thumbnail import ( "bytes" @@ -6,13 +6,13 @@ import ( "github.com/nfnt/resize" "github.com/owncloud/ocis-pkg/v2/log" - "github.com/owncloud/ocis-thumbnails/pkg/thumbnails/resolutions" - "github.com/owncloud/ocis-thumbnails/pkg/thumbnails/storage" + "github.com/owncloud/ocis-thumbnails/pkg/thumbnail/resolution" + "github.com/owncloud/ocis-thumbnails/pkg/thumbnail/storage" ) // Request bundles information needed to generate a thumbnail for afile type Request struct { - Resolution resolutions.Resolution + Resolution resolution.Resolution ImagePath string Encoder Encoder ETag string