chore: Prepare 0.2 release (#321)
Signed-off-by: Lucio Franco <[email protected]>
This commit is contained in:
@@ -1,6 +1,29 @@
|
||||
//! A `tonic` based gRPC healthcheck implementation.
|
||||
//!
|
||||
//! # Example
|
||||
//!
|
||||
//! An example can be found [here].
|
||||
//!
|
||||
//! [here]: https://github.com/hyperium/tonic/blob/master/examples/src/health/server.rs
|
||||
|
||||
#![warn(
|
||||
missing_debug_implementations,
|
||||
missing_docs,
|
||||
rust_2018_idioms,
|
||||
unreachable_pub
|
||||
)]
|
||||
#![doc(
|
||||
html_logo_url = "https://github.com/hyperium/tonic/raw/master/.github/assets/tonic-docs.png"
|
||||
)]
|
||||
#![doc(html_root_url = "https://docs.rs/tonic/0.2.0")]
|
||||
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
|
||||
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
mod proto {
|
||||
#![allow(unreachable_pub)]
|
||||
tonic::include_proto!("grpc.health.v1");
|
||||
}
|
||||
|
||||
@@ -9,8 +32,11 @@ pub mod server;
|
||||
/// An enumeration of values representing gRPC service health.
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum ServingStatus {
|
||||
/// Unknown status
|
||||
Unknown,
|
||||
/// The service is currently up and serving requests.
|
||||
Serving,
|
||||
/// The service is currently down and not serving requests.
|
||||
NotServing,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Contains all healthcheck based server utilities.
|
||||
|
||||
use crate::proto::health_server::{Health, HealthServer};
|
||||
use crate::proto::{HealthCheckRequest, HealthCheckResponse};
|
||||
use crate::ServingStatus;
|
||||
@@ -46,6 +48,7 @@ impl HealthReporter {
|
||||
/// Sets the status of the service implemented by `S` to `Serving`. This notifies any watchers
|
||||
/// if there is a change in status.
|
||||
#[cfg(feature = "transport")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "transport")))]
|
||||
pub async fn set_serving<S>(&mut self)
|
||||
where
|
||||
S: NamedService,
|
||||
@@ -58,6 +61,7 @@ impl HealthReporter {
|
||||
/// Sets the status of the service implemented by `S` to `NotServing`. This notifies any watchers
|
||||
/// if there is a change in status.
|
||||
#[cfg(feature = "transport")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "transport")))]
|
||||
pub async fn set_not_serving<S>(&mut self)
|
||||
where
|
||||
S: NamedService,
|
||||
|
||||
Reference in New Issue
Block a user