Coverage for python/lsst/daf/butler/registry/_collectionType.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of daf_butler.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
22from __future__ import annotations
24__all__ = [
25 "CollectionType",
26]
28import enum
29from typing import FrozenSet
32class CollectionType(enum.IntEnum):
33 """Enumeration used to label different types of collections.
34 """
36 RUN = 1
37 """A ``RUN`` collection (also just called a 'run') is the initial
38 collection a dataset is inserted into and the only one it can never be
39 removed from.
41 Within a particular run, there may only be one dataset with a particular
42 dataset type and data ID.
43 """
45 TAGGED = 2
46 """Datasets can be associated with and removed from ``TAGGED`` collections
47 arbitrarily.
49 Within a particular tagged collection, there may only be one dataset with
50 a particular dataset type and data ID.
51 """
53 CHAINED = 3
54 """A ``CHAINED`` collection is simply an ordered list of other collections
55 to be searched. These may include other ``CHAINED`` collections.
56 """
58 CALIBRATION = 4
59 """A ``CALIBRATION`` collection operates like a ``TAGGED`` collection, but
60 also associates each dataset with a validity range as well. Queries
61 against calibration collections must include a timestamp as an input.
63 It is difficult (perhaps impossible) to enforce a constraint that there be
64 one dataset with a particular dataset type and data ID at any particular
65 timestamp in the database, so higher-level tools that populate calibration
66 collections are expected to maintain that invariant instead.
67 """
69 @classmethod
70 def all(cls) -> FrozenSet[CollectionType]:
71 """Return a `frozenset` containing all members.
72 """
73 return frozenset(cls.__members__.values())