From 63cdbb5385782125c4258d3d5f605aa7c4a62495 Mon Sep 17 00:00:00 2001 From: Han Fei Date: Mon, 20 Dec 2021 10:33:52 +0800 Subject: [PATCH] adjust the structure of directories (#52) --- cmd/master-client/main.go | 2 +- executor/runtime/jobmaster/build.go | 4 ++-- executor/runtime/jobmaster/operator.go | 2 +- {master/jobmaster => jobmaster}/benchmark/build.go | 2 +- {master/jobmaster => jobmaster}/benchmark/config.go | 0 .../benchmark/master.go => jobmaster/benchmark/jobmaster.go | 2 +- {master/jobmaster => jobmaster}/system/impl.go | 0 {master/jobmaster => jobmaster}/system/interface.go | 0 master/{cluster => }/executor_manager.go | 2 +- master/jobmanager.go | 2 +- master/server.go | 5 ++--- test/job_test.go | 2 +- 12 files changed, 11 insertions(+), 12 deletions(-) rename {master/jobmaster => jobmaster}/benchmark/build.go (98%) rename {master/jobmaster => jobmaster}/benchmark/config.go (100%) rename master/jobmaster/benchmark/master.go => jobmaster/benchmark/jobmaster.go (92%) rename {master/jobmaster => jobmaster}/system/impl.go (100%) rename {master/jobmaster => jobmaster}/system/interface.go (100%) rename master/{cluster => }/executor_manager.go (99%) diff --git a/cmd/master-client/main.go b/cmd/master-client/main.go index 3dae9ac15bf..2c665f1a8bb 100644 --- a/cmd/master-client/main.go +++ b/cmd/master-client/main.go @@ -9,7 +9,7 @@ import ( "strconv" "github.com/hanfei1991/microcosm/client" - "github.com/hanfei1991/microcosm/master/jobmaster/benchmark" + "github.com/hanfei1991/microcosm/jobmaster/benchmark" "github.com/hanfei1991/microcosm/pb" "github.com/pkg/errors" ) diff --git a/executor/runtime/jobmaster/build.go b/executor/runtime/jobmaster/build.go index d45dd2d309b..a9b85c1a1df 100644 --- a/executor/runtime/jobmaster/build.go +++ b/executor/runtime/jobmaster/build.go @@ -6,8 +6,8 @@ import ( "github.com/hanfei1991/microcosm/client" "github.com/hanfei1991/microcosm/executor/runtime" - "github.com/hanfei1991/microcosm/master/jobmaster/benchmark" - "github.com/hanfei1991/microcosm/master/jobmaster/system" + "github.com/hanfei1991/microcosm/jobmaster/benchmark" + "github.com/hanfei1991/microcosm/jobmaster/system" "github.com/hanfei1991/microcosm/model" "github.com/hanfei1991/microcosm/pkg/errors" ) diff --git a/executor/runtime/jobmaster/operator.go b/executor/runtime/jobmaster/operator.go index 33f0ec685ea..c78810428b3 100644 --- a/executor/runtime/jobmaster/operator.go +++ b/executor/runtime/jobmaster/operator.go @@ -4,7 +4,7 @@ import ( "context" "github.com/hanfei1991/microcosm/executor/runtime" - "github.com/hanfei1991/microcosm/master/jobmaster/system" + "github.com/hanfei1991/microcosm/jobmaster/system" "github.com/pingcap/tiflow/dm/pkg/log" "go.uber.org/zap" ) diff --git a/master/jobmaster/benchmark/build.go b/jobmaster/benchmark/build.go similarity index 98% rename from master/jobmaster/benchmark/build.go rename to jobmaster/benchmark/build.go index 883eea273eb..c05e26ca9a3 100644 --- a/master/jobmaster/benchmark/build.go +++ b/jobmaster/benchmark/build.go @@ -7,7 +7,7 @@ import ( "path/filepath" "github.com/hanfei1991/microcosm/client" - "github.com/hanfei1991/microcosm/master/jobmaster/system" + "github.com/hanfei1991/microcosm/jobmaster/system" "github.com/hanfei1991/microcosm/model" "github.com/hanfei1991/microcosm/pkg/autoid" ) diff --git a/master/jobmaster/benchmark/config.go b/jobmaster/benchmark/config.go similarity index 100% rename from master/jobmaster/benchmark/config.go rename to jobmaster/benchmark/config.go diff --git a/master/jobmaster/benchmark/master.go b/jobmaster/benchmark/jobmaster.go similarity index 92% rename from master/jobmaster/benchmark/master.go rename to jobmaster/benchmark/jobmaster.go index f5fb63b2cdc..29bd515c049 100644 --- a/master/jobmaster/benchmark/master.go +++ b/jobmaster/benchmark/jobmaster.go @@ -3,7 +3,7 @@ package benchmark import ( "context" - "github.com/hanfei1991/microcosm/master/jobmaster/system" + "github.com/hanfei1991/microcosm/jobmaster/system" "github.com/hanfei1991/microcosm/model" ) diff --git a/master/jobmaster/system/impl.go b/jobmaster/system/impl.go similarity index 100% rename from master/jobmaster/system/impl.go rename to jobmaster/system/impl.go diff --git a/master/jobmaster/system/interface.go b/jobmaster/system/interface.go similarity index 100% rename from master/jobmaster/system/interface.go rename to jobmaster/system/interface.go diff --git a/master/cluster/executor_manager.go b/master/executor_manager.go similarity index 99% rename from master/cluster/executor_manager.go rename to master/executor_manager.go index b554eba4270..6fd66e4099f 100644 --- a/master/cluster/executor_manager.go +++ b/master/executor_manager.go @@ -1,4 +1,4 @@ -package cluster +package master import ( "context" diff --git a/master/jobmanager.go b/master/jobmanager.go index ce3151a9cf4..3fc6bd701c4 100644 --- a/master/jobmanager.go +++ b/master/jobmanager.go @@ -6,7 +6,7 @@ import ( "sync" "github.com/hanfei1991/microcosm/client" - "github.com/hanfei1991/microcosm/master/jobmaster/system" + "github.com/hanfei1991/microcosm/jobmaster/system" "github.com/hanfei1991/microcosm/model" "github.com/hanfei1991/microcosm/pb" "github.com/hanfei1991/microcosm/pkg/autoid" diff --git a/master/server.go b/master/server.go index 9dd3355c6c9..4b0b25ed53c 100644 --- a/master/server.go +++ b/master/server.go @@ -5,7 +5,6 @@ import ( "fmt" "net" - "github.com/hanfei1991/microcosm/master/cluster" "github.com/hanfei1991/microcosm/model" "github.com/hanfei1991/microcosm/pb" "github.com/hanfei1991/microcosm/pkg/errors" @@ -29,7 +28,7 @@ type Server struct { // election *election.Election // sched scheduler - executorManager *cluster.ExecutorManager + executorManager *ExecutorManager jobManager *JobManager // cfg *Config @@ -43,7 +42,7 @@ type Server struct { // NewServer creates a new master-server. func NewServer(cfg *Config, ctx *test.Context) (*Server, error) { executorNotifier := make(chan model.ExecutorID, 100) - executorManager := cluster.NewExecutorManager(executorNotifier, cfg.KeepAliveTTL, cfg.KeepAliveInterval, ctx) + executorManager := NewExecutorManager(executorNotifier, cfg.KeepAliveTTL, cfg.KeepAliveInterval, ctx) urls, err := parseURLs(cfg.MasterAddr) if err != nil { diff --git a/test/job_test.go b/test/job_test.go index fabcbf3370d..5cb00ba2125 100644 --- a/test/job_test.go +++ b/test/job_test.go @@ -8,8 +8,8 @@ import ( "github.com/hanfei1991/microcosm/client" "github.com/hanfei1991/microcosm/executor" "github.com/hanfei1991/microcosm/executor/runtime" + "github.com/hanfei1991/microcosm/jobmaster/benchmark" "github.com/hanfei1991/microcosm/master" - "github.com/hanfei1991/microcosm/master/jobmaster/benchmark" "github.com/hanfei1991/microcosm/pb" "github.com/hanfei1991/microcosm/pkg/etcdutils" . "github.com/pingcap/check"