|
1 | 1 | """Routing manager classes for tracking and inspecting routing records.""" |
2 | 2 |
|
| 3 | +import logging |
3 | 4 | from typing import Coroutine, Sequence |
4 | 5 |
|
5 | 6 | from ....core.error import BaseError |
|
16 | 17 | from .models.route_updated import RouteUpdated |
17 | 18 |
|
18 | 19 |
|
| 20 | +LOGGER = logging.getLogger(__name__) |
| 21 | + |
| 22 | + |
19 | 23 | class RoutingManagerError(BaseError): |
20 | 24 | """Generic routing error.""" |
21 | 25 |
|
@@ -55,15 +59,19 @@ async def get_recipient(self, recip_verkey: str) -> RouteRecord: |
55 | 59 | raise RoutingManagerError("Must pass non-empty recip_verkey") |
56 | 60 |
|
57 | 61 | try: |
| 62 | + LOGGER.error(">>> fetching routing record for verkey: " + recip_verkey) |
58 | 63 | async with self._profile.session() as session: |
59 | 64 | record = await RouteRecord.retrieve_by_recipient_key( |
60 | 65 | session, recip_verkey |
61 | 66 | ) |
| 67 | + LOGGER.error(">>> FOUND routing record for verkey: " + recip_verkey) |
62 | 68 | except StorageDuplicateError: |
| 69 | + LOGGER.error(">>> DUPLICATE routing record for verkey: " + recip_verkey) |
63 | 70 | raise RouteNotFoundError( |
64 | 71 | f"More than one route record found with recipient key: {recip_verkey}" |
65 | 72 | ) |
66 | 73 | except StorageNotFoundError: |
| 74 | + LOGGER.error(">>> NOT FOUND routing record for verkey: " + recip_verkey) |
67 | 75 | raise RouteNotFoundError( |
68 | 76 | f"No route found with recipient key: {recip_verkey}" |
69 | 77 | ) |
@@ -136,13 +144,15 @@ async def create_route_record( |
136 | 144 | ) |
137 | 145 | if not recipient_key: |
138 | 146 | raise RoutingManagerError("Missing recipient_key") |
| 147 | + LOGGER.error(">>> creating routing record for verkey: " + recipient_key) |
139 | 148 | route = RouteRecord( |
140 | 149 | connection_id=client_connection_id, |
141 | 150 | wallet_id=internal_wallet_id, |
142 | 151 | recipient_key=recipient_key, |
143 | 152 | ) |
144 | 153 | async with self._profile.session() as session: |
145 | 154 | await route.save(session, reason="Created new route") |
| 155 | + LOGGER.error(">>> CREATED routing record for verkey: " + recipient_key) |
146 | 156 | return route |
147 | 157 |
|
148 | 158 | async def update_routes( |
|
0 commit comments