DatastoreRegistryBridgeManager¶
- class lsst.daf.butler.registry.interfaces.DatastoreRegistryBridgeManager(*, opaque: OpaqueTableStorageManager, universe: DimensionUniverse, datasetIdColumnType: type, registry_schema_version: VersionTuple | None = None)¶
Bases:
VersionedExtensionAn abstract base class that defines the interface between
RegistryandDatastorewhen a newDatastoreis constructed.- Parameters:
- opaque
OpaqueTableStorageManager Manager object for opaque table storage in the
Registry.- universe
DimensionUniverse All dimensions know to the
Registry.- datasetIdColumnType
type Type for dataset ID column.
- opaque
Notes
Datastores are passed an instance of
DatastoreRegistryBridgeManagerat construction, and should use it to obtain and keep any of the following:a
DatastoreRegistryBridgeinstance to record in theRegistrywhat is present in the datastore (needed by all datastores that are not just forwarders);one or more
OpaqueTableStorageinstance if they wish to store internal records in theRegistrydatabase;the
DimensionUniverse, if they need it to (e.g.) construct or validate filename templates.
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.
clsNewSchemaVersion(schema_version)Class method which returns schema version to use for newly created registry database.
Return schema version(s) supported by this extension class.
Return full name of the extension.
findDatastores(ref)Retrieve datastore locations for a given dataset.
initialize(db, context, *, opaque, datasets, ...)Construct an instance of the manager.
Return schema version for newly created registry.
refresh()Ensure all other operations on this manager are aware of any collections that may have been registered by other clients since it was initialized or last refreshed.
register(name, *[, ephemeral])Register a new
Datastoreassociated with thisRegistry.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.
- classmethod clsNewSchemaVersion(schema_version: VersionTuple | None) VersionTuple | None¶
Class method which returns schema version to use for newly created registry database.
- Parameters:
- schema_version
VersionTupleorNone Configured schema version or
Noneif default schema version should be created. If notNonethen it is guaranteed to be compatible withcurrentVersions.
- schema_version
- 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 of this method can work in simple cases. If the extension only supports single schema version than that version is returned. If the extension supports multiple schema versions and
schema_versionis notNonethenschema_versionis returned. If the extension supports multiple schema versions, butschema_versionisNoneit calls_newDefaultSchemaVersionmethod which needs to be reimplemented in a subsclass.
- 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
- abstract findDatastores(ref: DatasetRef | FakeDatasetRef) Iterable[str]¶
Retrieve datastore locations for a given dataset.
- abstract classmethod initialize(db: Database, context: StaticTablesContext, *, opaque: OpaqueTableStorageManager, datasets: Type[DatasetRecordStorageManager], universe: DimensionUniverse, registry_schema_version: VersionTuple | None = None) DatastoreRegistryBridgeManager¶
Construct an instance of the manager.
- Parameters:
- db
Database Interface to the underlying database engine and namespace.
- context
StaticTablesContext Context object obtained from
Database.declareStaticTables; used to declare any tables that should always be present in a layer implemented with this manager.- opaque
OpaqueTableStorageManager Registry manager object for opaque (to Registry) tables, provided to allow Datastores to store their internal information inside the Registry database.
- datasetssubclass of
DatasetRecordStorageManager Concrete class that will be used to manage the core dataset tables in this registry; should be used only to create foreign keys to those tables.
- universe
DimensionUniverse All dimensions known to the registry.
- registry_schema_version
VersionTupleorNone Schema version of this extension as defined in registry.
- db
- Returns:
- manager
DatastoreRegistryBridgeManager An instance of a concrete
DatastoreRegistryBridgeManagersubclass.
- manager
- 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
Extension classes that support multiple schema versions need to override
_newDefaultSchemaVersionmethod.
- abstract refresh() None¶
Ensure all other operations on this manager are aware of any collections that may have been registered by other clients since it was initialized or last refreshed.
- abstract register(name: str, *, ephemeral: bool = True) DatastoreRegistryBridge¶
Register a new
Datastoreassociated with thisRegistry.This method should be called by all
Datastoreclasses aside from those that only forward storage to other datastores.- Parameters:
- Returns:
- bridge
DatastoreRegistryBridge Object that provides the interface this
Datastoreshould use to communicate with theRegistry.
- bridge