_table.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #
  2. # Copyright 2019 The FATE Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. from typing import Iterable
  17. from fate_arch.common import path_utils
  18. from fate_arch.common.log import getLogger
  19. from fate_arch.storage import StorageEngine, PathStoreType
  20. from fate_arch.storage import StorageTableBase
  21. LOGGER = getLogger()
  22. class StorageTable(StorageTableBase):
  23. def __init__(
  24. self,
  25. address=None,
  26. name: str = None,
  27. namespace: str = None,
  28. partitions: int = None,
  29. store_type: PathStoreType = PathStoreType.PICTURE,
  30. options=None,
  31. ):
  32. super(StorageTable, self).__init__(
  33. name=name,
  34. namespace=namespace,
  35. address=address,
  36. partitions=partitions,
  37. options=options,
  38. engine=StorageEngine.PATH,
  39. store_type=store_type,
  40. )
  41. def _collect(self, **kwargs) -> list:
  42. return []
  43. def _read(self) -> list:
  44. return []
  45. def _destroy(self):
  46. pass
  47. def _save_as(self, **kwargs):
  48. pass
  49. def _count(self):
  50. return path_utils.get_data_table_count(self._address.path)