grpc: removed add session server, achieved with start session providing servers for session

This commit is contained in:
Blake Harnden 2021-05-06 10:56:51 -07:00
parent 7e6b87101b
commit d40435fa68
6 changed files with 42 additions and 54 deletions

View file

@ -184,6 +184,19 @@ class ConfigServiceDefaults:
)
@dataclass
class Server:
name: str
host: str
@classmethod
def from_proto(cls, proto: core_pb2.Server) -> "Server":
return Server(name=proto.name, host=proto.host)
def to_proto(self) -> core_pb2.Server:
return core_pb2.Server(name=self.name, host=self.host)
@dataclass
class Service:
group: str
@ -775,6 +788,7 @@ class Session:
metadata: Dict[str, str] = field(default_factory=dict)
file: Path = None
options: Dict[str, ConfigOption] = field(default_factory=dict)
servers: List[Server] = field(default_factory=list)
@classmethod
def from_proto(cls, proto: core_pb2.Session) -> "Session":
@ -812,6 +826,7 @@ class Session:
node.mobility_config = ConfigOption.from_dict(mapped_config.config)
file_path = Path(proto.file) if proto.file else None
options = ConfigOption.from_dict(proto.options)
servers = [Server.from_proto(x) for x in proto.servers]
return Session(
id=proto.id,
state=SessionState(proto.state),
@ -827,6 +842,7 @@ class Session:
metadata=dict(proto.metadata),
file=file_path,
options=options,
servers=servers,
)
def add_node(