-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor services to be set via list in constructor
- Loading branch information
Showing
25 changed files
with
187 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class AbstractMessage: | ||
"""""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from ....common.message import AbstractMessage | ||
|
||
|
||
class AbstractVirtualMachineMessage(AbstractMessage): | ||
"""""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
class SyftMessage: | ||
from ...common.message import AbstractMessage | ||
|
||
|
||
class SyftMessage(AbstractMessage): | ||
def __init__(self, route, msg_id=None): | ||
self.route = route | ||
self.msg_id = msg_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
from ..... import type_hints | ||
from ...abstract.service import WorkerService | ||
from ....message.abstract.vm import AbstractVirtualMachineMessage | ||
from ..device import Device | ||
|
||
|
||
class VMService(WorkerService): | ||
@staticmethod | ||
@type_hints | ||
def process(device: Device, msg: AbstractVirtualMachineMessage) -> AbstractVirtualMachineMessage: | ||
return device.vms[msg.route.pri_route.vm].recv_msg(msg) | ||
|
||
@staticmethod | ||
@type_hints | ||
def message_type_handler() -> type: | ||
return AbstractVirtualMachineMessage |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
12 changes: 8 additions & 4 deletions
12
src/syft/core/message/repr_message.py → ...yft/core/nodes/vm/message/repr_message.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from ....message.syft_message import SyftMessage | ||
from .....typecheck import type_hints | ||
from ....message.abstract.vm import AbstractVirtualMachineMessage | ||
from typing import final | ||
|
||
|
||
@final | ||
class VirtualMachineMessage(SyftMessage, AbstractVirtualMachineMessage): | ||
def __init__(self, route, msg_id=None): | ||
super().__init__(route=route, msg_id=msg_id) | ||
|
||
|
||
@final | ||
class VirtualMachineReplyMessage(SyftMessage, AbstractVirtualMachineMessage): | ||
def __init__(self, value, route, msg_id=None): | ||
super().__init__(route=route, msg_id=msg_id) | ||
self.value = value | ||
|
||
@type_hints | ||
def __repr__(self) -> str: | ||
return f"VirtualMachineReplyMessage:{self.value}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.