You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

scanner.go 1.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package cmdline
  2. import (
  3. "fmt"
  4. "gitlink.org.cn/cloudream/common/pkg/cmdtrie"
  5. myreflect "gitlink.org.cn/cloudream/common/utils/reflect"
  6. scevt "gitlink.org.cn/cloudream/rabbitmq/message/scanner/event"
  7. )
  8. var parseScannerEventCmdTrie cmdtrie.StaticCommandTrie[any] = cmdtrie.NewStaticCommandTrie[any]()
  9. func ScannerPostEvent(ctx CommandContext, args []string) error {
  10. ret, err := parseScannerEventCmdTrie.Execute(args, cmdtrie.ExecuteOption{ReplaceEmptyArrayWithNil: true})
  11. if err != nil {
  12. return fmt.Errorf("execute parsing event command failed, err: %w", err)
  13. }
  14. // TODO 支持设置标志
  15. err = ctx.Cmdline.Svc.ScannerSvc().PostEvent(ret, false, false)
  16. if err != nil {
  17. return fmt.Errorf("post event to scanner failed, err: %w", err)
  18. }
  19. return nil
  20. }
  21. func init() {
  22. parseScannerEventCmdTrie.MustAdd(scevt.NewAgentCheckCache, myreflect.TypeNameOf[scevt.AgentCheckCache]())
  23. parseScannerEventCmdTrie.MustAdd(scevt.NewAgentCheckState, myreflect.TypeNameOf[scevt.AgentCheckState]())
  24. parseScannerEventCmdTrie.MustAdd(scevt.NewAgentCheckStorage, myreflect.TypeNameOf[scevt.AgentCheckStorage]())
  25. parseScannerEventCmdTrie.MustAdd(scevt.NewCheckCache, myreflect.TypeNameOf[scevt.CheckCache]())
  26. parseScannerEventCmdTrie.MustAdd(scevt.NewCheckObject, myreflect.TypeNameOf[scevt.CheckObject]())
  27. parseScannerEventCmdTrie.MustAdd(scevt.NewCheckRepCount, myreflect.TypeNameOf[scevt.CheckRepCount]())
  28. commands.MustAdd(ScannerPostEvent, "scanner", "event")
  29. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。