File: health_grpc.py

package info (click to toggle)
python-grpclib 0.4.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 484 kB
  • sloc: python: 3,370; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 2,008 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: grpclib/health/v1/health.proto
# plugin: grpclib.plugin.main
import abc
import typing

import grpclib.const
import grpclib.client
if typing.TYPE_CHECKING:
    import grpclib.server

import grpclib.health.v1.health_pb2


class HealthBase(abc.ABC):

    @abc.abstractmethod
    async def Check(self, stream: 'grpclib.server.Stream[grpclib.health.v1.health_pb2.HealthCheckRequest, grpclib.health.v1.health_pb2.HealthCheckResponse]') -> None:
        pass

    @abc.abstractmethod
    async def Watch(self, stream: 'grpclib.server.Stream[grpclib.health.v1.health_pb2.HealthCheckRequest, grpclib.health.v1.health_pb2.HealthCheckResponse]') -> None:
        pass

    def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
        return {
            '/grpc.health.v1.Health/Check': grpclib.const.Handler(
                self.Check,
                grpclib.const.Cardinality.UNARY_UNARY,
                grpclib.health.v1.health_pb2.HealthCheckRequest,
                grpclib.health.v1.health_pb2.HealthCheckResponse,
            ),
            '/grpc.health.v1.Health/Watch': grpclib.const.Handler(
                self.Watch,
                grpclib.const.Cardinality.UNARY_STREAM,
                grpclib.health.v1.health_pb2.HealthCheckRequest,
                grpclib.health.v1.health_pb2.HealthCheckResponse,
            ),
        }


class HealthStub:

    def __init__(self, channel: grpclib.client.Channel) -> None:
        self.Check = grpclib.client.UnaryUnaryMethod(
            channel,
            '/grpc.health.v1.Health/Check',
            grpclib.health.v1.health_pb2.HealthCheckRequest,
            grpclib.health.v1.health_pb2.HealthCheckResponse,
        )
        self.Watch = grpclib.client.UnaryStreamMethod(
            channel,
            '/grpc.health.v1.Health/Watch',
            grpclib.health.v1.health_pb2.HealthCheckRequest,
            grpclib.health.v1.health_pb2.HealthCheckResponse,
        )