DimensionRecordStorageManager¶
-
class
lsst.daf.butler.registry.interfaces.
DimensionRecordStorageManager
(*, universe: DimensionUniverse)¶ Bases:
abc.ABC
An interface for managing the dimension records in a
Registry
.DimensionRecordStorageManager
primarily serves as a container and factory forDimensionRecordStorage
instances, which each provide access to the records for a differentDimensionElement
.Parameters: - universe :
DimensionUniverse
Universe of all dimensions and dimension elements known to the
Registry
.
Notes
In a multi-layer
Registry
, many dimension elements will only have records in one layer (often the base layer). The union of the records across all layers forms the logical table for the fullRegistry
.Methods Summary
clearCaches
()Clear any in-memory caches held by nested DimensionRecordStorage
instances.get
(element)Return an object that provides access to the records associated with the given element, if one exists in this layer. initialize
(db, context, *, universe)Construct an instance of the manager. refresh
()Ensure all other operations on this manager are aware of any dataset types that may have been registered by other clients since it was initialized or last refreshed. register
(element)Ensure that this layer can hold records for the given element, creating new tables as necessary. Methods Documentation
-
clearCaches
() → None¶ Clear any in-memory caches held by nested
DimensionRecordStorage
instances.This is called by
Registry
when transactions are rolled back, to avoid in-memory caches from ever containing records that are not present in persistent storage.
-
get
(element: DimensionElement) → Optional[DimensionRecordStorage]¶ Return an object that provides access to the records associated with the given element, if one exists in this layer.
Parameters: - element :
DimensionElement
Element for which records should be returned.
Returns: - records :
DimensionRecordStorage
orNone
The object representing the records for the given element in this layer, or
None
if there are no records for that element in this layer.
Notes
Dimension elements registered by another client of the same layer since the last call to
initialize
orrefresh
may not be found.- element :
-
classmethod
initialize
(db: Database, context: StaticTablesContext, *, universe: DimensionUniverse) → DimensionRecordStorageManager¶ 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.- universe :
DimensionUniverse
Universe graph containing dimensions known to this
Registry
.
Returns: - manager :
DimensionRecordStorageManager
An instance of a concrete
DimensionRecordStorageManager
subclass.
- db :
-
refresh
() → None¶ Ensure all other operations on this manager are aware of any dataset types that may have been registered by other clients since it was initialized or last refreshed.
-
register
(element: DimensionElement) → DimensionRecordStorage¶ Ensure that this layer can hold records for the given element, creating new tables as necessary.
Parameters: - element :
DimensionElement
Element for which a table should created (as necessary) and an associated
DimensionRecordStorage
returned.
Returns: - records :
DimensionRecordStorage
The object representing the records for the given element in this layer.
Raises: - TransactionInterruption
Raised if this operation is invoked within a
Database.transaction
context.
- element :
- universe :