Skip to content

Commit a6adf88

Browse files
author
Sergio García Prado
committed
ISSUE #198
* Rename classes.
1 parent b2783e2 commit a6adf88

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

packages/core/minos-microservice-saga/minos/saga/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
RemoteSagaStepMeta,
2626
RemoteSagaStepWrapper,
2727
Saga,
28-
SagaMeta,
28+
SagaClassMeta,
29+
SagaClassWrapper,
2930
SagaOperation,
3031
SagaStep,
3132
SagaStepMeta,
3233
SagaStepWrapper,
33-
SagaWrapper,
3434
)
3535
from .exceptions import (
3636
AlreadyCommittedException,

packages/core/minos-microservice-saga/minos/saga/definitions/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
)
44
from .saga import (
55
Saga,
6-
SagaMeta,
7-
SagaWrapper,
6+
SagaClassMeta,
7+
SagaClassWrapper,
88
)
99
from .steps import (
1010
ConditionalSagaStep,

packages/core/minos-microservice-saga/minos/saga/definitions/saga.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848

4949

5050
@runtime_checkable
51-
class SagaWrapper(Protocol):
51+
class SagaClassWrapper(Protocol):
5252
"""TODO"""
5353

54-
meta: SagaMeta
54+
meta: SagaClassMeta
5555

5656

57-
class SagaMeta:
57+
class SagaClassMeta:
5858
"""TODO"""
5959

6060
_class: SagaClass
@@ -111,8 +111,8 @@ def __init__(
111111
self.local_step(commit)
112112
self.committed = True
113113

114-
def __call__(self, type_: TP) -> Union[TP, SagaWrapper]:
115-
type_.meta = SagaMeta(type_, self)
114+
def __call__(self, type_: TP) -> Union[TP, SagaClassWrapper]:
115+
type_.meta = SagaClassMeta(type_, self)
116116
return type_
117117

118118
@classmethod

packages/core/minos-microservice-saga/minos/saga/executions/runners.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
)
3838
from ..definitions import (
3939
Saga,
40-
SagaWrapper,
40+
SagaClassWrapper,
4141
)
4242
from ..exceptions import (
4343
SagaFailedExecutionException,
@@ -85,7 +85,7 @@ def __init__(
8585

8686
async def run(
8787
self,
88-
definition: Optional[Union[Saga, SagaWrapper]] = None,
88+
definition: Optional[Union[Saga, SagaClassWrapper]] = None,
8989
context: Optional[SagaContext] = None,
9090
*,
9191
response: Optional[SagaResponse] = None,
@@ -115,7 +115,7 @@ async def run(
115115
:param kwargs: Additional named arguments.
116116
:return: This method does not return anything.
117117
"""
118-
if isinstance(definition, SagaWrapper):
118+
if isinstance(definition, SagaClassWrapper):
119119
definition = definition.meta.definition
120120

121121
if response is not None:

packages/core/minos-microservice-saga/minos/saga/executions/saga.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222

2323
from .. import (
24-
SagaWrapper,
24+
SagaClassWrapper,
2525
)
2626
from ..context import (
2727
SagaContext,
@@ -141,7 +141,7 @@ def from_saga(cls, definition: Saga, context: Optional[SagaContext] = None, *arg
141141
@classmethod
142142
def from_definition(
143143
cls,
144-
definition: Union[Saga, SagaWrapper],
144+
definition: Union[Saga, SagaClassWrapper],
145145
context: Optional[SagaContext] = None,
146146
uuid: Optional[UUID] = None,
147147
*args,
@@ -156,7 +156,7 @@ def from_definition(
156156
:param kwargs: Additional named arguments.
157157
:return: A new ``SagaExecution`` instance.
158158
"""
159-
if isinstance(definition, SagaWrapper):
159+
if isinstance(definition, SagaClassWrapper):
160160
definition = definition.meta.definition
161161

162162
if uuid is None:

packages/core/minos-microservice-saga/minos/saga/managers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
)
2323
from .definitions import (
2424
Saga,
25-
SagaWrapper,
25+
SagaClassWrapper,
2626
)
2727
from .executions import (
2828
DatabaseSagaExecutionRepository,
@@ -82,7 +82,7 @@ async def _destroy(self) -> None:
8282

8383
async def run(
8484
self,
85-
definition: Optional[Union[Saga, SagaWrapper]] = None,
85+
definition: Optional[Union[Saga, SagaClassWrapper]] = None,
8686
context: Optional[SagaContext] = None,
8787
*,
8888
response: Optional[SagaResponse] = None,

packages/core/minos-microservice-saga/tests/test_saga/test_definitions/test_saga.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
OrderPrecedenceException,
1515
RemoteSagaStep,
1616
Saga,
17+
SagaClassMeta,
18+
SagaClassWrapper,
1719
SagaContext,
1820
SagaException,
1921
SagaExecution,
20-
SagaMeta,
2122
SagaNotCommittedException,
2223
SagaOperation,
2324
SagaStep,
24-
SagaWrapper,
2525
)
2626
from tests.utils import (
2727
ADD_ORDER,
@@ -31,7 +31,7 @@
3131
)
3232

3333

34-
class TestSagaMeta(unittest.TestCase):
34+
class TestSagaClassMeta(unittest.TestCase):
3535
def test_constructor(self):
3636
@Saga()
3737
class _Foo:
@@ -41,10 +41,10 @@ class _Foo:
4141
def step(self, context: SagaContext) -> SagaContext:
4242
"""For testing purposes."""
4343

44-
self.assertIsInstance(_Foo, SagaWrapper)
44+
self.assertIsInstance(_Foo, SagaClassWrapper)
4545

4646
meta = _Foo.meta
47-
self.assertIsInstance(meta, SagaMeta)
47+
self.assertIsInstance(meta, SagaClassMeta)
4848
self.assertEqual(meta.definition, Saga().local_step(_Foo.step).commit())
4949

5050
def test_definition_raises_order(self):

0 commit comments

Comments
 (0)