Browse Source

解决编译问题

gitlink
Sydonian 2 years ago
parent
commit
8b90a57373
7 changed files with 9 additions and 16 deletions
  1. +1
    -2
      internal/event/check_cache.go
  2. +3
    -4
      internal/event/check_rep_count.go
  3. +1
    -2
      internal/tickevent/batch_all_agent_check_cache.go
  4. +1
    -2
      internal/tickevent/batch_check_all_object.go
  5. +1
    -2
      internal/tickevent/batch_check_all_storage.go
  6. +1
    -2
      internal/tickevent/check_agent_state.go
  7. +1
    -2
      internal/tickevent/check_cache.go

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

@@ -9,7 +9,6 @@ import (
"gitlink.org.cn/cloudream/common/consts" "gitlink.org.cn/cloudream/common/consts"
"gitlink.org.cn/cloudream/common/pkg/logger" "gitlink.org.cn/cloudream/common/pkg/logger"
"gitlink.org.cn/cloudream/db/model" "gitlink.org.cn/cloudream/db/model"
mysql "gitlink.org.cn/cloudream/db/sql"
scevt "gitlink.org.cn/cloudream/rabbitmq/message/scanner/event" scevt "gitlink.org.cn/cloudream/rabbitmq/message/scanner/event"
) )


