DatastoreRegistryBridge¶
-
class
lsst.daf.butler.registry.interfaces.DatastoreRegistryBridge(datastoreName: str)¶ Bases:
abc.ABCAn abstract base class that defines the interface that a
Datastoreuses to communicate with aRegistry.Parameters: - datastoreName :
str Name of the
Datastoreas it should appear inRegistrytables referencing it.
Methods Summary
check(refs, …)Check which refs are listed for this datastore. emptyTrash()Retrieve all the dataset ref IDs that are in the trash associated for this datastore, and then remove them if the context exists without an exception being raised. insert(refs, …)Record that a datastore holds the given datasets. moveToTrash(refs, …)Move dataset location information to trash. Methods Documentation
-
check(refs: Iterable[Union[lsst.daf.butler.core.datasets.ref.DatasetRef, lsst.daf.butler.registry.interfaces._bridge.FakeDatasetRef]]) → Iterable[Union[lsst.daf.butler.core.datasets.ref.DatasetRef, lsst.daf.butler.registry.interfaces._bridge.FakeDatasetRef]]¶ Check which refs are listed for this datastore.
Parameters: - refs :
IterableofDatasetIdRef References to the datasets.
Returns: - present :
Iterable[DatasetIdRef] Datasets from
refsthat are recorded as being in this datastore.
Raises: - AmbiguousDatasetError
Raised if
any(ref.id is None for ref in refs).
- refs :
-
emptyTrash() → AbstractContextManager[Iterable[Union[lsst.daf.butler.core.datasets.ref.DatasetRef, lsst.daf.butler.registry.interfaces._bridge.FakeDatasetRef]]]¶ Retrieve all the dataset ref IDs that are in the trash associated for this datastore, and then remove them if the context exists without an exception being raised.
Returns: - ids :
setofDatasetIdRef The IDs of datasets that can be safely removed from this datastore. Can be empty.
Notes
The object yielded by the context manager may be a single-pass iterator. If multiple passes are required, it should be converted to a
listor other container.Datastores should never raise (except perhaps in testing) when an artifact cannot be removed only because it is already gone - this condition is an unavoidable outcome of concurrent delete operations, and must not be considered and error for those to be safe.
Examples
Typical usage by a Datastore is something like:
with self.bridge.emptyTrash() as iter: for ref in iter: # Remove artifacts associated with ref.id, # raise an exception if something goes wrong.
- ids :
-
insert(refs: Iterable[Union[lsst.daf.butler.core.datasets.ref.DatasetRef, lsst.daf.butler.registry.interfaces._bridge.FakeDatasetRef]]) → None¶ Record that a datastore holds the given datasets.
Parameters: - refs :
IterableofDatasetIdRef References to the datasets.
Raises: - AmbiguousDatasetError
Raised if
any(ref.id is None for ref in refs).
- refs :
-
moveToTrash(refs: Iterable[Union[lsst.daf.butler.core.datasets.ref.DatasetRef, lsst.daf.butler.registry.interfaces._bridge.FakeDatasetRef]]) → None¶ Move dataset location information to trash.
Parameters: - refs :
IterableofDatasetIdRef References to the datasets.
Raises: - AmbiguousDatasetError
Raised if
any(ref.id is None for ref in refs).
- refs :
- datastoreName :