ISSUE 509 - feat: Add DeDi registry plugin implementation for lookup

This commit is contained in:
ameersohel45
2025-09-22 14:53:10 +05:30
parent de98c115b8
commit b385c18ee2
7 changed files with 871 additions and 0 deletions

View File

@@ -382,6 +382,27 @@ func (m *Manager) Registry(ctx context.Context, cfg *Config) (definition.Registr
return registry, nil
}
// DeDiRegistry returns a RegistryLookup instance based on the provided configuration.
// It reuses the loaded provider.
func (m *Manager) DeDiRegistry(ctx context.Context, cfg *Config) (definition.RegistryLookup, error) {
rp, err := provider[definition.RegistryLookupProvider](m.plugins, cfg.ID)
if err != nil {
return nil, fmt.Errorf("failed to load provider for %s: %w", cfg.ID, err)
}
registry, closer, err := rp.New(ctx, cfg.Config)
if err != nil {
return nil, err
}
if closer != nil {
m.closers = append(m.closers, func() {
if err := closer(); err != nil {
panic(err)
}
})
}
return registry, nil
}
// Validator implements handler.PluginManager.
func (m *Manager) Validator(ctx context.Context, cfg *Config) (definition.SchemaValidator, error) {
panic("unimplemented")