HealthService
struct HealthServiceIn-memory grpc.health.v1.Health Check handler.
Holds a per-service status map; set_status registers / updates a
service's serving status. An unregistered service name returns
SERVICE_UNKNOWN.
Implements Copyable, GrpcUnary, Movable
- Fields
statuses: Dict[String, Int]history: Dict[String, List[Int]]: Per-service ordered status-transition log. Everyset_statusappends here so :class:HealthWatchHandlercan replay the current status plus each subsequent change as a Watch stream.
__init__
def __init__(out self) set_status
def set_status(mut self, service: String, status: Int) Register / update service's serving status. Use the empty name "" for overall server health. Each call records a transition in :attr:history for Watch.
status_of
def status_of(self, service: String) -> Int Current serving status for service (SERVICE_UNKNOWN if never registered).
serve_unary
def serve_unary(mut self, ctx: GrpcCallContext, request_bytes: Span[UInt8]) -> GrpcUnaryReply