diff options
| author | chrislu <chris.lu@gmail.com> | 2022-07-27 12:12:43 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-07-27 12:12:43 -0700 |
| commit | ca836568ac3df79373225bf6b98334e641194cfc (patch) | |
| tree | 5d59ed2ca76d52acc5c78c3ef76e5c643407038f /weed/replication/replicator.go | |
| parent | 3828b8ce87dd622f7a853d756a2b0fc0ac2caabc (diff) | |
| parent | b7e4e2677876ddd786516ffa312a9b3641f5c55e (diff) | |
| download | seaweedfs-ca836568ac3df79373225bf6b98334e641194cfc.tar.xz seaweedfs-ca836568ac3df79373225bf6b98334e641194cfc.zip | |
Merge branch 'master' of https://github.com/chrislusf/seaweedfs
Diffstat (limited to 'weed/replication/replicator.go')
| -rw-r--r-- | weed/replication/replicator.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/weed/replication/replicator.go b/weed/replication/replicator.go index eaab2c13e..8fee23b95 100644 --- a/weed/replication/replicator.go +++ b/weed/replication/replicator.go @@ -16,8 +16,9 @@ import ( ) type Replicator struct { - sink sink.ReplicationSink - source *source.FilerSource + sink sink.ReplicationSink + source *source.FilerSource + excludeDirs []string } func NewReplicator(sourceConfig util.Configuration, configPrefix string, dataSink sink.ReplicationSink) *Replicator { @@ -28,8 +29,9 @@ func NewReplicator(sourceConfig util.Configuration, configPrefix string, dataSin dataSink.SetSourceFiler(source) return &Replicator{ - sink: dataSink, - source: source, + sink: dataSink, + source: source, + excludeDirs: sourceConfig.GetStringSlice(configPrefix + "excludeDirectories"), } } @@ -41,6 +43,13 @@ func (r *Replicator) Replicate(ctx context.Context, key string, message *filer_p glog.V(4).Infof("skipping %v outside of %v", key, r.source.Dir) return nil } + for _, excludeDir := range r.excludeDirs { + if strings.HasPrefix(key, excludeDir) { + glog.V(4).Infof("skipping %v of exclude dir %v", key, excludeDir) + return nil + } + } + var dateKey string if r.sink.IsIncremental() { var mTime int64 |
