Open ajoaoff opened 3 years ago
Quick summary of major points to be moved and refactored on both kytos
and topology
:
_get_link_or_create(endpoint_a, endpoint_b)
to kytos.core.controller.get_link_or_create(endpoint_a: Interface, endpoint_b: Interface)
topology
self.links
dict to Controller.links
topology
self._links_lock
to Controller._links_lock
.topology
get_link_from_interface(interface)
to kytos.core.controller.get_link_from_interface(interface: Interface) -> Optional[Link]
. This method should be thread safe using Controller._links_lock
.get_link(link_id: str) -> Optional[Link]
self.links
usage to use kytos.core.controller.links
instead, including preserving the shallow copiesself._links_lock
to use a shallow copy where it's iterating over links.on_interruption_start
to use another local lock something like with self._interruption_lock
each start event needs to be processed sequentially, and on_interruption_end
to also use the same lock.kytos.core.controller.remove_link(link_id: str) -> Optional[Link]
All topology DB writes will still be managed by topology, only the Link
instances refs should be moved to core just so certain memory reads becomes easier and avoid IO in many cases that it used to have in certain request calls.
topology
endpoints will still stay the same, no compatibility broken except self.links
which shouldn't accessed by other NApps, although maintenance
is doing it https://github.com/kytos-ng/maintenance/issues/90, so that needs to be refactored too.
Original issue opened by @ajoaoff at https://github.com/kytos/kytos/issues/1064.
The list of links must be accessible by all applications, like the list of switches and interfaces. Although the topology is discovered by the
kytos/topology
NApp, the results should be stored in the core. The NAppkytos/of_core
deals with switch connections, but the data is stored in the core.