diff options
| author | chrislu <chris.lu@gmail.com> | 2022-09-20 09:25:18 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-09-20 09:25:18 -0700 |
| commit | b90d92fca91b21c8b0cd2bc468af5c4e5f06d5c3 (patch) | |
| tree | fe9ddf0d855a2d8532974af3eabd0ff41765bca4 /weed/server/filer_grpc_server_sub_meta.go | |
| parent | b463ca1a2f514248f20e06a3c5e1fda6fbef7d9e (diff) | |
| download | seaweedfs-b90d92fca91b21c8b0cd2bc468af5c4e5f06d5c3.tar.xz seaweedfs-b90d92fca91b21c8b0cd2bc468af5c4e5f06d5c3.zip | |
grpc: watch metadata changes by directory
Diffstat (limited to 'weed/server/filer_grpc_server_sub_meta.go')
| -rw-r--r-- | weed/server/filer_grpc_server_sub_meta.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/server/filer_grpc_server_sub_meta.go b/weed/server/filer_grpc_server_sub_meta.go index 03f4f4281..bd24ab54f 100644 --- a/weed/server/filer_grpc_server_sub_meta.go +++ b/weed/server/filer_grpc_server_sub_meta.go @@ -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) |
