nanover.core.grpc_client module
Module providing a base class for gRPC clients.
- class nanover.core.grpc_client.GrpcClient(*, channel: Channel, make_channel_owner: bool = False, **kwargs)
Bases:
object
A base class for GRPC clients that handles service connection and client closing.
- Parameters:
channel – An existing
grpc.Channel
to use to establish a connection.make_channel_owner – Whether to make this client take ownership of ensuring the channel is closed upon disconnection of this client.
- DEFAULT_CONNECTION_PORT: int = 54321
- channel: Channel
- close()
Shutdown all threads and close the underlying channel if the client has been given that responsibility.
- classmethod insecure_channel(*, address: str | None = None, port: int | None = None, **kwargs)
Create an insecure connection at the given address and port.
- Parameters:
address – The URL or IP address of the service to connect to.
port – The port on which to connect.
- Returns:
An instantiation of a client connected insecurely at the given address and port.
- property is_channel_owner: bool
Indicates whether this client is responsible for managing the underlying channel.
- Returns:
True if this client is responsible for managing the underlying channel, False otherwise.
- threads: ThreadPoolExecutor