Add a few clarifications

The clarifications sometimes are about change that will come in a future
commit, sorry for that. (But the order of commits on this branch is
broken anyway…)
styling
LEdoian 1 year ago
parent 6a912ec51d
commit b6711dd32e

@ -56,6 +56,9 @@ class TopologyV3:
specific detail. (Currently, only detail to be checked is the type,
since when the ID differs, we create two vertices).
This also means that any original topology provider must make sure not
to accidentaly create duplicate vertices.
When adding a vertex from different topology, we must not modify it, so
we create our own copy."""
if self.frozen: raise ValueError('Cannot add vertex to frozen topology.')
@ -165,6 +168,10 @@ class VertexID:
description of the network, leaving such heuristics and advanced matching
to another algorithm."""
# The ipaddress module does not provide a simple address family
# enumeration, but socket does, so we use that (AF_INET, AF_INET6). Routers
# can omit the family, since the router ID is family-agnostic, and it also
# could be unknown for transit networks.
family: AddressFamily
# We do _not_ use NodeType, because what is an extra-area network in one
@ -252,6 +259,7 @@ class VertexFinder:
self.vertices: dict[VertexID, list[TopologyV3]] = defaultdict(lambda: [])
# All of the following dictionaries have scalars as keys and sets of VertexIDs as value.
# If there were multiple addresses, they were added individually.
self.by_addr: dict[IPv4Network | IPv6Network, set[VertexID]] = defaultdict(lambda: set())
self.by_rid = defaultdict(lambda: set())
self.by_dr = defaultdict(lambda: set())

Loading…
Cancel
Save