| @@ -104,7 +104,7 @@ func (t *AgentCheckStorage) Execute(execCtx ExecuteContext) { | |||||
| defer agentClient.Close() | defer agentClient.Close() | ||||
| evtmsg, err := agtmsg.NewPostEventBody( | evtmsg, err := agtmsg.NewPostEventBody( | ||||
| agtevt.NewCheckStorage(stg.Directory, isComplete, objects), | |||||
| agtevt.NewCheckStorage(stg.StorageID, stg.Directory, isComplete, objects), | |||||
| execCtx.Option.IsEmergency, // 继承本任务的执行选项 | execCtx.Option.IsEmergency, // 继承本任务的执行选项 | ||||
| execCtx.Option.DontMerge) | execCtx.Option.DontMerge) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -38,15 +38,18 @@ func (t *UpdateCache) Execute(execCtx ExecuteContext) { | |||||
| for _, entry := range t.Entries { | for _, entry := range t.Entries { | ||||
| switch entry.Operation { | 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) | err := mysql.Cache.DeleteTemp(execCtx.Args.DB.SQLCtx(), entry.FileHash, t.NodeID) | ||||
| if err != nil { | if err != nil { | ||||
| logger.WithField("FileHash", entry.FileHash). | logger.WithField("FileHash", entry.FileHash). | ||||
| WithField("NodeID", t.NodeID). | WithField("NodeID", t.NodeID). | ||||
| Warnf("delete temp cache failed, err: %s", err.Error()) | 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: | case evtcst.UPDATE_CACHE_CREATE_TEMP: | ||||
| err := mysql.Cache.CreateTemp(execCtx.Args.DB.SQLCtx(), entry.FileHash, t.NodeID) | err := mysql.Cache.CreateTemp(execCtx.Args.DB.SQLCtx(), entry.FileHash, t.NodeID) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -54,6 +57,10 @@ func (t *UpdateCache) Execute(execCtx ExecuteContext) { | |||||
| WithField("NodeID", t.NodeID). | WithField("NodeID", t.NodeID). | ||||
| Warnf("create temp cache failed, err: %s", err.Error()) | Warnf("create temp cache failed, err: %s", err.Error()) | ||||
| } | } | ||||
| logger.WithField("FileHash", entry.FileHash). | |||||
| WithField("NodeID", t.NodeID). | |||||
| Debugf("create temp cache") | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -12,9 +12,9 @@ type UpdateStorage struct { | |||||
| scevt.UpdateStorage | scevt.UpdateStorage | ||||
| } | } | ||||
| func NewUpdateStorage(dirState string, entries []UpdateStorageEntry) *UpdateStorage { | |||||
| func NewUpdateStorage(storageID int, dirState string, entries []UpdateStorageEntry) *UpdateStorage { | |||||
| return &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) | 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: | case tskcst.UPDATE_STORAGE_SET_NORMAL: | ||||
| err := mysql.StorageObject.SetStateNormal(execCtx.Args.DB.SQLCtx(), t.StorageID, entry.ObjectID, entry.UserID) | err := mysql.StorageObject.SetStateNormal(execCtx.Args.DB.SQLCtx(), t.StorageID, entry.ObjectID, entry.UserID) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -61,6 +66,11 @@ func (t *UpdateStorage) Execute(execCtx ExecuteContext) { | |||||
| WithField("ObjectID", entry.ObjectID). | WithField("ObjectID", entry.ObjectID). | ||||
| Warnf("change storage object state failed, err: %s", err.Error()) | 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() { | 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) | |||||
| }) | |||||
| } | } | ||||
| @@ -9,7 +9,7 @@ import ( | |||||
| type CheckCache struct { | type CheckCache struct { | ||||
| } | } | ||||
| func NewCheckUnavailableCache() *CheckCache { | |||||
| func NewCheckCache() *CheckCache { | |||||
| return &CheckCache{} | return &CheckCache{} | ||||
| } | } | ||||