2018-08-13 16:20:49 +08:00
|
|
|
package filer2
|
|
|
|
|
|
|
|
import (
|
2018-09-21 16:56:43 +08:00
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
2018-09-16 16:18:30 +08:00
|
|
|
"github.com/chrislusf/seaweedfs/weed/notification"
|
2018-08-13 16:20:49 +08:00
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
|
|
|
)
|
|
|
|
|
2018-09-17 15:27:56 +08:00
|
|
|
func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool) {
|
2018-08-13 16:20:49 +08:00
|
|
|
var key string
|
|
|
|
if oldEntry != nil {
|
|
|
|
key = string(oldEntry.FullPath)
|
|
|
|
} else if newEntry != nil {
|
|
|
|
key = string(newEntry.FullPath)
|
|
|
|
} else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-09-16 16:18:30 +08:00
|
|
|
if notification.Queue != nil {
|
2018-08-13 16:33:21 +08:00
|
|
|
|
2018-09-17 02:20:36 +08:00
|
|
|
glog.V(3).Infof("notifying entry update %v", key)
|
|
|
|
|
2018-09-16 16:18:30 +08:00
|
|
|
notification.Queue.SendMessage(
|
2018-08-13 16:33:21 +08:00
|
|
|
key,
|
|
|
|
&filer_pb.EventNotification{
|
2018-11-04 03:43:45 +08:00
|
|
|
OldEntry: oldEntry.ToProtoEntry(),
|
|
|
|
NewEntry: newEntry.ToProtoEntry(),
|
2018-09-17 15:27:56 +08:00
|
|
|
DeleteChunks: deleteChunks,
|
2018-08-13 16:33:21 +08:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
2018-08-13 16:20:49 +08:00
|
|
|
}
|