livery_grpc_health (livery_grpc v0.1.1)
View SourceThe standard grpc.health.v1.Health service, ready to mount.
Register it on a server with service/0:
livery_grpc:start_server(#{
port => 50051,
services => [my_service_spec, livery_grpc_health:service()]
}).Serving status is held per service name (the empty name <<>> is the
overall server status, which defaults to SERVING). Set it with
set_serving/0,1 and set_not_serving/0,1. Check returns the current
status, or a not_found gRPC error for a named service that was never
registered. Watch streams the current status and then a new message
every time it changes, until the client disconnects.
Status and watch subscriptions live in livery_grpc_health_store, a
gen_server started with the application.
Summary
Functions
Unary Check: the current serving status, or a not_found error.
The service spec to pass in a server's services list.
Mark the overall server as not serving.
Mark a named service as not serving.
Mark the overall server as serving.
Mark a named service as serving.
The current status for a service name. The overall server (<<>>)
defaults to SERVING; a never-registered named service is
SERVICE_UNKNOWN.
Server-streaming Watch: emit the current status, then a new message on
every change, until the client disconnects.
Types
-type serving_status() :: livery_grpc_health_store:serving_status().
Functions
-spec check(map(), livery_grpc_server:ctx()) -> {ok, map()} | {error, {livery_grpc_status:status(), binary()}}.
Unary Check: the current serving status, or a not_found error.
-spec service() -> livery_grpc_service:registration().
The service spec to pass in a server's services list.
-spec set_not_serving() -> ok.
Mark the overall server as not serving.
-spec set_not_serving(binary()) -> ok.
Mark a named service as not serving.
-spec set_serving() -> ok.
Mark the overall server as serving.
-spec set_serving(binary()) -> ok.
Mark a named service as serving.
-spec status(binary()) -> serving_status().
The current status for a service name. The overall server (<<>>)
defaults to SERVING; a never-registered named service is
SERVICE_UNKNOWN.
-spec watch(map(), fun((map()) -> ok | {error, term()}), livery_grpc_server:ctx()) -> ok.
Server-streaming Watch: emit the current status, then a new message on
every change, until the client disconnects.