services/introspection: support to show introspection grpc service
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
This commit is contained in:
@@ -132,9 +132,19 @@ func (ps *Set) Get(t Type) (interface{}, error) {
|
||||
return nil, fmt.Errorf("no plugins registered for %s: %w", t, errdefs.ErrNotFound)
|
||||
}
|
||||
|
||||
// GetAll returns all initialized plugins
|
||||
func (ps *Set) GetAll() []*Plugin {
|
||||
return ps.ordered
|
||||
}
|
||||
|
||||
// Plugins returns plugin set
|
||||
func (i *InitContext) Plugins() *Set {
|
||||
return i.plugins
|
||||
}
|
||||
|
||||
// GetAll plugins in the set
|
||||
func (i *InitContext) GetAll() []*Plugin {
|
||||
return i.plugins.ordered
|
||||
return i.plugins.GetAll()
|
||||
}
|
||||
|
||||
// GetByID returns the plugin of the given type and ID
|
||||
|
||||
@@ -177,6 +177,25 @@ func checkUnique(r *Registration) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AreRegisteredPluginsInitialized returns all registered plugins are initialized
|
||||
func AreRegisteredPluginsInitialized(plugins *Set) bool {
|
||||
if len(register.r) != len(plugins.ordered) {
|
||||
return false
|
||||
}
|
||||
for _, reg := range register.r {
|
||||
byID, typeok := plugins.byTypeAndID[reg.Type]
|
||||
if !typeok {
|
||||
return false
|
||||
}
|
||||
|
||||
if _, ok := byID[reg.ID]; !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// DisableFilter filters out disabled plugins
|
||||
type DisableFilter func(r *Registration) bool
|
||||
|
||||
|
||||
Reference in New Issue
Block a user