diff --git a/internal/event/agent_check_storage.go b/internal/event/agent_check_storage.go index 837656a..358e30e 100644 --- a/internal/event/agent_check_storage.go +++ b/internal/event/agent_check_storage.go @@ -104,7 +104,7 @@ func (t *AgentCheckStorage) Execute(execCtx ExecuteContext) { defer agentClient.Close() evtmsg, err := agtmsg.NewPostEventBody( - agtevt.NewCheckStorage(stg.Directory, isComplete, objects), + agtevt.NewCheckStorage(stg.StorageID, stg.Directory, isComplete, objects), execCtx.Option.IsEmergency, // 继承本任务的执行选项 execCtx.Option.DontMerge) if err != nil { diff --git a/internal/event/update_cache.go b/internal/event/update_cache.go index 22a2283..0a03e69 100644 --- a/internal/event/update_cache.go +++ b/internal/event/update_cache.go @@ -38,15 +38,18 @@ func (t *UpdateCache) Execute(execCtx ExecuteContext) { for _, entry := range t.Entries { switch entry.Operation { - case evtcst.UPDATE_CACHE_UNTEMP: + case evtcst.UPDATE_CACHE_DELETE_TEMP: err := mysql.Cache.DeleteTemp(execCtx.Args.DB.SQLCtx(), entry.FileHash, t.NodeID) - if err != nil { logger.WithField("FileHash", entry.FileHash). WithField("NodeID", t.NodeID). Warnf("delete temp cache failed, err: %s", err.Error()) } + logger.WithField("FileHash", entry.FileHash). + WithField("NodeID", t.NodeID). + Debugf("delete temp cache") + case evtcst.UPDATE_CACHE_CREATE_TEMP: err := mysql.Cache.CreateTemp(execCtx.Args.DB.SQLCtx(), entry.FileHash, t.NodeID) if err != nil { @@ -54,6 +57,10 @@ func (t *UpdateCache) Execute(execCtx ExecuteContext) { WithField("NodeID", t.NodeID). Warnf("create temp cache failed, err: %s", err.Error()) } + + logger.WithField("FileHash", entry.FileHash). + WithField("NodeID", t.NodeID). + Debugf("create temp cache") } } } diff --git a/internal/event/update_storage.go b/internal/event/update_storage.go index e55305c..aeedb36 100644 --- a/internal/event/update_storage.go +++ b/internal/event/update_storage.go @@ -12,9 +12,9 @@ type UpdateStorage struct { scevt.UpdateStorage } -func NewUpdateStorage(dirState string, entries []UpdateStorageEntry) *UpdateStorage { +func NewUpdateStorage(storageID int, dirState string, entries []UpdateStorageEntry) *UpdateStorage { return &UpdateStorage{ - UpdateStorage: scevt.NewUpdateStorage(dirState, entries), + UpdateStorage: scevt.NewUpdateStorage(storageID, dirState, entries), } } @@ -54,6 +54,11 @@ func (t *UpdateStorage) Execute(execCtx ExecuteContext) { } chkObjIDs = append(chkObjIDs, entry.ObjectID) + logger.WithField("StorageID", t.StorageID). + WithField("ObjectID", entry.ObjectID). + WithField("UserID", entry.UserID). + Debugf("delete storage object") + case tskcst.UPDATE_STORAGE_SET_NORMAL: err := mysql.StorageObject.SetStateNormal(execCtx.Args.DB.SQLCtx(), t.StorageID, entry.ObjectID, entry.UserID) if err != nil { @@ -61,6 +66,11 @@ func (t *UpdateStorage) Execute(execCtx ExecuteContext) { WithField("ObjectID", entry.ObjectID). Warnf("change storage object state failed, err: %s", err.Error()) } + + logger.WithField("StorageID", t.StorageID). + WithField("ObjectID", entry.ObjectID). + WithField("UserID", entry.UserID). + Debugf("set storage object normal") } } @@ -70,5 +80,7 @@ func (t *UpdateStorage) Execute(execCtx ExecuteContext) { } func init() { - RegisterMessageConvertor(func(msg scevt.UpdateStorage) Event { return NewUpdateStorage(msg.DirectoryState, msg.Entries) }) + RegisterMessageConvertor(func(msg scevt.UpdateStorage) Event { + return NewUpdateStorage(msg.StorageID, msg.DirectoryState, msg.Entries) + }) } diff --git a/internal/tickevent/check_cache.go b/internal/tickevent/check_cache.go index c03651b..c5037eb 100644 --- a/internal/tickevent/check_cache.go +++ b/internal/tickevent/check_cache.go @@ -9,7 +9,7 @@ import ( type CheckCache struct { } -func NewCheckUnavailableCache() *CheckCache { +func NewCheckCache() *CheckCache { return &CheckCache{} }