1.5 KiB
Prompt
Implement a parse_endpoints() API in tractor.discovery._multiaddr that lets downstream projects declare per-actor transport bind addresses as a service table of actor-name -> multiaddr strings (loaded from config, e.g. TOML [network] section). Add type aliases EndpointsTable and ParsedEndpoints, plus 7 unit tests covering TCP, UDS, tuples, mixed input, unsupported protocols, and edge cases.
A detailed implementation plan was provided specifying insertion points, type signatures, test names, and verification commands.
Response summary
Add parse_endpoints() function with two supporting type aliases to _multiaddr.py. The function iterates a dict[str, list[str|tuple]] service table and delegates each entry to the existing wrap_address() helper, which already handles maddr strings, raw tuples, and pre-wrapped Address objects. Seven pure unit tests (no trio runtime) validate all input variants and edge cases. All 22 multiaddr tests pass.
Files changed
tractor/discovery/_multiaddr.py— addEndpointsTable,ParsedEndpointstype aliases andparse_endpoints()function after line 133tests/discovery/test_multiaddr.py— addparse_endpointsimport and 7 new test functions
Human edits
None — committed as generated.