Browse Source

define metadata action types

original_weed_mount
chrislu 3 years ago
parent
commit
91d6785cf3
  1. 6
      weed/pb/filer_pb/filer_pb_helper.go

6
weed/pb/filer_pb/filer_pb_helper.go

@ -142,7 +142,8 @@ func IsCreate(event *SubscribeMetadataResponse) bool {
func IsUpdate(event *SubscribeMetadataResponse) bool {
return event.EventNotification.NewEntry != nil &&
event.EventNotification.OldEntry != nil &&
event.Directory == event.EventNotification.NewParentPath
event.Directory == event.EventNotification.NewParentPath &&
event.EventNotification.NewEntry.Name == event.EventNotification.OldEntry.Name
}
func IsDelete(event *SubscribeMetadataResponse) bool {
return event.EventNotification.NewEntry == nil && event.EventNotification.OldEntry != nil
@ -150,7 +151,8 @@ func IsDelete(event *SubscribeMetadataResponse) bool {
func IsRename(event *SubscribeMetadataResponse) bool {
return event.EventNotification.NewEntry != nil &&
event.EventNotification.OldEntry != nil &&
event.Directory != event.EventNotification.NewParentPath
(event.Directory != event.EventNotification.NewParentPath ||
event.EventNotification.NewEntry.Name != event.EventNotification.OldEntry.Name)
}
var _ = ptrie.KeyProvider(&FilerConf_PathConf{})

Loading…
Cancel
Save