Remove "ng" from source code

Remove "ng" from source code

Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
Wenkai Yin 2019-04-12 22:38:56 +08:00
parent d4b6eede98
commit 1d16e18dff
107 changed files with 291 additions and 383 deletions

View File

@ -19,8 +19,8 @@ import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
rep_dao "github.com/goharbor/harbor/src/replication/ng/dao"
rep_models "github.com/goharbor/harbor/src/replication/ng/dao/models"
rep_dao "github.com/goharbor/harbor/src/replication/dao"
rep_models "github.com/goharbor/harbor/src/replication/dao/models"
)
const (

View File

@ -39,7 +39,7 @@ import (
_ "github.com/goharbor/harbor/src/core/auth/ldap"
"github.com/goharbor/harbor/src/core/config"
"github.com/goharbor/harbor/src/core/filter"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/tests/apitests/apilib"
)

View File

@ -9,12 +9,12 @@ import (
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/event"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/policy"
"github.com/goharbor/harbor/src/replication/ng/registry"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/event"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/policy"
"github.com/goharbor/harbor/src/replication/registry"
)
// RegistryAPI handles requests to /api/registries/{}. It manages registries integrated to Harbor.
@ -37,8 +37,8 @@ func (t *RegistryAPI) Prepare() {
return
}
t.manager = ng.RegistryMgr
t.policyCtl = ng.PolicyCtl
t.manager = replication.RegistryMgr
t.policyCtl = replication.PolicyCtl
}
// Ping checks health status of a registry

View File

