_federation.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import abc
  2. import typing
  3. from abc import ABCMeta
  4. from fate_arch.abc._gc import GarbageCollectionABC
  5. from fate_arch.common import Party
  6. __all__ = ["FederationABC"]
  7. class FederationABC(metaclass=ABCMeta):
  8. """
  9. federation, get or remote objects and tables
  10. """
  11. @property
  12. @abc.abstractmethod
  13. def session_id(self) -> str:
  14. ...
  15. @abc.abstractmethod
  16. def get(self, name: str,
  17. tag: str,
  18. parties: typing.List[Party],
  19. gc: GarbageCollectionABC) -> typing.List:
  20. """
  21. get objects/tables from ``parties``
  22. Parameters
  23. ----------
  24. name: str
  25. name of transfer variable
  26. tag: str
  27. tag to distinguish each transfer
  28. parties: typing.List[Party]
  29. parties to get objects/tables from
  30. gc: GarbageCollectionABC
  31. used to do some clean jobs
  32. Returns
  33. -------
  34. list
  35. a list of object or a list of table get from parties with same order of `parties`
  36. """
  37. ...
  38. @abc.abstractmethod
  39. def remote(self, v,
  40. name: str,
  41. tag: str,
  42. parties: typing.List[Party],
  43. gc: GarbageCollectionABC):
  44. """
  45. remote object/table to ``parties``
  46. Parameters
  47. ----------
  48. v: object or table
  49. object/table to remote
  50. name: str
  51. name of transfer variable
  52. tag: str
  53. tag to distinguish each transfer
  54. parties: typing.List[Party]
  55. parties to remote object/table to
  56. gc: GarbageCollectionABC
  57. used to do some clean jobs
  58. Returns
  59. -------
  60. Notes
  61. """
  62. ...
  63. @abc.abstractmethod
  64. def destroy(self, parties):
  65. """
  66. destroy federation from ``parties``
  67. Parameters
  68. ----------
  69. parties: typing.List[Party]
  70. parties to get objects/tables from
  71. Returns
  72. -------
  73. None
  74. """
  75. ...