From de4eb0369a9d265f0ddbaefe413edb1cf0baf857 Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Tue, 26 Mar 2019 14:59:58 +0800 Subject: [PATCH] Adjust the file structure of replication package Move the scheduler, execution, hook and flow package into operation Signed-off-by: Wenkai Yin --- src/core/service/notifications/jobs/handler.go | 2 +- src/replication/ng/operation/controller.go | 6 +++--- src/replication/ng/operation/controller_test.go | 2 +- src/replication/ng/{ => operation}/execution/execution.go | 0 .../ng/{ => operation}/execution/execution_test.go | 0 src/replication/ng/{ => operation}/flow/controller.go | 0 src/replication/ng/{ => operation}/flow/controller_test.go | 0 src/replication/ng/{ => operation}/flow/copy.go | 4 ++-- src/replication/ng/{ => operation}/flow/copy_test.go | 0 src/replication/ng/{ => operation}/flow/deletion.go | 4 ++-- src/replication/ng/{ => operation}/flow/deletion_test.go | 0 src/replication/ng/{ => operation}/flow/stage.go | 4 ++-- src/replication/ng/{ => operation}/flow/stage_test.go | 2 +- src/replication/ng/{ => operation}/hook/task.go | 0 src/replication/ng/{ => operation}/hook/task_test.go | 0 src/replication/ng/{ => operation}/scheduler/scheduler.go | 0 .../ng/{ => operation}/scheduler/scheduler_test.go | 0 src/replication/ng/replication.go | 5 +++-- 18 files changed, 15 insertions(+), 14 deletions(-) rename src/replication/ng/{ => operation}/execution/execution.go (100%) rename src/replication/ng/{ => operation}/execution/execution_test.go (100%) rename src/replication/ng/{ => operation}/flow/controller.go (100%) rename src/replication/ng/{ => operation}/flow/controller_test.go (100%) rename src/replication/ng/{ => operation}/flow/copy.go (95%) rename src/replication/ng/{ => operation}/flow/copy_test.go (100%) rename src/replication/ng/{ => operation}/flow/deletion.go (94%) rename src/replication/ng/{ => operation}/flow/deletion_test.go (100%) rename src/replication/ng/{ => operation}/flow/stage.go (98%) rename src/replication/ng/{ => operation}/flow/stage_test.go (99%) rename src/replication/ng/{ => operation}/hook/task.go (100%) rename src/replication/ng/{ => operation}/hook/task_test.go (100%) rename src/replication/ng/{ => operation}/scheduler/scheduler.go (100%) rename src/replication/ng/{ => operation}/scheduler/scheduler_test.go (100%) diff --git a/src/core/service/notifications/jobs/handler.go b/src/core/service/notifications/jobs/handler.go index d5fe7be58..0723eaf0c 100644 --- a/src/core/service/notifications/jobs/handler.go +++ b/src/core/service/notifications/jobs/handler.go @@ -24,7 +24,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/api" "github.com/goharbor/harbor/src/replication/ng" - "github.com/goharbor/harbor/src/replication/ng/hook" + "github.com/goharbor/harbor/src/replication/ng/operation/hook" ) var statusMap = map[string]string{ diff --git a/src/replication/ng/operation/controller.go b/src/replication/ng/operation/controller.go index 4b60380e6..a1b5cb2cb 100644 --- a/src/replication/ng/operation/controller.go +++ b/src/replication/ng/operation/controller.go @@ -20,11 +20,11 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/replication/ng/dao/models" - "github.com/goharbor/harbor/src/replication/ng/execution" - "github.com/goharbor/harbor/src/replication/ng/flow" "github.com/goharbor/harbor/src/replication/ng/model" + "github.com/goharbor/harbor/src/replication/ng/operation/execution" + "github.com/goharbor/harbor/src/replication/ng/operation/flow" + "github.com/goharbor/harbor/src/replication/ng/operation/scheduler" "github.com/goharbor/harbor/src/replication/ng/registry" - "github.com/goharbor/harbor/src/replication/ng/scheduler" ) // Controller handles the replication-related operations: start, diff --git a/src/replication/ng/operation/controller_test.go b/src/replication/ng/operation/controller_test.go index 5ada7fd66..09fc37c86 100644 --- a/src/replication/ng/operation/controller_test.go +++ b/src/replication/ng/operation/controller_test.go @@ -20,7 +20,7 @@ import ( "github.com/goharbor/harbor/src/replication/ng/config" "github.com/goharbor/harbor/src/replication/ng/dao/models" "github.com/goharbor/harbor/src/replication/ng/model" - "github.com/goharbor/harbor/src/replication/ng/scheduler" + "github.com/goharbor/harbor/src/replication/ng/operation/scheduler" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/src/replication/ng/execution/execution.go b/src/replication/ng/operation/execution/execution.go similarity index 100% rename from src/replication/ng/execution/execution.go rename to src/replication/ng/operation/execution/execution.go diff --git a/src/replication/ng/execution/execution_test.go b/src/replication/ng/operation/execution/execution_test.go similarity index 100% rename from src/replication/ng/execution/execution_test.go rename to src/replication/ng/operation/execution/execution_test.go diff --git a/src/replication/ng/flow/controller.go b/src/replication/ng/operation/flow/controller.go similarity index 100% rename from src/replication/ng/flow/controller.go rename to src/replication/ng/operation/flow/controller.go diff --git a/src/replication/ng/flow/controller_test.go b/src/replication/ng/operation/flow/controller_test.go similarity index 100% rename from src/replication/ng/flow/controller_test.go rename to src/replication/ng/operation/flow/controller_test.go diff --git a/src/replication/ng/flow/copy.go b/src/replication/ng/operation/flow/copy.go similarity index 95% rename from src/replication/ng/flow/copy.go rename to src/replication/ng/operation/flow/copy.go index 1b9fab739..2428b7438 100644 --- a/src/replication/ng/flow/copy.go +++ b/src/replication/ng/operation/flow/copy.go @@ -19,10 +19,10 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/replication/ng/dao/models" - "github.com/goharbor/harbor/src/replication/ng/execution" "github.com/goharbor/harbor/src/replication/ng/model" + "github.com/goharbor/harbor/src/replication/ng/operation/execution" + "github.com/goharbor/harbor/src/replication/ng/operation/scheduler" "github.com/goharbor/harbor/src/replication/ng/registry" - "github.com/goharbor/harbor/src/replication/ng/scheduler" ) type copyFlow struct { diff --git a/src/replication/ng/flow/copy_test.go b/src/replication/ng/operation/flow/copy_test.go similarity index 100% rename from src/replication/ng/flow/copy_test.go rename to src/replication/ng/operation/flow/copy_test.go diff --git a/src/replication/ng/flow/deletion.go b/src/replication/ng/operation/flow/deletion.go similarity index 94% rename from src/replication/ng/flow/deletion.go rename to src/replication/ng/operation/flow/deletion.go index 04751b10f..99ce2c03d 100644 --- a/src/replication/ng/flow/deletion.go +++ b/src/replication/ng/operation/flow/deletion.go @@ -16,10 +16,10 @@ package flow import ( "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/replication/ng/execution" "github.com/goharbor/harbor/src/replication/ng/model" + "github.com/goharbor/harbor/src/replication/ng/operation/execution" + "github.com/goharbor/harbor/src/replication/ng/operation/scheduler" "github.com/goharbor/harbor/src/replication/ng/registry" - "github.com/goharbor/harbor/src/replication/ng/scheduler" ) type deletionFlow struct { diff --git a/src/replication/ng/flow/deletion_test.go b/src/replication/ng/operation/flow/deletion_test.go similarity index 100% rename from src/replication/ng/flow/deletion_test.go rename to src/replication/ng/operation/flow/deletion_test.go diff --git a/src/replication/ng/flow/stage.go b/src/replication/ng/operation/flow/stage.go similarity index 98% rename from src/replication/ng/flow/stage.go rename to src/replication/ng/operation/flow/stage.go index 154a62f3c..c05393f58 100644 --- a/src/replication/ng/flow/stage.go +++ b/src/replication/ng/operation/flow/stage.go @@ -24,10 +24,10 @@ import ( adp "github.com/goharbor/harbor/src/replication/ng/adapter" "github.com/goharbor/harbor/src/replication/ng/config" "github.com/goharbor/harbor/src/replication/ng/dao/models" - "github.com/goharbor/harbor/src/replication/ng/execution" "github.com/goharbor/harbor/src/replication/ng/model" + "github.com/goharbor/harbor/src/replication/ng/operation/execution" + "github.com/goharbor/harbor/src/replication/ng/operation/scheduler" "github.com/goharbor/harbor/src/replication/ng/registry" - "github.com/goharbor/harbor/src/replication/ng/scheduler" "github.com/goharbor/harbor/src/replication/ng/util" ) diff --git a/src/replication/ng/flow/stage_test.go b/src/replication/ng/operation/flow/stage_test.go similarity index 99% rename from src/replication/ng/flow/stage_test.go rename to src/replication/ng/operation/flow/stage_test.go index 47ada8921..41f03c6e1 100644 --- a/src/replication/ng/flow/stage_test.go +++ b/src/replication/ng/operation/flow/stage_test.go @@ -25,7 +25,7 @@ import ( "github.com/goharbor/harbor/src/replication/ng/config" "github.com/goharbor/harbor/src/replication/ng/dao/models" "github.com/goharbor/harbor/src/replication/ng/model" - "github.com/goharbor/harbor/src/replication/ng/scheduler" + "github.com/goharbor/harbor/src/replication/ng/operation/scheduler" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/src/replication/ng/hook/task.go b/src/replication/ng/operation/hook/task.go similarity index 100% rename from src/replication/ng/hook/task.go rename to src/replication/ng/operation/hook/task.go diff --git a/src/replication/ng/hook/task_test.go b/src/replication/ng/operation/hook/task_test.go similarity index 100% rename from src/replication/ng/hook/task_test.go rename to src/replication/ng/operation/hook/task_test.go diff --git a/src/replication/ng/scheduler/scheduler.go b/src/replication/ng/operation/scheduler/scheduler.go similarity index 100% rename from src/replication/ng/scheduler/scheduler.go rename to src/replication/ng/operation/scheduler/scheduler.go diff --git a/src/replication/ng/scheduler/scheduler_test.go b/src/replication/ng/operation/scheduler/scheduler_test.go similarity index 100% rename from src/replication/ng/scheduler/scheduler_test.go rename to src/replication/ng/operation/scheduler/scheduler_test.go diff --git a/src/replication/ng/replication.go b/src/replication/ng/replication.go index a1055a5f7..0599fe93c 100644 --- a/src/replication/ng/replication.go +++ b/src/replication/ng/replication.go @@ -20,11 +20,12 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" cfg "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/replication/ng/config" - "github.com/goharbor/harbor/src/replication/ng/execution" "github.com/goharbor/harbor/src/replication/ng/operation" + "github.com/goharbor/harbor/src/replication/ng/operation/execution" + "github.com/goharbor/harbor/src/replication/ng/operation/scheduler" "github.com/goharbor/harbor/src/replication/ng/policy" "github.com/goharbor/harbor/src/replication/ng/registry" - "github.com/goharbor/harbor/src/replication/ng/scheduler" + // register the Harbor adapter _ "github.com/goharbor/harbor/src/replication/ng/adapter/harbor" )