VersionedExtension¶
- class lsst.daf.butler.registry.interfaces.VersionedExtension(*, registry_schema_version: VersionTuple | None = None)¶
Bases:
ABCInterface for extension classes with versions.
- Parameters:
- registry_schema_version
VersionTupleorNone Schema version of this extension as defined in registry. If
None, it means that registry schema was not initialized yet and the extension should expect that schema version returned bynewSchemaVersionmethod will be used to initialize the registry database. If notNone, it is guaranteed that this version has passed compatibility check.
- registry_schema_version
Methods Summary
checkCompatibility(registry_schema_version, ...)Check that schema version defined in registry is compatible with current implementation.
checkNewSchemaVersion(schema_version)Verify that requested schema version can be created by an extension.
Return schema version(s) supported by this extension class.
Return full name of the extension.
Return schema version for newly created registry.
Methods Documentation
- classmethod checkCompatibility(registry_schema_version: VersionTuple, update: bool) None¶
Check that schema version defined in registry is compatible with current implementation.
- Parameters:
- registry_schema_version
VersionTuple Schema version that exists in registry or defined in a configuration for a registry to be created.
- update
bool If True then read-write access is expected.
- registry_schema_version
- Raises:
- IncompatibleVersionError
Raised if schema version is not supported by implementation.
Notes
Default implementation uses
VersionTuple.checkCompatibilityon the versions returned fromcurrentVersionsmethod. Subclasses that support different compatibility model will overwrite this method.
- classmethod checkNewSchemaVersion(schema_version: VersionTuple) None¶
Verify that requested schema version can be created by an extension.
- Parameters:
- schema_version
VersionTuple Schema version that this extension is asked to create.
- schema_version
Notes
This method may be used only occasionally when a specific schema version is given in a regisitry config file. This can be used with an extension that supports multiple schem versions to make it create new schema with a non-default version number. Default implementation compares requested version with one of the version returned from
currentVersions.
- abstract classmethod currentVersions() list[lsst.daf.butler.registry.interfaces._versioning.VersionTuple]¶
Return schema version(s) supported by this extension class.
- Returns:
- version
list[VersionTuple] Schema versions for this extension. Empty list is returned if an extension does not require its version to be saved or checked.
- version
- classmethod extensionName() str¶
Return full name of the extension.
This name should match the name defined in registry configuration. It is also stored in registry attributes. Default implementation returns full class name.
- Returns:
- name
str Full extension name.
- name
- newSchemaVersion() VersionTuple | None¶
Return schema version for newly created registry.
- Returns:
- version
VersionTupleorNone Schema version created by this extension.
Noneis returned if an extension does not require its version to be saved or checked.
- version
Notes
Default implementation only forks for extensions that support single schema version and it returns version obtained from
currentVersions. IfcurrentVersionsreturns multiple version then default implementation will raise an exception and the method has to be reimplemented by a subclass.