Skip to content

Commit

Permalink
Rename OpaqueTableDefinition to DatastoreOpaqueTable
Browse files Browse the repository at this point in the history
Old name was too generic, in reality this is very datastore-specific.
I do not think we need generic structure of the same kind, at least not
right now.
  • Loading branch information
andy-slac committed Sep 27, 2023
1 parent 5589236 commit e2494f6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions python/lsst/daf/butler/core/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
from __future__ import annotations

__all__ = (
"DatastoreConfig",
"DatasetRefURIs",
"Datastore",
"DatastoreConfig",
"DatastoreOpaqueTable",
"DatastoreValidationError",
"DatasetRefURIs",
"NullDatastore",
"OpaqueTableDefinition",
)

import contextlib
Expand Down Expand Up @@ -95,7 +95,7 @@ class Event:


@dataclasses.dataclass(frozen=True)
class OpaqueTableDefinition:
class DatastoreOpaqueTable:
"""Definition of the opaque table which stores datastore records.
Table definition contains `.ddl.TableSpec` for a table and a class
Expand Down Expand Up @@ -1262,7 +1262,7 @@ def set_retrieve_dataset_type_method(self, method: Callable[[str], DatasetType |
pass

@abstractmethod
def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]:
def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]:
"""Make definitions of the opaque tables used by this Datastore.
Returns
Expand Down Expand Up @@ -1396,5 +1396,5 @@ def export_records(
) -> Mapping[str, DatastoreRecordData]:
raise NotImplementedError("This is a no-op datastore that can not access a real datastore")

def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]:
def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]:
return {}
6 changes: 3 additions & 3 deletions python/lsst/daf/butler/datastores/chainedDatastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
DatasetTypeNotSupportedError,
Datastore,
DatastoreConfig,
DatastoreOpaqueTable,
DatastoreRecordData,
DatastoreValidationError,
FileDataset,
OpaqueTableDefinition,
)
from lsst.resources import ResourcePath
from lsst.utils import doImportType
Expand Down Expand Up @@ -1181,9 +1181,9 @@ def transfer_from(

return all_accepted, remaining_refs

def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]:
def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]:
# Docstring inherited from the base class.
tables: dict[str, OpaqueTableDefinition] = {}
tables: dict[str, DatastoreOpaqueTable] = {}
for datastore in self.datastores:
tables.update(datastore.opaque_table_definitions())
return tables
6 changes: 3 additions & 3 deletions python/lsst/daf/butler/datastores/fileDatastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
DatastoreCacheManager,
DatastoreConfig,
DatastoreDisabledCacheManager,
DatastoreOpaqueTable,
DatastoreRecordData,
DatastoreValidationError,
FileDataset,
Expand All @@ -61,7 +62,6 @@
FormatterFactory,
Location,
LocationFactory,
OpaqueTableDefinition,
Progress,
StorageClass,
StoredDatastoreItemInfo,
Expand Down Expand Up @@ -3087,6 +3087,6 @@ def _cast_storage_class(self, ref: DatasetRef) -> DatasetRef:
ref = ref.overrideStorageClass(dataset_type.storageClass)
return ref

def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]:
def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]:
# Docstring inherited from the base class.
return {self._opaque_table_name: OpaqueTableDefinition(self.makeTableSpec(ddl.GUID), StoredFileInfo)}
return {self._opaque_table_name: DatastoreOpaqueTable(self.makeTableSpec(ddl.GUID), StoredFileInfo)}
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/datastores/inMemoryDatastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from .genericDatastore import GenericBaseDatastore

if TYPE_CHECKING:
from lsst.daf.butler import Config, DatasetType, LookupKey, OpaqueTableDefinition
from lsst.daf.butler import Config, DatasetType, DatastoreOpaqueTable, LookupKey
from lsst.daf.butler.registry.interfaces import DatasetIdRef, DatastoreRegistryBridgeManager

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -675,6 +675,6 @@ def export_records(self, refs: Iterable[DatasetIdRef]) -> Mapping[str, Datastore
# In-memory Datastore records cannot be exported or imported
return {}

def opaque_table_definitions(self) -> Mapping[str, OpaqueTableDefinition]:
def opaque_table_definitions(self) -> Mapping[str, DatastoreOpaqueTable]:
# Docstring inherited from the base class.
return {}
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/registries/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

if TYPE_CHECKING:
from .._butlerConfig import ButlerConfig
from ..core import OpaqueTableDefinition
from ..core import DatastoreOpaqueTable
from ..registry._registry import CollectionArgType
from ..registry.interfaces import CollectionRecord, DatastoreRegistryBridgeManager

Expand Down Expand Up @@ -681,7 +681,7 @@ def store_datastore_records(self, refs: Mapping[str, DatasetRef]) -> None:
# Docstring inherited from base class.
return

def make_datastore_tables(self, tables: Mapping[str, OpaqueTableDefinition]) -> None:
def make_datastore_tables(self, tables: Mapping[str, DatastoreOpaqueTable]) -> None:
# Docstring inherited from base class.
return

Expand Down
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/registries/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

if TYPE_CHECKING:
from .._butlerConfig import ButlerConfig
from ..core import OpaqueTableDefinition, StoredDatastoreItemInfo
from ..core import DatastoreOpaqueTable, StoredDatastoreItemInfo
from ..registry._registry import CollectionArgType
from ..registry.interfaces import (
CollectionRecord,
Expand Down Expand Up @@ -1374,7 +1374,7 @@ def store_datastore_records(self, refs: Mapping[str, DatasetRef]) -> None:
assert opaque_table is not None, f"Unexpected opaque table name {table_name}"
opaque_table.insert(*(record.to_record(dataset_id=ref.id) for record in records))

def make_datastore_tables(self, tables: Mapping[str, OpaqueTableDefinition]) -> None:
def make_datastore_tables(self, tables: Mapping[str, DatastoreOpaqueTable]) -> None:
# Docstring inherited from base class.

datastore_record_classes = {}
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/registry/_butler_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

if TYPE_CHECKING:
from .._butlerConfig import ButlerConfig
from ..core import OpaqueTableDefinition
from ..core import DatastoreOpaqueTable
from .interfaces import CollectionRecord, DatastoreRegistryBridgeManager


Expand Down Expand Up @@ -253,7 +253,7 @@ def store_datastore_records(self, refs: Mapping[str, DatasetRef]) -> None:
raise NotImplementedError()

@abstractmethod
def make_datastore_tables(self, tables: Mapping[str, OpaqueTableDefinition]) -> None:
def make_datastore_tables(self, tables: Mapping[str, DatastoreOpaqueTable]) -> None:
"""Create opaque tables used by datastores.
Parameters
Expand Down

0 comments on commit e2494f6

Please sign in to comment.