plugins.PluginRegistry
plugins.PluginRegistry(specs=None, defaults=None, *, source=None)
The plugins this process knows about, and the instances it has open.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| specs | Mapping[str, PluginSpec] | None | Name -> spec. | None |
| defaults | Mapping[str, str] | None | Kind -> plugin name. | None |
| source | Path | None | Where the config came from, for error messages. | None |
Methods
| Name | Description |
|---|---|
| close | Close every open instance (tearing down spawned containers). |
| default_for | The plugin name filling kind. |
| for_kind | The (cached) plugin instance currently filling kind. |
| kinds | Registered plugin names grouped by kind. |
| names | Registered plugin names, sorted. |
| plugin | The (cached) plugin instance registered under name. |
| register | Add or replace a spec, closing any open instance under that name. |
| spec | The spec registered under name. |
| unregister | Remove a spec (and its default, and any open instance). |
| without | A copy of this registry with every plugin of kinds left out. |
close
plugins.PluginRegistry.close()
Close every open instance (tearing down spawned containers).
default_for
plugins.PluginRegistry.default_for(kind)
The plugin name filling kind.
Raises
| Name | Type | Description |
|---|---|---|
| KeyError | If no plugin declares that kind, if several do with no default set, or if the default names something unregistered. |
for_kind
plugins.PluginRegistry.for_kind(kind)
The (cached) plugin instance currently filling kind.
kinds
plugins.PluginRegistry.kinds()
Registered plugin names grouped by kind.
names
plugins.PluginRegistry.names()
Registered plugin names, sorted.
plugin
plugins.PluginRegistry.plugin(name)
The (cached) plugin instance registered under name.
register
plugins.PluginRegistry.register(spec, *, default=None)
Add or replace a spec, closing any open instance under that name.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| spec | PluginSpec | The spec to register. | required |
| default | bool | None | Make it the default for its kind (None: only when nothing else fills that kind yet). |
None |
spec
plugins.PluginRegistry.spec(name)
The spec registered under name.
Raises
| Name | Type | Description |
|---|---|---|
| KeyError | If nothing is registered under that name. |
unregister
plugins.PluginRegistry.unregister(name)
Remove a spec (and its default, and any open instance).
Returns
| Name | Type | Description |
|---|---|---|
| PluginSpec | None | The removed spec, or None if nothing was registered under |
|
| PluginSpec | None | name. |
without
plugins.PluginRegistry.without(kinds)
A copy of this registry with every plugin of kinds left out.
What :func:cadjoint.tier.absent installs so the public tier’s degraded behaviour can be exercised with the private providers still present in the process.