mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 08:46:54 +08:00
exclude directories to sync on filer
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user