mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 14:27:23 +08:00
support follow additional path prefixes
This commit is contained in:
@@ -201,14 +201,18 @@ func (fs *FilerServer) eachEventNotificationFn(req *filer_pb.SubscribeMetadataRe
|
||||
return nil
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(fullpath, req.PathPrefix) {
|
||||
if eventNotification.NewParentPath != "" {
|
||||
newFullPath := util.Join(eventNotification.NewParentPath, entryName)
|
||||
if !strings.HasPrefix(newFullPath, req.PathPrefix) {
|
||||
if hasPrefixIn(fullpath, req.PathPrefixes) {
|
||||
// good
|
||||
}else {
|
||||
if !strings.HasPrefix(fullpath, req.PathPrefix) {
|
||||
if eventNotification.NewParentPath != "" {
|
||||
newFullPath := util.Join(eventNotification.NewParentPath, entryName)
|
||||
if !strings.HasPrefix(newFullPath, req.PathPrefix) {
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,6 +231,15 @@ func (fs *FilerServer) eachEventNotificationFn(req *filer_pb.SubscribeMetadataRe
|
||||
}
|
||||
}
|
||||
|
||||
func hasPrefixIn(text string, prefixes []string) bool {
|
||||
for _, p := range prefixes {
|
||||
if strings.HasPrefix(text, p) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (fs *FilerServer) addClient(clientType string, clientAddress string) (clientName string) {
|
||||
clientName = clientType + "@" + clientAddress
|
||||
glog.V(0).Infof("+ listener %v", clientName)
|
||||
|
Reference in New Issue
Block a user