Extend `.msg.types.Aid` method interface
Providing the legacy `.uid -> tuple` style id (since still used for the `Actor._contexts` table) and a `repr-one-line` method `.reprol() -> str` for rendering a compact unique actor ID summary (useful in logging/.pformat()s at the least).enable_tpts
parent
6a6f55cee0
commit
c559f80f08
|
@ -154,6 +154,29 @@ class Aid(
|
|||
# should also include at least `.pid` (equiv to port for tcp)
|
||||
# and/or host-part always?
|
||||
|
||||
@property
|
||||
def uid(self) -> tuple[str, str]:
|
||||
'''
|
||||
Legacy actor "unique-id" pair format.
|
||||
|
||||
'''
|
||||
return (
|
||||
self.name,
|
||||
self.uuid,
|
||||
)
|
||||
|
||||
def reprol(
|
||||
self,
|
||||
sin_uuid: bool = True,
|
||||
) -> str:
|
||||
if not sin_uuid:
|
||||
return (
|
||||
f'{self.name}[{self.uuid[:6]}]@{self.pid!r}'
|
||||
)
|
||||
return (
|
||||
f'{self.name}@{self.pid!r}'
|
||||
)
|
||||
|
||||
|
||||
class SpawnSpec(
|
||||
pretty_struct.Struct,
|
||||
|
|
Loading…
Reference in New Issue