Browse Source

Merge pull request '解决pcm联调问题' (#13) from feature_gxh into master

gitlink
baohan 2 years ago
parent
commit
95547af9af
8 changed files with 11 additions and 10 deletions
  1. +1
    -0
      client/internal/http/server.go
  2. +4
    -4
      client/internal/http/storage.go
  3. +1
    -1
      scanner/internal/event/agent_check_cache.go
  4. +1
    -1
      scanner/internal/event/agent_check_state.go
  5. +1
    -1
      scanner/internal/event/agent_check_storage.go
  6. +1
    -1
      scanner/internal/event/check_cache.go
  7. +1
    -1
      scanner/internal/event/check_package.go
  8. +1
    -1
      scanner/internal/event/check_rep_count.go

+ 1
- 0
client/internal/http/server.go View File

@@ -48,6 +48,7 @@ func (s *Server) initRouters() {

s.engine.POST("/storage/loadPackage", s.StorageSvc().LoadPackage)
s.engine.POST("/storage/createPackage", s.StorageSvc().CreatePackage)
s.engine.GET("/storage/getInfo", s.StorageSvc().GetInfo)

s.engine.POST("/cache/movePackage", s.CacheSvc().MovePackage)
s.engine.GET("/cache/getPackageObjectCacheInfos", s.CacheSvc().GetPackageObjectCacheInfos)


+ 4
- 4
client/internal/http/storage.go View File

@@ -128,8 +128,8 @@ func (s *StorageService) CreatePackage(ctx *gin.Context) {
}

type StorageGetInfoReq struct {
UserID *int64 `json:"userID" binding:"required"`
StorageID *int64 `json:"storageID" binding:"required"`
UserID *int64 `form:"userID" binding:"required"`
StorageID *int64 `form:"storageID" binding:"required"`
}

type StorageGetInfoResp struct {
@@ -140,8 +140,8 @@ func (s *StorageService) GetInfo(ctx *gin.Context) {
log := logger.WithField("HTTP", "Storage.GetInfo")

var req StorageGetInfoReq
if err := ctx.ShouldBindJSON(&req); err != nil {
log.Warnf("binding body: %s", err.Error())
if err := ctx.ShouldBindQuery(&req); err != nil {
log.Warnf("binding query: %s", err.Error())
ctx.JSON(http.StatusBadRequest, Failed(errorcode.BadArgument, "missing argument or invalid argument"))
return
}


+ 1
- 1
scanner/internal/event/agent_check_cache.go View File

@@ -47,7 +47,7 @@ func (t *AgentCheckCache) TryMerge(other Event) bool {

func (t *AgentCheckCache) Execute(execCtx ExecuteContext) {
log := logger.WithType[AgentCheckCache]("Event")
log.Debugf("begin with %v", logger.FormatStruct(t))
log.Debugf("begin with %v", logger.FormatStruct(t.AgentCheckCache))
defer log.Debugf("end")

// TODO unavailable的节点需不需要发送任务?


+ 1
- 1
scanner/internal/event/agent_check_state.go View File

@@ -37,7 +37,7 @@ func (t *AgentCheckState) TryMerge(other Event) bool {

func (t *AgentCheckState) Execute(execCtx ExecuteContext) {
log := logger.WithType[AgentCheckState]("Event")
log.Debugf("begin with %v", logger.FormatStruct(t))
log.Debugf("begin with %v", logger.FormatStruct(t.AgentCheckState))
defer log.Debugf("end")

mutex, err := reqbuilder.NewBuilder().


+ 1
- 1
scanner/internal/event/agent_check_storage.go View File

@@ -47,7 +47,7 @@ func (t *AgentCheckStorage) TryMerge(other Event) bool {

func (t *AgentCheckStorage) Execute(execCtx ExecuteContext) {
log := logger.WithType[AgentCheckStorage]("Event")
log.Debugf("begin with %v", logger.FormatStruct(t))
log.Debugf("begin with %v", logger.FormatStruct(t.AgentCheckStorage))
defer log.Debugf("end")

// 读取数据的地方就不加锁了,因为check任务会反复执行,单次失败问题不大


+ 1
- 1
scanner/internal/event/check_cache.go View File

@@ -35,7 +35,7 @@ func (t *CheckCache) TryMerge(other Event) bool {

func (t *CheckCache) Execute(execCtx ExecuteContext) {
log := logger.WithType[AgentCheckStorage]("Event")
log.Debugf("begin with %v", logger.FormatStruct(t))
log.Debugf("begin with %v", logger.FormatStruct(t.CheckCache))
defer log.Debugf("end")

mutex, err := reqbuilder.NewBuilder().


+ 1
- 1
scanner/internal/event/check_package.go View File

@@ -29,7 +29,7 @@ func (t *CheckPackage) TryMerge(other Event) bool {

func (t *CheckPackage) Execute(execCtx ExecuteContext) {
log := logger.WithType[CheckPackage]("Event")
log.Debugf("begin with %v", logger.FormatStruct(t))
log.Debugf("begin with %v", logger.FormatStruct(t.CheckPackage))
defer log.Debugf("end")

// 检查对象是否没有被引用的时候,需要读取StoragePackage表


+ 1
- 1
scanner/internal/event/check_rep_count.go View File

@@ -38,7 +38,7 @@ func (t *CheckRepCount) TryMerge(other Event) bool {

func (t *CheckRepCount) Execute(execCtx ExecuteContext) {
log := logger.WithType[CheckRepCount]("Event")
log.Debugf("begin with %v", logger.FormatStruct(t))
log.Debugf("begin with %v", logger.FormatStruct(t.CheckRepCount))
defer log.Debugf("end")

mutex, err := reqbuilder.NewBuilder().


Loading…
Cancel
Save