Plugins: Move alias support to plugin json (but still hardcoded) (#75129)

This commit is contained in:
Ryan McKinley
2023-09-29 08:20:37 -07:00
committed by GitHub
parent e45867c635
commit 010b2461b9
16 changed files with 90 additions and 53 deletions
+6 -4
View File
@@ -48,8 +48,8 @@ func (i *InMemory) Add(_ context.Context, p *plugins.Plugin) error {
i.mu.Lock()
i.store[p.ID] = p
if p.Alias != "" {
i.alias[p.Alias] = p
for _, a := range p.AliasIDs {
i.alias[a] = p
}
i.mu.Unlock()
@@ -64,8 +64,10 @@ func (i *InMemory) Remove(_ context.Context, pluginID string) error {
i.mu.Lock()
delete(i.store, pluginID)
if p != nil && p.Alias != "" {
delete(i.alias, p.Alias)
if p != nil {
for _, a := range p.AliasIDs {
delete(i.alias, a)
}
}
i.mu.Unlock()