@@ -40,7 +39,7 @@ func (t *CheckCache) Execute(execCtx ExecuteContext) {
log.Debugf("begin with %v", logger.FormatStruct(t)) log.Debugf("begin with %v", logger.FormatStruct(t))


err := execCtx.Args.DB.DoTx(sql.LevelSerializable, func(tx *sqlx.Tx) error { err := execCtx.Args.DB.DoTx(sql.LevelSerializable, func(tx *sqlx.Tx) error {
node, err := mysql.Node.GetByID(tx, t.NodeID)
node, err := execCtx.Args.DB.Node().GetByID(tx, t.NodeID)
if err == sql.ErrNoRows { if err == sql.ErrNoRows {
return nil return nil
} }


+ 3
- 4
internal/event/check_rep_count.go View File

@@ -14,7 +14,6 @@ import (
"gitlink.org.cn/cloudream/scanner/internal/config" "gitlink.org.cn/cloudream/scanner/internal/config"


"gitlink.org.cn/cloudream/db/model" "gitlink.org.cn/cloudream/db/model"
mysql "gitlink.org.cn/cloudream/db/sql"
scevt "gitlink.org.cn/cloudream/rabbitmq/message/scanner/event" scevt "gitlink.org.cn/cloudream/rabbitmq/message/scanner/event"
) )


@@ -68,12 +67,12 @@ func (t *CheckRepCount) checkOneRepCount(fileHash string, execCtx ExecuteContext


var updatedNodeIDs []int var updatedNodeIDs []int
err := execCtx.Args.DB.DoTx(sql.LevelSerializable, func(tx *sqlx.Tx) error { err := execCtx.Args.DB.DoTx(sql.LevelSerializable, func(tx *sqlx.Tx) error {
repMaxCnt, err := mysql.ObjectRep.GetFileMaxRepCount(tx, fileHash)
repMaxCnt, err := execCtx.Args.DB.ObjectRep().GetFileMaxRepCount(tx, fileHash)
if err != nil { if err != nil {
return fmt.Errorf("get file max rep count failed, err: %w", err) return fmt.Errorf("get file max rep count failed, err: %w", err)
} }


blkCnt, err := mysql.ObjectBlock.CountBlockWithHash(tx, fileHash)
blkCnt, err := execCtx.Args.DB.ObjectBlock().CountBlockWithHash(tx, fileHash)
if err != nil { if err != nil {
return fmt.Errorf("count block with hash failed, err: %w", err) return fmt.Errorf("count block with hash failed, err: %w", err)
} }
@@ -88,7 +87,7 @@ func (t *CheckRepCount) checkOneRepCount(fileHash string, execCtx ExecuteContext
return fmt.Errorf("get caching file nodes failed, err: %w", err) return fmt.Errorf("get caching file nodes failed, err: %w", err)
} }


allNodes, err := mysql.Node.GetAllNodes(tx)
allNodes, err := execCtx.Args.DB.Node().GetAllNodes(tx)
if err != nil { if err != nil {
return fmt.Errorf("get all nodes failed, err: %w", err) return fmt.Errorf("get all nodes failed, err: %w", err)
} }


+ 1
- 2
internal/tickevent/batch_all_agent_check_cache.go View File

@@ -4,7 +4,6 @@ import (
"github.com/samber/lo" "github.com/samber/lo"
"gitlink.org.cn/cloudream/common/pkg/logger" "gitlink.org.cn/cloudream/common/pkg/logger"
"gitlink.org.cn/cloudream/db/model" "gitlink.org.cn/cloudream/db/model"
mysql "gitlink.org.cn/cloudream/db/sql"
"gitlink.org.cn/cloudream/scanner/internal/event" "gitlink.org.cn/cloudream/scanner/internal/event"
) )


@@ -23,7 +22,7 @@ func (e *BatchAllAgentCheckCache) Execute(ctx ExecuteContext) {
log.Debugf("begin") log.Debugf("begin")


if e.nodeIDs == nil || len(e.nodeIDs) == 0 { if e.nodeIDs == nil || len(e.nodeIDs) == 0 {
nodes, err := mysql.Node.GetAllNodes(ctx.Args.DB.SQLCtx())
nodes, err := ctx.Args.DB.Node().GetAllNodes(ctx.Args.DB.SQLCtx())
if err != nil { if err != nil {
log.Warnf("get all nodes failed, err: %s", err.Error()) log.Warnf("get all nodes failed, err: %s", err.Error())
return return


+ 1
- 2
internal/tickevent/batch_check_all_object.go View File

@@ -3,7 +3,6 @@ package tickevent
import ( import (
"github.com/samber/lo" "github.com/samber/lo"
"gitlink.org.cn/cloudream/common/pkg/logger" "gitlink.org.cn/cloudream/common/pkg/logger"
mysql "gitlink.org.cn/cloudream/db/sql"
"gitlink.org.cn/cloudream/scanner/internal/event" "gitlink.org.cn/cloudream/scanner/internal/event"
) )


@@ -21,7 +20,7 @@ func (e *BatchCheckAllObject) Execute(ctx ExecuteContext) {
log := logger.WithType[BatchCheckAllObject]("TickEvent") log := logger.WithType[BatchCheckAllObject]("TickEvent")
log.Debugf("begin") log.Debugf("begin")


objectIDs, err := mysql.Object.BatchGetAllObjectIDs(ctx.Args.DB.SQLCtx(), e.lastCheckStart, CHECK_OBJECT_BATCH_SIZE)
objectIDs, err := ctx.Args.DB.Object().BatchGetAllObjectIDs(ctx.Args.DB.SQLCtx(), e.lastCheckStart, CHECK_OBJECT_BATCH_SIZE)
if err != nil { if err != nil {
log.Warnf("batch get object ids failed, err: %s", err.Error()) log.Warnf("batch get object ids failed, err: %s", err.Error())
return return


+ 1
- 2
internal/tickevent/batch_check_all_storage.go View File

@@ -2,7 +2,6 @@ package tickevent


import ( import (
"gitlink.org.cn/cloudream/common/pkg/logger" "gitlink.org.cn/cloudream/common/pkg/logger"
mysql "gitlink.org.cn/cloudream/db/sql"
"gitlink.org.cn/cloudream/scanner/internal/event" "gitlink.org.cn/cloudream/scanner/internal/event"
) )


@@ -20,7 +19,7 @@ func (e *BatchCheckAllStorage) Execute(ctx ExecuteContext) {
log := logger.WithType[BatchCheckAllStorage]("TickEvent") log := logger.WithType[BatchCheckAllStorage]("TickEvent")
log.Debugf("begin") log.Debugf("begin")


storageIDs, err := mysql.Storage.BatchGetAllStorageIDs(ctx.Args.DB.SQLCtx(), e.lastCheckStart, CHECK_STORAGE_BATCH_SIZE)
storageIDs, err := ctx.Args.DB.Storage().BatchGetAllStorageIDs(ctx.Args.DB.SQLCtx(), e.lastCheckStart, CHECK_STORAGE_BATCH_SIZE)
if err != nil { if err != nil {
log.Warnf("batch get storage ids failed, err: %s", err.Error()) log.Warnf("batch get storage ids failed, err: %s", err.Error())
return return


+ 1
- 2
internal/tickevent/check_agent_state.go View File

@@ -2,7 +2,6 @@ package tickevent


import ( import (
"gitlink.org.cn/cloudream/common/pkg/logger" "gitlink.org.cn/cloudream/common/pkg/logger"
mysql "gitlink.org.cn/cloudream/db/sql"
"gitlink.org.cn/cloudream/scanner/internal/event" "gitlink.org.cn/cloudream/scanner/internal/event"
) )


@@ -17,7 +16,7 @@ func (e *CheckAgentState) Execute(ctx ExecuteContext) {
log := logger.WithType[CheckAgentState]("TickEvent") log := logger.WithType[CheckAgentState]("TickEvent")
log.Debugf("begin") log.Debugf("begin")


nodes, err := mysql.Node.GetAllNodes(ctx.Args.DB.SQLCtx())
nodes, err := ctx.Args.DB.Node().GetAllNodes(ctx.Args.DB.SQLCtx())
if err != nil { if err != nil {
log.Warnf("get all nodes failed, err: %s", err.Error()) log.Warnf("get all nodes failed, err: %s", err.Error())
return return


+ 1
- 2
internal/tickevent/check_cache.go View File

@@ -2,7 +2,6 @@ package tickevent


import ( import (
"gitlink.org.cn/cloudream/common/pkg/logger" "gitlink.org.cn/cloudream/common/pkg/logger"
mysql "gitlink.org.cn/cloudream/db/sql"
"gitlink.org.cn/cloudream/scanner/internal/event" "gitlink.org.cn/cloudream/scanner/internal/event"
) )


@@ -17,7 +16,7 @@ func (e *CheckCache) Execute(ctx ExecuteContext) {
log := logger.WithType[CheckCache]("TickEvent") log := logger.WithType[CheckCache]("TickEvent")
log.Debugf("begin") log.Debugf("begin")


nodes, err := mysql.Node.GetAllNodes(ctx.Args.DB.SQLCtx())
nodes, err := ctx.Args.DB.Node().GetAllNodes(ctx.Args.DB.SQLCtx())
if err != nil { if err != nil {
log.Warnf("get all nodes failed, err: %s", err.Error()) log.Warnf("get all nodes failed, err: %s", err.Error())
return return


Loading…
Cancel
Save