mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-12 12:16:37 +08:00
Add best exit selection (#486)
* docs: add best exit selection design * feat: add best exit selection
This commit is contained in:
@@ -12,10 +12,25 @@ type chainRegistry struct {
|
||||
registry[chain.Chainer]
|
||||
}
|
||||
|
||||
func ReplaceChain(name string, v chain.Chainer) error {
|
||||
if name == "" {
|
||||
return nil
|
||||
}
|
||||
if r, ok := chainReg.(*chainRegistry); ok {
|
||||
r.replace(name, v)
|
||||
return nil
|
||||
}
|
||||
return chainReg.Register(name, v)
|
||||
}
|
||||
|
||||
func (r *chainRegistry) Register(name string, v chain.Chainer) error {
|
||||
return r.registry.Register(name, v)
|
||||
}
|
||||
|
||||
func (r *chainRegistry) replace(name string, v chain.Chainer) {
|
||||
r.m.Store(name, v)
|
||||
}
|
||||
|
||||
func (r *chainRegistry) Get(name string) chain.Chainer {
|
||||
if name != "" {
|
||||
return &chainWrapper{name: name, r: r}
|
||||
|
||||
Reference in New Issue
Block a user