mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add reference implementation to detect create/update/delete/rename events
This commit is contained in:
parent
0fc9ffc603
commit
68043cfcac
|
@ -121,3 +121,20 @@ func LookupEntry(client SeaweedFilerClient, request *LookupDirectoryEntryRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrNotFound = errors.New("filer: no entry is found in filer store")
|
var ErrNotFound = errors.New("filer: no entry is found in filer store")
|
||||||
|
|
||||||
|
func IsCreate(event *SubscribeMetadataResponse) bool {
|
||||||
|
return event.EventNotification.NewEntry != nil && event.EventNotification.OldEntry == nil
|
||||||
|
}
|
||||||
|
func IsUpdate(event *SubscribeMetadataResponse) bool {
|
||||||
|
return event.EventNotification.NewEntry != nil &&
|
||||||
|
event.EventNotification.OldEntry != nil &&
|
||||||
|
event.Directory == event.EventNotification.NewParentPath
|
||||||
|
}
|
||||||
|
func IsDelete(event *SubscribeMetadataResponse) bool {
|
||||||
|
return event.EventNotification.NewEntry == nil && event.EventNotification.OldEntry != nil
|
||||||
|
}
|
||||||
|
func IsRename(event *SubscribeMetadataResponse) bool {
|
||||||
|
return event.EventNotification.NewEntry != nil &&
|
||||||
|
event.EventNotification.OldEntry != nil &&
|
||||||
|
event.Directory != event.EventNotification.NewParentPath
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue