You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
849 B

6 years ago
6 years ago
6 years ago
6 years ago
  1. package filer2
  2. import (
  3. "github.com/chrislusf/seaweedfs/weed/glog"
  4. "github.com/chrislusf/seaweedfs/weed/notification"
  5. "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
  6. )
  7. func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool) {
  8. var key string
  9. if oldEntry != nil {
  10. key = string(oldEntry.FullPath)
  11. } else if newEntry != nil {
  12. key = string(newEntry.FullPath)
  13. } else {
  14. return
  15. }
  16. if notification.Queue != nil {
  17. glog.V(3).Infof("notifying entry update %v", key)
  18. newParentPath := ""
  19. if newEntry != nil {
  20. newParentPath, _ = newEntry.FullPath.DirAndName()
  21. }
  22. notification.Queue.SendMessage(
  23. key,
  24. &filer_pb.EventNotification{
  25. OldEntry: oldEntry.ToProtoEntry(),
  26. NewEntry: newEntry.ToProtoEntry(),
  27. DeleteChunks: deleteChunks,
  28. NewParentPath: newParentPath,
  29. },
  30. )
  31. }
  32. }