@ -4,13 +4,12 @@ import (
"net/http"
"testing"
"github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/dao"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/core/api/models"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication/ng/dao"
"github.com/goharbor/harbor/src/replication/ng/model"
)
var (
@ -36,7 +35,7 @@ type RegistrySuite struct {
func (suite *RegistrySuite) SetupSuite() {
assert := assert.New(suite.T())
assert.Nil(ng.Init(make(chan struct{})))
assert.Nil(replication.Init(make(chan struct{})))
suite.testAPI = newHarborAPI()
code, err := suite.testAPI.RegistryCreate(*admin, testRegistry)

View File

@ -15,8 +15,8 @@
package api
import (
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
)
// ReplicationAdapterAPI handles the replication adapter requests

View File

@ -18,10 +18,9 @@ import (
"net/http"
"testing"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/require"
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
)
func fakedFactory(*model.Registry) (adapter.Adapter, error) {

View File

@ -19,10 +19,10 @@ import (
"net/http"
"strconv"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/event"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/event"
"github.com/goharbor/harbor/src/replication/model"
)
// ReplicationOperationAPI handles the replication operation requests
@ -91,7 +91,7 @@ func (r *ReplicationOperationAPI) ListExecutions() {
query.PolicyID = policyID
}
query.Page, query.Size = r.GetPaginationParams()
total, executions, err := ng.OperationCtl.ListExecutions(query)
total, executions, err := replication.OperationCtl.ListExecutions(query)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to list executions: %v", err))
return
@ -104,7 +104,7 @@ func (r *ReplicationOperationAPI) ListExecutions() {
func (r *ReplicationOperationAPI) CreateExecution() {
execution := &models.Execution{}
r.DecodeJSONReq(execution)
policy, err := ng.PolicyCtl.Get(execution.PolicyID)
policy, err := replication.PolicyCtl.Get(execution.PolicyID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get policy %d: %v", execution.PolicyID, err))
return
@ -117,13 +117,13 @@ func (r *ReplicationOperationAPI) CreateExecution() {
r.HandleBadRequest(fmt.Sprintf("the policy %d is disabled", execution.PolicyID))
return
}
if err = event.PopulateRegistries(ng.RegistryMgr, policy); err != nil {
if err = event.PopulateRegistries(replication.RegistryMgr, policy); err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to populate registries for policy %d: %v", execution.PolicyID, err))
return
}
trigger := r.GetString("trigger", string(model.TriggerTypeManual))
executionID, err := ng.OperationCtl.StartReplication(policy, nil, model.TriggerType(trigger))
executionID, err := replication.OperationCtl.StartReplication(policy, nil, model.TriggerType(trigger))
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to start replication for policy %d: %v", execution.PolicyID, err))
return
@ -138,7 +138,7 @@ func (r *ReplicationOperationAPI) GetExecution() {
r.HandleBadRequest("invalid execution ID")
return
}
execution, err := ng.OperationCtl.GetExecution(executionID)
execution, err := replication.OperationCtl.GetExecution(executionID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get execution %d: %v", executionID, err))
return
@ -158,7 +158,7 @@ func (r *ReplicationOperationAPI) StopExecution() {
r.HandleBadRequest("invalid execution ID")
return
}
execution, err := ng.OperationCtl.GetExecution(executionID)
execution, err := replication.OperationCtl.GetExecution(executionID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get execution %d: %v", executionID, err))
return
@ -169,7 +169,7 @@ func (r *ReplicationOperationAPI) StopExecution() {
return
}
if err := ng.OperationCtl.StopReplication(executionID); err != nil {
if err := replication.OperationCtl.StopReplication(executionID); err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to stop execution %d: %v", executionID, err))
return
}
@ -183,7 +183,7 @@ func (r *ReplicationOperationAPI) ListTasks() {
return
}
execution, err := ng.OperationCtl.GetExecution(executionID)
execution, err := replication.OperationCtl.GetExecution(executionID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get execution %d: %v", executionID, err))
return
@ -202,7 +202,7 @@ func (r *ReplicationOperationAPI) ListTasks() {
query.Statuses = []string{status}
}
query.Page, query.Size = r.GetPaginationParams()
total, tasks, err := ng.OperationCtl.ListTasks(query)
total, tasks, err := replication.OperationCtl.ListTasks(query)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to list tasks: %v", err))
return
@ -219,7 +219,7 @@ func (r *ReplicationOperationAPI) GetTaskLog() {
return
}
execution, err := ng.OperationCtl.GetExecution(executionID)
execution, err := replication.OperationCtl.GetExecution(executionID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get execution %d: %v", executionID, err))
return
@ -234,7 +234,7 @@ func (r *ReplicationOperationAPI) GetTaskLog() {
r.HandleBadRequest("invalid task ID")
return
}
task, err := ng.OperationCtl.GetTask(taskID)
task, err := replication.OperationCtl.GetTask(taskID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get task %d: %v", taskID, err))
return
@ -244,7 +244,7 @@ func (r *ReplicationOperationAPI) GetTaskLog() {
return
}
logBytes, err := ng.OperationCtl.GetTaskLog(taskID)
logBytes, err := replication.OperationCtl.GetTaskLog(taskID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get log of task %d: %v", taskID, err))
return

View File

@ -18,9 +18,10 @@ import (
"net/http"
"testing"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
)
type fakedOperationController struct{}
@ -119,11 +120,11 @@ func (f *fakedPolicyManager) Remove(int64) error {
}
func TestListExecutions(t *testing.T) {
operationCtl := ng.OperationCtl
operationCtl := replication.OperationCtl
defer func() {
ng.OperationCtl = operationCtl
replication.OperationCtl = operationCtl
}()
ng.OperationCtl = &fakedOperationController{}
replication.OperationCtl = &fakedOperationController{}
cases := []*codeCheckingCase{
// 401
@ -158,17 +159,17 @@ func TestListExecutions(t *testing.T) {
}
func TestCreateExecution(t *testing.T) {
operationCtl := ng.OperationCtl
policyMgr := ng.PolicyCtl
registryMgr := ng.RegistryMgr
operationCtl := replication.OperationCtl
policyMgr := replication.PolicyCtl
registryMgr := replication.RegistryMgr
defer func() {
ng.OperationCtl = operationCtl
ng.PolicyCtl = policyMgr
ng.RegistryMgr = registryMgr
replication.OperationCtl = operationCtl
replication.PolicyCtl = policyMgr
replication.RegistryMgr = registryMgr
}()
ng.OperationCtl = &fakedOperationController{}
ng.PolicyCtl = &fakedPolicyManager{}
ng.RegistryMgr = &fakedRegistryManager{}
replication.OperationCtl = &fakedOperationController{}
replication.PolicyCtl = &fakedPolicyManager{}
replication.RegistryMgr = &fakedRegistryManager{}
cases := []*codeCheckingCase{
// 401
@ -230,11 +231,11 @@ func TestCreateExecution(t *testing.T) {
}
func TestGetExecution(t *testing.T) {
operationCtl := ng.OperationCtl
operationCtl := replication.OperationCtl
defer func() {
ng.OperationCtl = operationCtl
replication.OperationCtl = operationCtl
}()
ng.OperationCtl = &fakedOperationController{}
replication.OperationCtl = &fakedOperationController{}
cases := []*codeCheckingCase{
// 401
@ -277,11 +278,11 @@ func TestGetExecution(t *testing.T) {
runCodeCheckingCases(t, cases...)
}
func TestStopExecution(t *testing.T) {
operationCtl := ng.OperationCtl
operationCtl := replication.OperationCtl
defer func() {
ng.OperationCtl = operationCtl
replication.OperationCtl = operationCtl
}()
ng.OperationCtl = &fakedOperationController{}
replication.OperationCtl = &fakedOperationController{}
cases := []*codeCheckingCase{
// 401
@ -325,11 +326,11 @@ func TestStopExecution(t *testing.T) {
}
func TestListTasks(t *testing.T) {
operationCtl := ng.OperationCtl
operationCtl := replication.OperationCtl
defer func() {
ng.OperationCtl = operationCtl
replication.OperationCtl = operationCtl
}()
ng.OperationCtl = &fakedOperationController{}
replication.OperationCtl = &fakedOperationController{}
cases := []*codeCheckingCase{
// 401
@ -373,11 +374,11 @@ func TestListTasks(t *testing.T) {
}
func TestGetTaskLog(t *testing.T) {
operationCtl := ng.OperationCtl
operationCtl := replication.OperationCtl
defer func() {
ng.OperationCtl = operationCtl
replication.OperationCtl = operationCtl
}()
ng.OperationCtl = &fakedOperationController{}
replication.OperationCtl = &fakedOperationController{}
cases := []*codeCheckingCase{
// 401

View File

@ -19,13 +19,11 @@ import (
"net/http"
"strconv"
"github.com/goharbor/harbor/src/replication/ng/registry"
"github.com/goharbor/harbor/src/replication/ng/event"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/event"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/registry"
)
// TODO rename the file to "replication.go"
@ -56,13 +54,13 @@ func (r *ReplicationPolicyAPI) List() {
}
query.Page, query.Size = r.GetPaginationParams()
total, policies, err := ng.PolicyCtl.List(query)
total, policies, err := replication.PolicyCtl.List(query)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to list policies: %v", err))
return
}
for _, policy := range policies {
if err = populateRegistries(ng.RegistryMgr, policy); err != nil {
if err = populateRegistries(replication.RegistryMgr, policy); err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to populate registries for policy %d: %v", policy.ID, err))
return
}
@ -83,7 +81,7 @@ func (r *ReplicationPolicyAPI) Create() {
return
}
id, err := ng.PolicyCtl.Create(policy)
id, err := replication.PolicyCtl.Create(policy)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to create the policy: %v", err))
return
@ -93,7 +91,7 @@ func (r *ReplicationPolicyAPI) Create() {
// make sure the policy name doesn't exist
func (r *ReplicationPolicyAPI) validateName(policy *model.Policy) bool {
p, err := ng.PolicyCtl.GetByName(policy.Name)
p, err := replication.PolicyCtl.GetByName(policy.Name)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get policy %s: %v", policy.Name, err))
return false
@ -113,7 +111,7 @@ func (r *ReplicationPolicyAPI) validateRegistry(policy *model.Policy) bool {
} else {
registryID = policy.DestRegistry.ID
}
registry, err := ng.RegistryMgr.Get(registryID)
registry, err := replication.RegistryMgr.Get(registryID)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get registry %d: %v", registryID, err))
return false
@ -133,7 +131,7 @@ func (r *ReplicationPolicyAPI) Get() {
return
}
policy, err := ng.PolicyCtl.Get(id)
policy, err := replication.PolicyCtl.Get(id)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get the policy %d: %v", id, err))
return
@ -142,7 +140,7 @@ func (r *ReplicationPolicyAPI) Get() {
r.HandleNotFound(fmt.Sprintf("policy %d not found", id))
return
}
if err = populateRegistries(ng.RegistryMgr, policy); err != nil {
if err = populateRegistries(replication.RegistryMgr, policy); err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to populate registries for policy %d: %v", policy.ID, err))
return
}
@ -158,7 +156,7 @@ func (r *ReplicationPolicyAPI) Update() {
return
}
originalPolicy, err := ng.PolicyCtl.Get(id)
originalPolicy, err := replication.PolicyCtl.Get(id)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get the policy %d: %v", id, err))
return
@ -180,7 +178,7 @@ func (r *ReplicationPolicyAPI) Update() {
}
policy.ID = id
if err := ng.PolicyCtl.Update(policy); err != nil {
if err := replication.PolicyCtl.Update(policy); err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to update the policy %d: %v", id, err))
return
}
@ -194,7 +192,7 @@ func (r *ReplicationPolicyAPI) Delete() {
return
}
policy, err := ng.PolicyCtl.Get(id)
policy, err := replication.PolicyCtl.Get(id)
if err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to get the policy %d: %v", id, err))
return
@ -204,7 +202,7 @@ func (r *ReplicationPolicyAPI) Delete() {
return
}
_, executions, err := ng.OperationCtl.ListExecutions(&models.ExecutionQuery{
_, executions, err := replication.OperationCtl.ListExecutions(&models.ExecutionQuery{
PolicyID: id,
})
if err != nil {
@ -219,7 +217,7 @@ func (r *ReplicationPolicyAPI) Delete() {
}
}
if err := ng.PolicyCtl.Remove(id); err != nil {
if err := replication.PolicyCtl.Remove(id); err != nil {
r.HandleInternalServerError(fmt.Sprintf("failed to delete the policy %d: %v", id, err))
return
}

View File

@ -18,9 +18,8 @@ import (
"net/http"
"testing"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/model"
)
// TODO rename the file to "replication.go"
@ -55,11 +54,11 @@ func (f *fakedRegistryManager) HealthCheck() error {
}
func TestReplicationPolicyAPIList(t *testing.T) {
policyMgr := ng.PolicyCtl
policyMgr := replication.PolicyCtl
defer func() {
ng.PolicyCtl = policyMgr
replication.PolicyCtl = policyMgr
}()
ng.PolicyCtl = &fakedPolicyManager{}
replication.PolicyCtl = &fakedPolicyManager{}
cases := []*codeCheckingCase{
// 401
{
@ -93,14 +92,14 @@ func TestReplicationPolicyAPIList(t *testing.T) {
}
func TestReplicationPolicyAPICreate(t *testing.T) {
policyMgr := ng.PolicyCtl
registryMgr := ng.RegistryMgr
policyMgr := replication.PolicyCtl
registryMgr := replication.RegistryMgr
defer func() {
ng.PolicyCtl = policyMgr
ng.RegistryMgr = registryMgr
replication.PolicyCtl = policyMgr
replication.RegistryMgr = registryMgr
}()
ng.PolicyCtl = &fakedPolicyManager{}
ng.RegistryMgr = &fakedRegistryManager{}
replication.PolicyCtl = &fakedPolicyManager{}
replication.RegistryMgr = &fakedRegistryManager{}
cases := []*codeCheckingCase{
// 401
{
@ -216,14 +215,14 @@ func TestReplicationPolicyAPICreate(t *testing.T) {
}
func TestReplicationPolicyAPIGet(t *testing.T) {
policyMgr := ng.PolicyCtl
registryMgr := ng.RegistryMgr
policyMgr := replication.PolicyCtl
registryMgr := replication.RegistryMgr
defer func() {
ng.PolicyCtl = policyMgr
ng.RegistryMgr = registryMgr
replication.PolicyCtl = policyMgr
replication.RegistryMgr = registryMgr
}()
ng.PolicyCtl = &fakedPolicyManager{}
ng.RegistryMgr = &fakedRegistryManager{}
replication.PolicyCtl = &fakedPolicyManager{}
replication.RegistryMgr = &fakedRegistryManager{}
cases := []*codeCheckingCase{
// 401
{
@ -266,14 +265,14 @@ func TestReplicationPolicyAPIGet(t *testing.T) {
}
func TestReplicationPolicyAPIUpdate(t *testing.T) {
policyMgr := ng.PolicyCtl
registryMgr := ng.RegistryMgr
policyMgr := replication.PolicyCtl
registryMgr := replication.RegistryMgr
defer func() {
ng.PolicyCtl = policyMgr
ng.RegistryMgr = registryMgr
replication.PolicyCtl = policyMgr
replication.RegistryMgr = registryMgr
}()
ng.PolicyCtl = &fakedPolicyManager{}
ng.RegistryMgr = &fakedRegistryManager{}
replication.PolicyCtl = &fakedPolicyManager{}
replication.RegistryMgr = &fakedRegistryManager{}
cases := []*codeCheckingCase{
// 401
{
@ -371,11 +370,11 @@ func TestReplicationPolicyAPIUpdate(t *testing.T) {
}
func TestReplicationPolicyAPIDelete(t *testing.T) {
policyMgr := ng.PolicyCtl
policyMgr := replication.PolicyCtl
defer func() {
ng.PolicyCtl = policyMgr
replication.PolicyCtl = policyMgr
}()
ng.PolicyCtl = &fakedPolicyManager{}
replication.PolicyCtl = &fakedPolicyManager{}
cases := []*codeCheckingCase{
// 401
{

View File

@ -38,9 +38,9 @@ import (
"github.com/goharbor/harbor/src/common/utils/registry"
"github.com/goharbor/harbor/src/core/config"
coreutils "github.com/goharbor/harbor/src/core/utils"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication/ng/event"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/event"
"github.com/goharbor/harbor/src/replication/model"
)
// RepositoryAPI handles request to /api/repositories /api/repositories/tags /api/repositories/manifests, the parm has to be put
@ -345,7 +345,7 @@ func (ra *RepositoryAPI) Delete() {
Deleted: true,
},
}
if err := ng.EventHandler.Handle(e); err != nil {
if err := replication.EventHandler.Handle(e); err != nil {
log.Errorf("failed to handle event: %v", err)
}
}(t)

View File

@ -24,7 +24,6 @@ import (
"github.com/astaxie/beego"
_ "github.com/astaxie/beego/session/redis"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/common/utils"
@ -38,7 +37,7 @@ import (
"github.com/goharbor/harbor/src/core/filter"
"github.com/goharbor/harbor/src/core/proxy"
"github.com/goharbor/harbor/src/core/service/token"
"github.com/goharbor/harbor/src/replication/ng"
"github.com/goharbor/harbor/src/replication"
)
const (
@ -132,7 +131,7 @@ func main() {
closing := make(chan struct{})
go gracefulShutdown(closing)
if err := ng.Init(closing); err != nil {
if err := replication.Init(closing); err != nil {
log.Fatalf("failed to init for replication: %v", err)
}

View File

@ -23,9 +23,9 @@ import (
"github.com/goharbor/harbor/src/common/models"
"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/operation/hook"
"github.com/goharbor/harbor/src/replication/ng/policy/scheduler"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/operation/hook"
"github.com/goharbor/harbor/src/replication/policy/scheduler"
)
var statusMap = map[string]string{
@ -96,7 +96,7 @@ func (h *Handler) HandleReplicationScheduleJob() {
// HandleReplicationTask handles the webhook of replication task
func (h *Handler) HandleReplicationTask() {
log.Debugf("received replication task status update event: task-%d, status-%s", h.id, h.status)
if err := hook.UpdateTask(ng.OperationCtl, h.id, h.rawStatus); err != nil {
if err := hook.UpdateTask(replication.OperationCtl, h.id, h.rawStatus); err != nil {
log.Errorf("Failed to update replication task status, id: %d, status: %s", h.id, h.status)
h.HandleInternalServerError(err.Error())
return

View File

@ -20,8 +20,6 @@ import (
"strings"
"time"
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/common/dao"
clairdao "github.com/goharbor/harbor/src/common/dao/clair"
"github.com/goharbor/harbor/src/common/models"
@ -30,9 +28,10 @@ import (
"github.com/goharbor/harbor/src/core/api"
"github.com/goharbor/harbor/src/core/config"
coreutils "github.com/goharbor/harbor/src/core/utils"
"github.com/goharbor/harbor/src/replication/ng"
rep_event "github.com/goharbor/harbor/src/replication/ng/event"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication"
"github.com/goharbor/harbor/src/replication/adapter"
rep_event "github.com/goharbor/harbor/src/replication/event"
"github.com/goharbor/harbor/src/replication/model"
)
// NotificationHandler handles request on /service/notifications/, which listens to registry's events.
@ -131,7 +130,7 @@ func (n *NotificationHandler) Post() {
},
},
}
if err := ng.EventHandler.Handle(e); err != nil {
if err := replication.EventHandler.Handle(e); err != nil {
log.Errorf("failed to handle event: %v", err)
}
}()

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package ng
package replication
import (
"encoding/json"
@ -20,18 +20,19 @@ import (
"github.com/goharbor/harbor/src/jobservice/env"
"github.com/goharbor/harbor/src/jobservice/opm"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/transfer"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/transfer"
// import chart transfer
_ "github.com/goharbor/harbor/src/replication/ng/transfer/chart"
_ "github.com/goharbor/harbor/src/replication/transfer/chart"
// import repository transfer
_ "github.com/goharbor/harbor/src/replication/ng/transfer/repository"
_ "github.com/goharbor/harbor/src/replication/transfer/repository"
// register the Harbor adapter
_ "github.com/goharbor/harbor/src/replication/ng/adapter/harbor"
_ "github.com/goharbor/harbor/src/replication/adapter/harbor"
// register the DockerHub adapter
_ "github.com/goharbor/harbor/src/replication/ng/adapter/dockerhub"
_ "github.com/goharbor/harbor/src/replication/adapter/dockerhub"
// register the Native adapter
_ "github.com/goharbor/harbor/src/replication/ng/adapter/native"
_ "github.com/goharbor/harbor/src/replication/adapter/native"
)
// Replication implements the job interface

View File

@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package ng
package replication
import (
"testing"
"github.com/goharbor/harbor/src/jobservice/job/impl"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/transfer"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/transfer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -12,21 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package ng
package replication
import (
"fmt"
"net/http"
"os"
"github.com/goharbor/harbor/src/replication/ng/model"
common_http "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/http/modifier/auth"
reg "github.com/goharbor/harbor/src/common/utils/registry"
"github.com/goharbor/harbor/src/jobservice/env"
"github.com/goharbor/harbor/src/jobservice/errs"
"github.com/goharbor/harbor/src/jobservice/opm"
"github.com/goharbor/harbor/src/replication/model"
)
// Scheduler is a job running in Jobservice which can be used as

View File

@ -31,7 +31,7 @@ import (
jsjob "github.com/goharbor/harbor/src/jobservice/job"
"github.com/goharbor/harbor/src/jobservice/job/impl"
"github.com/goharbor/harbor/src/jobservice/job/impl/gc"
"github.com/goharbor/harbor/src/jobservice/job/impl/replication/ng"
"github.com/goharbor/harbor/src/jobservice/job/impl/replication"
"github.com/goharbor/harbor/src/jobservice/job/impl/scan"
"github.com/goharbor/harbor/src/jobservice/logger"
"github.com/goharbor/harbor/src/jobservice/models"
@ -208,8 +208,8 @@ func (bs *Bootstrap) loadAndRunRedisWorkerPool(ctx *env.Context, cfg *config.Con
job.ImageScanJob: (*scan.ClairJob)(nil),
job.ImageScanAllJob: (*scan.All)(nil),
job.ImageGC: (*gc.GarbageCollector)(nil),
job.Replication: (*ng.Replication)(nil),
job.ReplicationScheduler: (*ng.Scheduler)(nil),
job.Replication: (*replication.Replication)(nil),
job.ReplicationScheduler: (*replication.Scheduler)(nil),
}); err != nil {
// exit
return nil, err

View File

@ -18,7 +18,7 @@ import (
"errors"
"fmt"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
var registry = map[model.RegistryType]Factory{}

View File

@ -17,7 +17,7 @@ package adapter
import (
"testing"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -17,7 +17,7 @@ package adapter
import (
"io"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
// ChartRegistry defines the capabilities that a chart registry should have

View File

@ -10,9 +10,9 @@ import (
"strings"
"github.com/goharbor/harbor/src/common/utils/log"
adp "github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/util"
adp "github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/util"
)
func init() {

View File

@ -4,10 +4,9 @@ import (
"fmt"
"testing"
adp "github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
adp "github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
)
const (

View File

@ -9,7 +9,7 @@ import (
"net/http"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
// Client is a client to interact with DockerHub

View File

@ -25,9 +25,9 @@ import (
common_http_auth "github.com/goharbor/harbor/src/common/http/modifier/auth"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/common/utils/registry/auth"
adp "github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/util"
adp "github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/util"
)
func init() {

View File

@ -19,7 +19,7 @@ import (
"testing"
"github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -25,7 +25,7 @@ import (
common_http "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
// TODO review the logic in this file

View File

@ -20,7 +20,7 @@ import (
"testing"
"github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -17,8 +17,8 @@ package harbor
import (
"fmt"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/util"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/util"
)
// TODO unify the filter logic from different adapters into one?

View File

@ -17,8 +17,7 @@ package harbor
import (
"testing"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -19,7 +19,7 @@ import (
"strings"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
type repository struct {

View File

@ -18,10 +18,9 @@ import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common/utils/test"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -11,8 +11,8 @@ import (
"strings"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
)
const (

View File

@ -5,8 +5,8 @@ import (
"strings"
"testing"
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
)
var hwAdapter adapter.Adapter

View File

@ -9,7 +9,7 @@ import (
"net/http"
"time"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
// FetchImages gets resources from Huawei SWR

View File

@ -4,7 +4,7 @@ import (
"strings"
"testing"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
var HWAdapter Adapter

View File

@ -30,8 +30,8 @@ import (
registry_pkg "github.com/goharbor/harbor/src/common/utils/registry"
util_registry "github.com/goharbor/harbor/src/common/utils/registry"
"github.com/goharbor/harbor/src/common/utils/registry/auth"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/util"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/util"
)
// const definition

View File

@ -2,9 +2,10 @@ package native
import (
"errors"
"github.com/goharbor/harbor/src/common/utils/log"
adp "github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
adp "github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
)
const registryTypeNative model.RegistryType = "native"

View File

@ -4,9 +4,9 @@ import (
"errors"
"strings"
adp "github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/util"
adp "github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/util"
)
var _ adp.ImageRegistry = native{}

View File

@ -15,14 +15,13 @@
package dao
import (
"time"
"fmt"
"time"
"github.com/astaxie/beego/orm"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/dao/models"
)
// AddExecution ...

View File

@ -1,11 +1,12 @@
package dao
import (
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
"time"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestMethodOfExecution(t *testing.T) {

View File

@ -3,7 +3,7 @@ package models
import (
"time"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
const (

View File

@ -4,7 +4,6 @@ import (
"time"
"github.com/astaxie/beego/validation"
"github.com/goharbor/harbor/src/common/utils"
)

View File

@ -5,10 +5,9 @@ import (
"time"
"github.com/astaxie/beego/orm"
common_dao "github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
)
// AddRepPolicy insert new policy to DB.

View File

@ -3,12 +3,11 @@ package dao
import (
"testing"
common_models "github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
common_models "github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
)
var (

View File

@ -2,9 +2,8 @@ package dao
import (
"github.com/astaxie/beego/orm"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/dao/models"
)
// ListRegistryQuery defines the query conditions to list registry.

View File

@ -3,10 +3,9 @@ package dao
import (
"testing"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
)
var (

View File

@ -19,7 +19,7 @@ import (
"github.com/astaxie/beego/orm"
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/dao/models"
)
// ScheduleJob is the DAO for schedule job

View File

@ -17,11 +17,9 @@ package dao
import (
"testing"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
)
var sjID int64

View File

@ -14,7 +14,7 @@
package event
import "github.com/goharbor/harbor/src/replication/ng/model"
import "github.com/goharbor/harbor/src/replication/model"
// const definitions
const (

View File

@ -18,13 +18,12 @@ import (
"errors"
"fmt"
"github.com/goharbor/harbor/src/replication/ng/config"
"github.com/goharbor/harbor/src/replication/ng/registry"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/operation"
"github.com/goharbor/harbor/src/replication/ng/policy"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/operation"
"github.com/goharbor/harbor/src/replication/policy"
"github.com/goharbor/harbor/src/replication/registry"
)
// Handler is the handler to handle event

View File

@ -17,13 +17,11 @@ package event
import (
"testing"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"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"
)
type fakedOperationController struct{}

View File

@ -17,9 +17,8 @@ package model
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/astaxie/beego/validation"
"github.com/stretchr/testify/assert"
)
func TestValidOfPolicy(t *testing.T) {

View File

@ -1,27 +0,0 @@
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package dao
import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/models"
)
// TODO remove the file
// CreateProject ...
func CreateProject(project *models.Project) (int64, error) {
return dao.GetOrmer().Insert(project)
}

View File

@ -1,33 +0,0 @@
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package dao
import (
"testing"
"github.com/goharbor/harbor/src/common/models"
"github.com/stretchr/testify/require"
)
// TODO remove the file
func TestCreateProject(t *testing.T) {
project := &models.Project{
Name: "example-project",
OwnerID: 1,
}
_, err := CreateProject(project)
require.Nil(t, err)
}

View File

@ -21,11 +21,11 @@ import (
"github.com/goharbor/harbor/src/common/job"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"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/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/operation/execution"
"github.com/goharbor/harbor/src/replication/operation/flow"
"github.com/goharbor/harbor/src/replication/operation/scheduler"
)
// Controller handles the replication-related operations: start,

View File

@ -20,12 +20,12 @@ import (
"testing"
"github.com/docker/distribution"
"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/model"
"github.com/goharbor/harbor/src/replication/ng/operation/flow"
"github.com/goharbor/harbor/src/replication/ng/operation/scheduler"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/operation/flow"
"github.com/goharbor/harbor/src/replication/operation/scheduler"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -18,8 +18,8 @@ import (
"fmt"
"github.com/goharbor/harbor/src/core/utils"
"github.com/goharbor/harbor/src/replication/ng/dao"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/dao"
"github.com/goharbor/harbor/src/replication/dao/models"
)
// Manager manages the executions

View File

@ -7,7 +7,7 @@ import (
"github.com/goharbor/harbor/src/common/dao"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -18,7 +18,6 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -18,10 +18,10 @@ import (
"time"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"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/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/operation/execution"
"github.com/goharbor/harbor/src/replication/operation/scheduler"
)
type copyFlow struct {

View File

@ -13,9 +13,8 @@ package flow
import (
"testing"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/stretchr/testify/require"
)

View File

@ -16,9 +16,9 @@ package flow
import (
"github.com/goharbor/harbor/src/common/utils/log"
"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/model"
"github.com/goharbor/harbor/src/replication/operation/execution"
"github.com/goharbor/harbor/src/replication/operation/scheduler"
)
type deletionFlow struct {

View File

@ -17,9 +17,8 @@ package flow
import (
"testing"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/stretchr/testify/require"
)

View File

@ -21,12 +21,12 @@ import (
"time"
"github.com/goharbor/harbor/src/common/utils/log"
adp "github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"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/util"
adp "github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/operation/execution"
"github.com/goharbor/harbor/src/replication/operation/scheduler"
"github.com/goharbor/harbor/src/replication/util"
)
// get/create the source registry, destination registry, source adapter and destination adapter

View File

@ -20,12 +20,11 @@ import (
"testing"
"github.com/docker/distribution"
"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/model"
"github.com/goharbor/harbor/src/replication/ng/operation/scheduler"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/operation/scheduler"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -16,8 +16,8 @@ package hook
import (
"github.com/goharbor/harbor/src/jobservice/job"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/operation"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/operation"
)
// UpdateTask update the status of the task

View File

@ -18,8 +18,8 @@ import (
"testing"
"github.com/goharbor/harbor/src/jobservice/job"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -23,8 +23,8 @@ import (
common_job "github.com/goharbor/harbor/src/common/job"
"github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/jobservice/opm"
"github.com/goharbor/harbor/src/replication/ng/config"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/model"
)
type defaultScheduler struct {

View File

@ -5,7 +5,7 @@ import (
"testing"
"github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
var scheduler = &defaultScheduler{

View File

@ -15,7 +15,7 @@
package policy
import (
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/model"
)
// Controller controls the replication policies

View File

@ -19,10 +19,10 @@ import (
"github.com/goharbor/harbor/src/common/job"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/policy"
"github.com/goharbor/harbor/src/replication/ng/policy/manager"
"github.com/goharbor/harbor/src/replication/ng/policy/scheduler"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/policy"
"github.com/goharbor/harbor/src/replication/policy/manager"
"github.com/goharbor/harbor/src/replication/policy/scheduler"
)
// NewController returns a policy controller which can CURD and schedule policies

View File

@ -17,11 +17,9 @@ package controller
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/stretchr/testify/require"
)
type fakedPolicyController struct {

View File

@ -22,10 +22,10 @@ import (
"time"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/dao"
persist_models "github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/ng/policy"
"github.com/goharbor/harbor/src/replication/dao"
persist_models "github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/goharbor/harbor/src/replication/policy"
)
var errNilPolicyModel = errors.New("nil policy model")

View File

@ -18,8 +18,8 @@ import (
"reflect"
"testing"
persist_models "github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
persist_models "github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -23,9 +23,9 @@ import (
"github.com/goharbor/harbor/src/common/job"
job_models "github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/config"
"github.com/goharbor/harbor/src/replication/ng/dao"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/dao"
"github.com/goharbor/harbor/src/replication/dao/models"
)
// Scheduler can be used to schedule or unschedule a scheduled policy

View File

@ -18,13 +18,11 @@ import (
"fmt"
"testing"
"github.com/goharbor/harbor/src/replication/ng/config"
"github.com/stretchr/testify/assert"
"github.com/goharbor/harbor/src/common/job/models"
"github.com/goharbor/harbor/src/replication/ng/dao"
rep_models "github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/dao"
rep_models "github.com/goharbor/harbor/src/replication/dao/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -15,8 +15,8 @@
package scheduler
import (
"github.com/goharbor/harbor/src/replication/ng/dao"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/dao"
"github.com/goharbor/harbor/src/replication/dao/models"
)
// UpdateStatus updates the schedule job status

View File

@ -19,11 +19,11 @@ import (
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/config"
"github.com/goharbor/harbor/src/replication/ng/dao"
"github.com/goharbor/harbor/src/replication/ng/dao/models"
"github.com/goharbor/harbor/src/replication/ng/model"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/dao"
"github.com/goharbor/harbor/src/replication/dao/models"
"github.com/goharbor/harbor/src/replication/model"
)
// Manager defines the methods that a target manager should implement

View File

@ -12,9 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package ng ...
// TODO rename the package name after removing ng
package ng
package replication
import (
"time"
@ -22,19 +20,19 @@ import (
"github.com/goharbor/harbor/src/common/job"
"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/event"
"github.com/goharbor/harbor/src/replication/ng/operation"
"github.com/goharbor/harbor/src/replication/ng/policy"
"github.com/goharbor/harbor/src/replication/ng/policy/controller"
"github.com/goharbor/harbor/src/replication/ng/registry"
"github.com/goharbor/harbor/src/replication/config"
"github.com/goharbor/harbor/src/replication/event"
"github.com/goharbor/harbor/src/replication/operation"
"github.com/goharbor/harbor/src/replication/policy"
"github.com/goharbor/harbor/src/replication/policy/controller"
"github.com/goharbor/harbor/src/replication/registry"
// register the Harbor adapter
_ "github.com/goharbor/harbor/src/replication/ng/adapter/dockerhub"
_ "github.com/goharbor/harbor/src/replication/adapter/dockerhub"
// register the DockerHub adapter
_ "github.com/goharbor/harbor/src/replication/ng/adapter/harbor"
_ "github.com/goharbor/harbor/src/replication/adapter/harbor"
// register the Native adapter
_ "github.com/goharbor/harbor/src/replication/ng/adapter/native"
_ "github.com/goharbor/harbor/src/replication/adapter/native"
)
var (

View File

@ -12,9 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package ng ...
// TODO rename the package name after removing ng
package ng
package replication
import (
"io/ioutil"

View File

@ -19,9 +19,9 @@ import (
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/jobservice/errs"
"github.com/goharbor/harbor/src/replication/ng/adapter"
"github.com/goharbor/harbor/src/replication/ng/model"
trans "github.com/goharbor/harbor/src/replication/ng/transfer"
"github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/model"
trans "github.com/goharbor/harbor/src/replication/transfer"
)
var (

Some files were not shown because too many files have changed in this diff Show More