From 442e092995011653f2ed2f2b1b83bf4777a35c26 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 14 Nov 2020 14:26:08 -0800 Subject: [PATCH] filer watch "/etc" folder for configuration changes --- weed/filer/filer_on_meta_event.go | 21 +++++++++++++++++++++ weed/filer/meta_aggregator.go | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 weed/filer/filer_on_meta_event.go diff --git a/weed/filer/filer_on_meta_event.go b/weed/filer/filer_on_meta_event.go new file mode 100644 index 000000000..70b62a974 --- /dev/null +++ b/weed/filer/filer_on_meta_event.go @@ -0,0 +1,21 @@ +package filer + +import ( + "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" +) + +const ( + DirectoryEtc = "/etc" +) + +// onMetadataChangeEvent is triggered after filer processed change events from local or remote filers +func (f *Filer) onMetadataChangeEvent(event *filer_pb.SubscribeMetadataResponse) { + if DirectoryEtc != event.Directory { + return + } + + glog.V(0).Infof("procesing %v", event) + + +} diff --git a/weed/filer/meta_aggregator.go b/weed/filer/meta_aggregator.go index b90457339..9437e9992 100644 --- a/weed/filer/meta_aggregator.go +++ b/weed/filer/meta_aggregator.go @@ -141,6 +141,9 @@ func (ma *MetaAggregator) subscribeToOneFiler(f *Filer, self string, peer string return fmt.Errorf("process %v: %v", resp, err) } lastTsNs = resp.TsNs + + f.onMetadataChangeEvent(resp) + } }) if err != nil {