Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #133

Merged
merged 3 commits into from
Feb 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions seedemu/core/Service.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class Service(Layer):
The base class for all Services.
"""

__pending_targets: Dict[str, Server]
_pending_targets: Dict[str, Server]

__targets: Set[Tuple[Server, Node]]

def __init__(self):
super().__init__()
self.__pending_targets = {}
self._pending_targets = {}
self.__targets = set()

def _createServer(self) -> Server:
Expand Down Expand Up @@ -130,24 +130,24 @@ def addPrefix(self, prefix: str):
This method sets a prepend a prefix to all virtual node names.
"""
new_dict = {}
for k, v in self.__pending_targets.items():
for k, v in self._pending_targets.items():
new_dict[prefix + k] = v

self.__pending_targets = new_dict
self._pending_targets = new_dict

def install(self, vnode: str) -> Server:
"""!
@brief install the service on a node identified by given name.
"""
if vnode in self.__pending_targets.keys(): return self.__pending_targets[vnode]
if vnode in self._pending_targets.keys(): return self._pending_targets[vnode]

s = self._createServer()
self.__pending_targets[vnode] = s
self._pending_targets[vnode] = s

return self.__pending_targets[vnode]
return self._pending_targets[vnode]

def configure(self, emulator: Emulator):
for (vnode, server) in self.__pending_targets.items():
for (vnode, server) in self._pending_targets.items():
pnode = emulator.getBindingFor(vnode)
self._log('looking for binding for {}...'.format(vnode))
self.__configureServer(server, pnode)
Expand Down Expand Up @@ -182,11 +182,11 @@ def setPendingTargets(self, targets: Dict[str, Server]):

@param targets new targets.
"""
self.__pending_targets = targets
self._pending_targets = targets

def getPendingTargets(self) -> Dict[str, Server]:
"""!
@brief Get a set of pending vnode to install the service on.
"""
return self.__pending_targets
return self._pending_targets