mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adjust sink options
This commit is contained in:
parent
402ab598b6
commit
01ceace18e
|
@ -162,6 +162,9 @@ topic = "seaweedfs_filer1_to_filer2"
|
||||||
enabled = true
|
enabled = true
|
||||||
grpcAddress = "localhost:18888"
|
grpcAddress = "localhost:18888"
|
||||||
directory = "/backup" # all replicated files are under this directory tree
|
directory = "/backup" # all replicated files are under this directory tree
|
||||||
|
replication = ""
|
||||||
|
collection = ""
|
||||||
|
ttlSec = 0
|
||||||
|
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
|
|
@ -43,7 +43,7 @@ func (r *Replicator) Replicate(key string, message *filer_pb.EventNotification)
|
||||||
if !strings.HasPrefix(key, r.source.Dir) {
|
if !strings.HasPrefix(key, r.source.Dir) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
key = r.sink.GetDirectory() + key[len(r.source.Dir):]
|
key = r.sink.GetSinkToDirectory() + key[len(r.source.Dir):]
|
||||||
if message.OldEntry != nil && message.NewEntry == nil {
|
if message.OldEntry != nil && message.NewEntry == nil {
|
||||||
return r.sink.DeleteEntry(key, message.OldEntry, message.DeleteChunks)
|
return r.sink.DeleteEntry(key, message.OldEntry, message.DeleteChunks)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,21 +15,21 @@ type ReplicationSink interface {
|
||||||
DeleteEntry(key string, entry *filer_pb.Entry, deleteIncludeChunks bool) error
|
DeleteEntry(key string, entry *filer_pb.Entry, deleteIncludeChunks bool) error
|
||||||
CreateEntry(key string, entry *filer_pb.Entry) error
|
CreateEntry(key string, entry *filer_pb.Entry) error
|
||||||
UpdateEntry(key string, oldEntry, newEntry *filer_pb.Entry, deleteIncludeChunks bool) error
|
UpdateEntry(key string, oldEntry, newEntry *filer_pb.Entry, deleteIncludeChunks bool) error
|
||||||
GetDirectory() string
|
GetSinkToDirectory() string
|
||||||
SetSourceFiler(s *source.FilerSource)
|
SetSourceFiler(s *source.FilerSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
type FilerSink struct {
|
type FilerSink struct {
|
||||||
|
filerSource *source.FilerSource
|
||||||
grpcAddress string
|
grpcAddress string
|
||||||
dir string
|
dir string
|
||||||
filerSource *source.FilerSource
|
|
||||||
replication string
|
replication string
|
||||||
collection string
|
collection string
|
||||||
ttlSec int32
|
ttlSec int32
|
||||||
dataCenter string
|
dataCenter string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *FilerSink) GetDirectory() string {
|
func (fs *FilerSink) GetSinkToDirectory() string {
|
||||||
return fs.dir
|
return fs.dir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ func (fs *FilerSink) Initialize(configuration util.Configuration) error {
|
||||||
return fs.initialize(
|
return fs.initialize(
|
||||||
configuration.GetString("grpcAddress"),
|
configuration.GetString("grpcAddress"),
|
||||||
configuration.GetString("directory"),
|
configuration.GetString("directory"),
|
||||||
|
configuration.GetString("replication"),
|
||||||
|
configuration.GetString("collection"),
|
||||||
|
configuration.GetInt("ttlSec"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +47,13 @@ func (fs *FilerSink) SetSourceFiler(s *source.FilerSource) {
|
||||||
fs.filerSource = s
|
fs.filerSource = s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *FilerSink) initialize(grpcAddress string, dir string) (err error) {
|
func (fs *FilerSink) initialize(grpcAddress string, dir string,
|
||||||
|
replication string, collection string, ttlSec int) (err error) {
|
||||||
fs.grpcAddress = grpcAddress
|
fs.grpcAddress = grpcAddress
|
||||||
fs.dir = dir
|
fs.dir = dir
|
||||||
|
fs.replication = replication
|
||||||
|
fs.collection = collection
|
||||||
|
fs.ttlSec = int32(ttlSec)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue