Skip to content

Commit 160397c

Browse files
committed
ref(entities): rename MatchmakingQueue to Matchmaking
1 parent f372f37 commit 160397c

File tree

23 files changed

+177
-121
lines changed

23 files changed

+177
-121
lines changed

src/ttt/application/matchmaking_queue/common/matchmaking_queue_log.py renamed to src/ttt/application/matchmaking/common/matchmaking_log.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from abc import ABC, abstractmethod
22

33

4-
class CommonMatchmakingQueueLog(ABC):
4+
class CommonMatchmakingLog(ABC):
55
@abstractmethod
66
async def waiting_for_game_start(
77
self,
@@ -17,6 +17,6 @@ async def double_waiting_for_game_start(
1717
) -> None: ...
1818

1919
@abstractmethod
20-
async def user_already_in_game_to_add_to_matchmaking_queue(
20+
async def user_already_in_game_to_wait_game_in_matchmaking(
2121
self, user_id: int, /,
2222
) -> None: ...

src/ttt/application/matchmaking_queue/common/matchmaking_queue_views.py renamed to src/ttt/application/matchmaking/common/matchmaking_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from abc import ABC, abstractmethod
22

33

4-
class CommonMatchmakingQueueViews(ABC):
4+
class CommonMatchmakingViews(ABC):
55
@abstractmethod
66
async def waiting_for_game_view(self, user_id: int, /) -> None: ...
77

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from abc import ABC
2+
from collections.abc import Awaitable
3+
4+
from ttt.entities.core.matchmaking.matchmaking import (
5+
Matchmaking,
6+
)
7+
8+
9+
class SharedMatchmaking(ABC, Awaitable[Matchmaking]): ...

src/ttt/application/matchmaking_queue/game/wait_game.py renamed to src/ttt/application/matchmaking/game/wait_game.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
from ttt.application.game.game.ports.game_log import GameLog
99
from ttt.application.game.game.ports.game_views import GameViews
1010
from ttt.application.game.game.ports.games import Games
11-
from ttt.application.matchmaking_queue.common.matchmaking_queue_log import (
12-
CommonMatchmakingQueueLog,
11+
from ttt.application.matchmaking.common.matchmaking_log import (
12+
CommonMatchmakingLog,
1313
)
14-
from ttt.application.matchmaking_queue.common.matchmaking_queue_views import (
15-
CommonMatchmakingQueueViews,
14+
from ttt.application.matchmaking.common.matchmaking_views import (
15+
CommonMatchmakingViews,
1616
)
17-
from ttt.application.matchmaking_queue.common.shared_matchmaking_queue import (
18-
SharedMatchmakingQueue,
17+
from ttt.application.matchmaking.common.shared_matchmaking import (
18+
SharedMatchmaking,
1919
)
2020
from ttt.application.user.common.ports.user_views import CommonUserViews
2121
from ttt.application.user.common.ports.users import Users
22-
from ttt.entities.core.matchmaking_queue.matchmaking_queue import (
22+
from ttt.entities.core.matchmaking.matchmaking import (
2323
UserAlreadyWaitingForGameError,
2424
)
2525
from ttt.entities.core.user.user import UserAlreadyInGameError
@@ -38,9 +38,9 @@ class WaitGame:
3838
games: Games
3939
game_views: GameViews
4040
game_log: GameLog
41-
shared_matchmaking_queue: SharedMatchmakingQueue
42-
matchmaking_queue_views: CommonMatchmakingQueueViews
43-
matchmaking_queue_log: CommonMatchmakingQueueLog
41+
shared_matchmaking: SharedMatchmaking
42+
matchmaking_views: CommonMatchmakingViews
43+
matchmaking_log: CommonMatchmakingLog
4444

4545
async def __call__(self, user_id: int) -> None:
4646
async with self.transaction:
@@ -50,7 +50,7 @@ async def __call__(self, user_id: int) -> None:
5050
await self.user_views.user_is_not_registered_view(user_id)
5151
return
5252

53-
matchmaking_queue = await self.shared_matchmaking_queue
53+
matchmaking = await self.shared_matchmaking
5454
user_waiting_id = await self.uuids.random_uuid()
5555
game_id = await self.uuids.random_uuid()
5656
cell_id_matrix = await self.uuids.random_uuid_matrix((3, 3))
@@ -60,7 +60,7 @@ async def __call__(self, user_id: int) -> None:
6060

6161
try:
6262
tracking = Tracking()
63-
game = matchmaking_queue.add_user(
63+
game = matchmaking.wait_game(
6464
user,
6565
user_waiting_id,
6666
cell_id_matrix,
@@ -71,24 +71,24 @@ async def __call__(self, user_id: int) -> None:
7171
tracking,
7272
)
7373
except UserAlreadyWaitingForGameError:
74-
await self.matchmaking_queue_log.double_waiting_for_game_start(
74+
await self.matchmaking_log.double_waiting_for_game_start(
7575
user_id,
7676
)
77-
await self.matchmaking_queue_views.double_waiting_for_game_view(
77+
await self.matchmaking_views.double_waiting_for_game_view(
7878
user_id,
7979
)
8080
except UserAlreadyInGameError:
8181
await (
82-
self.matchmaking_queue_log
83-
.user_already_in_game_to_add_to_matchmaking_queue(user_id)
82+
self.matchmaking_log
83+
.user_already_in_game_to_wait_game_in_matchmaking(user_id)
8484
)
8585
await self.game_views.user_already_in_game_view(user_id)
8686
else:
8787
if game is None:
88-
await self.matchmaking_queue_log.waiting_for_game_start(
88+
await self.matchmaking_log.waiting_for_game_start(
8989
user_id,
9090
)
91-
await self.matchmaking_queue_views.waiting_for_game_view(
91+
await self.matchmaking_views.waiting_for_game_view(
9292
user_id,
9393
)
9494
await self.map_(tracking)

src/ttt/application/matchmaking_queue/common/shared_matchmaking_queue.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/ttt/entities/atomic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from ttt.entities.core.invitation_to_game.invitation_to_game import (
33
InvitationToGameAtomic,
44
)
5-
from ttt.entities.core.matchmaking_queue.matchmaking_queue import (
6-
MatchmakingQueueAtomic,
5+
from ttt.entities.core.matchmaking.matchmaking import (
6+
MatchmakingAtomic,
77
)
88
from ttt.entities.core.stars_purchase.stars_purchase import StarsPurchaseAtomic
99
from ttt.entities.core.user.user import UserAtomic
@@ -14,7 +14,7 @@
1414
GameAtomic
1515
| UserAtomic
1616
| StarsPurchaseAtomic
17-
| MatchmakingQueueAtomic
17+
| MatchmakingAtomic
1818
| InvitationToGameAtomic
1919
| PaymentAtomic
2020
)

0 commit comments

Comments
 (0)