Skip to content

Commit 7949e07

Browse files
authored
Merge pull request #1160 from xcube-dev/yogesh-xxx-update-PreloadedDataStore-docstring
Update `PreloadedDataStore` to a TypeAlias
2 parents 14af6b8 + 4efc145 commit 7949e07

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

xcube/core/store/store.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from abc import ABC, abstractmethod
66
from collections.abc import Container, Iterator
7-
from typing import Any, Optional, Union
7+
from typing import Any, Optional, Union, TypeAlias
88

99
from xcube.constants import EXTENSION_POINT_DATA_STORES
1010
from xcube.util.extension import Extension, ExtensionPredicate, ExtensionRegistry
@@ -691,8 +691,19 @@ def deregister_data(self, data_id: str):
691691
"""
692692

693693

694-
class PreloadedDataStore(DataStore):
694+
class Preloaded(DataStore):
695695
"""A preload data store is a multable data store which contains the preload handle.
696+
This class solely acts as a protocol description or marker interface for `DataStore`
697+
instances returned from another data store's `preload_data` method.
698+
699+
The data stores returned from `preload_data` are not required to directly implement this interface.
700+
However, their instances must provide an attribute `preload_handle` of type `PreloadHandle`
701+
that is used to represent the pre-loading process and interact with it.
702+
703+
This approach helps make the source code more understandable even though instances
704+
of this class are not used at runtime. Instead, a different subclass of
705+
`DataStore` or `MutableDataStore` that includes this additional property is
706+
returned.
696707
697708
Instances of this class are returned by the ``DataStore.preload_data()`` method.
698709
"""
@@ -704,3 +715,6 @@ def preload_handle(self) -> PreloadHandle:
704715
Implementors of this interface may use a `ExecutorPreloadHandle` or consider
705716
returning a `NullPreloadHandle` if the progress is not observable.
706717
"""
718+
719+
720+
PreloadedDataStore: TypeAlias = DataStore | Preloaded

0 commit comments

Comments
 (0)