aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-25 00:54:16 -0800
committerchrislu <chris.lu@gmail.com>2022-02-25 00:54:16 -0800
commit91d6785cf3d6233ac7fc5f77c29b549dbd7da610 (patch)
tree8329b12905c0eac2b859f59a461f192d4b43bc42
parentbe3fc7739161a29e57ae1481358656af385b1002 (diff)
downloadseaweedfs-91d6785cf3d6233ac7fc5f77c29b549dbd7da610.tar.xz
seaweedfs-91d6785cf3d6233ac7fc5f77c29b549dbd7da610.zip
define metadata action types
-rw-r--r--weed/pb/filer_pb/filer_pb_helper.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/pb/filer_pb/filer_pb_helper.go b/weed/pb/filer_pb/filer_pb_helper.go
index b00d412e1..052b09531 100644
--- a/weed/pb/filer_pb/filer_pb_helper.go
+++ b/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{})