daemon: added grpc wrapped client tests, added new wrapped class ServiceFileConfig to consolidate associated data for its purpose
This commit is contained in:
parent
6086d1229b
commit
44f81391c4
5 changed files with 1335 additions and 36 deletions
|
@ -233,6 +233,23 @@ class NodeServiceData:
|
|||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class NodeServiceConfig:
|
||||
node_id: int
|
||||
service: str
|
||||
data: NodeServiceData
|
||||
files: Dict[str, str] = field(default_factory=dict)
|
||||
|
||||
@classmethod
|
||||
def from_proto(cls, proto: services_pb2.NodeServiceConfig) -> "NodeServiceConfig":
|
||||
return NodeServiceConfig(
|
||||
node_id=proto.node_id,
|
||||
service=proto.service,
|
||||
data=NodeServiceData.from_proto(proto.data),
|
||||
files=dict(proto.files),
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServiceConfig:
|
||||
node_id: int
|
||||
|
@ -255,6 +272,19 @@ class ServiceConfig:
|
|||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ServiceFileConfig:
|
||||
node_id: int
|
||||
service: str
|
||||
file: str
|
||||
data: str = field(repr=False)
|
||||
|
||||
def to_proto(self) -> services_pb2.ServiceFileConfig:
|
||||
return services_pb2.ServiceFileConfig(
|
||||
node_id=self.node_id, service=self.service, file=self.file, data=self.data
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BridgeThroughput:
|
||||
node_id: int
|
||||
|
@ -724,6 +754,9 @@ class Session:
|
|||
metadata: Dict[str, str]
|
||||
file: Path
|
||||
|
||||
def set_node(self, node: Node) -> None:
|
||||
self.nodes[node.id] = node
|
||||
|
||||
@classmethod
|
||||
def from_proto(cls, proto: core_pb2.Session) -> "Session":
|
||||
nodes: Dict[int, Node] = {x.id: Node.from_proto(x) for x in proto.nodes}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue