filer conf: delete location specific configuration

This commit is contained in:
Chris Lu
2020-11-15 20:15:47 -08:00
parent 2bd6fd3bbe
commit ee2fa14dbe
3 changed files with 46 additions and 5 deletions

View File

@@ -82,6 +82,18 @@ func (fc *FilerConf) AddLocationConf(locConf *filer_pb.FilerConf_PathConf) (err
return
}
func (fc *FilerConf) DeleteLocationConf(locationPrefix string) {
rules := ptrie.New()
fc.rules.Walk(func(key []byte, value interface{}) bool {
if string(key) == locationPrefix {
return true
}
rules.Put(key, value)
return true
})
fc.rules = rules
return
}
var (
EmptyFilerConfPathConf = &filer_pb.FilerConf_PathConf{}
@@ -110,4 +122,4 @@ func (fc *FilerConf) ToProto() *filer_pb.FilerConf {
func (fc *FilerConf) ToText(writer io.Writer) error {
return proto.MarshalText(writer, fc.ToProto())
}
}