diff --git a/coordinator/internal/cmd/cmd.go b/coordinator/internal/cmd/cmd.go index b05e4f5..0dafec7 100644 --- a/coordinator/internal/cmd/cmd.go +++ b/coordinator/internal/cmd/cmd.go @@ -2,17 +2,4 @@ package cmd import "github.com/spf13/cobra" -var RootCmd = &cobra.Command{ - Use: "coordinator", - Short: "Coordinator service for storage", - Long: `Coordinator service for storage`, -} - -func init() { - var configPath string - RootCmd.Flags().StringVarP(&configPath, "config", "c", "", "Path to config file") - - RootCmd.Run = func(cmd *cobra.Command, args []string) { - serve(configPath) - } -} +var RootCmd = &cobra.Command{} diff --git a/coordinator/internal/cmd/serve.go b/coordinator/internal/cmd/serve.go index 469d977..d50be27 100644 --- a/coordinator/internal/cmd/serve.go +++ b/coordinator/internal/cmd/serve.go @@ -5,6 +5,7 @@ import ( "fmt" "os" + "github.com/spf13/cobra" "gitlink.org.cn/cloudream/common/pkgs/logger" "gitlink.org.cn/cloudream/common/pkgs/mq" coormq "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/mq/coordinator" @@ -14,6 +15,20 @@ import ( mymq "gitlink.org.cn/cloudream/jcs-pub/coordinator/internal/mq" ) +func init() { + var configPath string + cmd := &cobra.Command{ + Use: "serve", + Short: "Start coordinator server", + Long: `Start coordinator server`, + Run: func(cmd *cobra.Command, args []string) { + serve(configPath) + }, + } + cmd.Flags().StringVarP(&configPath, "config", "c", "", "Path to config file") + RootCmd.AddCommand(cmd) +} + func serve(configPath string) { err := config.Init(configPath) if err != nil { diff --git a/coordinator/types/storage_feature.go b/coordinator/types/storage_feature.go index 2afeaa5..a477518 100644 --- a/coordinator/types/storage_feature.go +++ b/coordinator/types/storage_feature.go @@ -13,7 +13,6 @@ type StorageFeature interface { } var _ = serder.UseTypeUnionInternallyTagged(types.Ref(types.NewTypeUnion[StorageFeature]( - (*TempStore)(nil), (*BypassWriteFeature)(nil), (*MultipartUploadFeature)(nil), (*InternalServerlessCallFeature)(nil), @@ -21,20 +20,6 @@ var _ = serder.UseTypeUnionInternallyTagged(types.Ref(types.NewTypeUnion[Storage (*ECMultiplierFeature)(nil), )), "type") -type TempStore struct { - serder.Metadata `union:"TempStore"` - Type string `json:"type"` - TempRoot string `json:"tempRoot"` // 临时文件存放目录 -} - -func (f *TempStore) GetFeatureType() string { - return "TempStore" -} - -func (f *TempStore) String() string { - return "TempStore" -} - // 存储服务支持被非MasterHub直接上传文件 type BypassWriteFeature struct { serder.Metadata `union:"BypassWrite"`