From 7de14623c040558f4047baca870e19d579cec0ca Mon Sep 17 00:00:00 2001 From: Aviral Takkar Date: Mon, 15 Apr 2024 14:56:02 -0700 Subject: [PATCH] refactor: move files to pkg --- cmd/proxy/main.go | 2 +- internal/handlers/files/handler.go | 2 +- internal/handlers/files/handler_test.go | 4 ++-- internal/handlers/root.go | 2 +- internal/handlers/root_test.go | 2 +- {internal => pkg}/files/files.go | 0 {internal => pkg}/files/files_test.go | 0 {internal => pkg}/files/store/file.go | 2 +- {internal => pkg}/files/store/file_test.go | 2 +- {internal => pkg}/files/store/interface.go | 0 {internal => pkg}/files/store/main_test.go | 0 {internal => pkg}/files/store/mockstore.go | 0 {internal => pkg}/files/store/store.go | 2 +- {internal => pkg}/files/store/store_test.go | 2 +- 14 files changed, 10 insertions(+), 10 deletions(-) rename {internal => pkg}/files/files.go (100%) rename {internal => pkg}/files/files_test.go (100%) rename {internal => pkg}/files/store/file.go (98%) rename {internal => pkg}/files/store/file_test.go (99%) rename {internal => pkg}/files/store/interface.go (100%) rename {internal => pkg}/files/store/main_test.go (100%) rename {internal => pkg}/files/store/mockstore.go (100%) rename {internal => pkg}/files/store/store.go (99%) rename {internal => pkg}/files/store/store_test.go (98%) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index 8de1a73..fb1f6cc 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -15,12 +15,12 @@ import ( "time" "github.com/alexflint/go-arg" - "github.com/azure/peerd/internal/files/store" "github.com/azure/peerd/internal/handlers" "github.com/azure/peerd/pkg/containerd" pcontext "github.com/azure/peerd/pkg/context" "github.com/azure/peerd/pkg/discovery/content/provider" "github.com/azure/peerd/pkg/discovery/routing" + "github.com/azure/peerd/pkg/files/store" "github.com/azure/peerd/pkg/k8s" "github.com/azure/peerd/pkg/k8s/events" "github.com/azure/peerd/pkg/metrics" diff --git a/internal/handlers/files/handler.go b/internal/handlers/files/handler.go index b3ce9be..8ad1c4b 100644 --- a/internal/handlers/files/handler.go +++ b/internal/handlers/files/handler.go @@ -8,8 +8,8 @@ import ( "os" "time" - "github.com/azure/peerd/internal/files/store" pcontext "github.com/azure/peerd/pkg/context" + "github.com/azure/peerd/pkg/files/store" "github.com/azure/peerd/pkg/metrics" ) diff --git a/internal/handlers/files/handler_test.go b/internal/handlers/files/handler_test.go index 66b98c7..5f4b4b7 100644 --- a/internal/handlers/files/handler_test.go +++ b/internal/handlers/files/handler_test.go @@ -10,10 +10,10 @@ import ( "net/http/httptest" "testing" - "github.com/azure/peerd/internal/files" - "github.com/azure/peerd/internal/files/store" pcontext "github.com/azure/peerd/pkg/context" "github.com/azure/peerd/pkg/discovery/routing/mocks" + "github.com/azure/peerd/pkg/files" + "github.com/azure/peerd/pkg/files/store" "github.com/azure/peerd/pkg/metrics" "github.com/gin-gonic/gin" ) diff --git a/internal/handlers/root.go b/internal/handlers/root.go index ea72475..c739fab 100644 --- a/internal/handlers/root.go +++ b/internal/handlers/root.go @@ -7,12 +7,12 @@ import ( "net/http" "time" - filesStore "github.com/azure/peerd/internal/files/store" "github.com/azure/peerd/internal/handlers/files" v2 "github.com/azure/peerd/internal/handlers/v2" "github.com/azure/peerd/pkg/containerd" pcontext "github.com/azure/peerd/pkg/context" "github.com/azure/peerd/pkg/discovery/routing" + filesStore "github.com/azure/peerd/pkg/files/store" "github.com/gin-gonic/gin" "github.com/rs/zerolog" ) diff --git a/internal/handlers/root_test.go b/internal/handlers/root_test.go index 1ec7b71..ae7c606 100644 --- a/internal/handlers/root_test.go +++ b/internal/handlers/root_test.go @@ -6,9 +6,9 @@ import ( "net/http/httptest" "testing" - "github.com/azure/peerd/internal/files/store" "github.com/azure/peerd/pkg/containerd" "github.com/azure/peerd/pkg/discovery/routing/mocks" + "github.com/azure/peerd/pkg/files/store" "github.com/azure/peerd/pkg/metrics" "github.com/gin-gonic/gin" ) diff --git a/internal/files/files.go b/pkg/files/files.go similarity index 100% rename from internal/files/files.go rename to pkg/files/files.go diff --git a/internal/files/files_test.go b/pkg/files/files_test.go similarity index 100% rename from internal/files/files_test.go rename to pkg/files/files_test.go diff --git a/internal/files/store/file.go b/pkg/files/store/file.go similarity index 98% rename from internal/files/store/file.go rename to pkg/files/store/file.go index b1e9162..56b0add 100644 --- a/internal/files/store/file.go +++ b/pkg/files/store/file.go @@ -8,8 +8,8 @@ import ( "sync" - "github.com/azure/peerd/internal/files" "github.com/azure/peerd/pkg/discovery/content/reader" + "github.com/azure/peerd/pkg/files" "github.com/azure/peerd/pkg/math" ) diff --git a/internal/files/store/file_test.go b/pkg/files/store/file_test.go similarity index 99% rename from internal/files/store/file_test.go rename to pkg/files/store/file_test.go index 4c6053f..547213f 100644 --- a/internal/files/store/file_test.go +++ b/pkg/files/store/file_test.go @@ -9,10 +9,10 @@ import ( "strings" "testing" - "github.com/azure/peerd/internal/files" "github.com/azure/peerd/pkg/cache" readermocks "github.com/azure/peerd/pkg/discovery/content/reader/mocks" "github.com/azure/peerd/pkg/discovery/routing/mocks" + "github.com/azure/peerd/pkg/files" ) func TestReadAtWithChunkOffset(t *testing.T) { diff --git a/internal/files/store/interface.go b/pkg/files/store/interface.go similarity index 100% rename from internal/files/store/interface.go rename to pkg/files/store/interface.go diff --git a/internal/files/store/main_test.go b/pkg/files/store/main_test.go similarity index 100% rename from internal/files/store/main_test.go rename to pkg/files/store/main_test.go diff --git a/internal/files/store/mockstore.go b/pkg/files/store/mockstore.go similarity index 100% rename from internal/files/store/mockstore.go rename to pkg/files/store/mockstore.go diff --git a/internal/files/store/store.go b/pkg/files/store/store.go similarity index 99% rename from internal/files/store/store.go rename to pkg/files/store/store.go index 420df9d..769684f 100644 --- a/internal/files/store/store.go +++ b/pkg/files/store/store.go @@ -9,11 +9,11 @@ import ( "strings" "time" - "github.com/azure/peerd/internal/files" "github.com/azure/peerd/pkg/cache" pcontext "github.com/azure/peerd/pkg/context" "github.com/azure/peerd/pkg/discovery/content/reader" "github.com/azure/peerd/pkg/discovery/routing" + "github.com/azure/peerd/pkg/files" "github.com/azure/peerd/pkg/metrics" "github.com/azure/peerd/pkg/urlparser" "github.com/opencontainers/go-digest" diff --git a/internal/files/store/store_test.go b/pkg/files/store/store_test.go similarity index 98% rename from internal/files/store/store_test.go rename to pkg/files/store/store_test.go index 8ea0a57..2edd20c 100644 --- a/internal/files/store/store_test.go +++ b/pkg/files/store/store_test.go @@ -9,9 +9,9 @@ import ( "os" "testing" - "github.com/azure/peerd/internal/files" pcontext "github.com/azure/peerd/pkg/context" "github.com/azure/peerd/pkg/discovery/routing/mocks" + "github.com/azure/peerd/pkg/files" "github.com/gin-gonic/gin" "github.com/opencontainers/go-digest" )