mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 13:37:55 +08:00
grpc: watch metadata changes by directory
This commit is contained in:
@@ -223,6 +223,8 @@ func (fs *FilerServer) eachEventNotificationFn(req *filer_pb.SubscribeMetadataRe
|
||||
|
||||
if hasPrefixIn(fullpath, req.PathPrefixes) {
|
||||
// good
|
||||
} else if matchByDirectory(dirPath, req.Directories) {
|
||||
// good
|
||||
} else {
|
||||
if !strings.HasPrefix(fullpath, req.PathPrefix) {
|
||||
if eventNotification.NewParentPath != "" {
|
||||
@@ -263,6 +265,15 @@ func hasPrefixIn(text string, prefixes []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func matchByDirectory(dirPath string, directories []string) bool {
|
||||
for _, dir := range directories {
|
||||
if dirPath == dir {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (fs *FilerServer) addClient(clientType string, clientAddress string, clientId int32, clientEpoch int32) (alreadyKnown bool, clientName string) {
|
||||
clientName = clientType + "@" + clientAddress
|
||||
glog.V(0).Infof("+ listener %v", clientName)
|
||||
|
Reference in New Issue
Block a user