pub struct HealthcheckSpec {
pub test: Vec<String>,
pub interval: Duration,
pub timeout: Duration,
pub retries: u32,
pub start_period: Duration,
}Expand description
Healthcheck resolved from the manifest, with duration strings
already parsed into std::time::Duration values.
For postgres resources the default test is
["CMD", "pg_isready", "-U", <user>]. For redis it is
["CMD", "redis-cli", "ping"]. Generic container and
dockerfile resources have no default: the manifest must provide
one explicitly if a healthcheck is needed.
Default timing values when the manifest omits them:
interval = 5s, timeout = 3s, retries = 5,
start_period = 5s.
§Example
use lightshuttle_spec::HealthcheckSpec;
use std::time::Duration;
let hc = HealthcheckSpec {
test: vec!["CMD".into(), "pg_isready".into(), "-U".into(), "postgres".into()],
interval: Duration::from_secs(5),
timeout: Duration::from_secs(3),
retries: 5,
start_period: Duration::from_secs(5),
};
assert_eq!(hc.retries, 5);Fields§
§test: Vec<String>Command the runtime runs to probe container health.
The first element is typically "CMD" or "CMD-SHELL" as per
the Docker healthcheck specification.
interval: DurationTime between consecutive health checks.
timeout: DurationMaximum wall-clock time a single check invocation may take.
retries: u32Number of consecutive failures before the container is considered unhealthy.
start_period: DurationGrace period after container start before health checks begin.
Trait Implementations§
Source§impl Clone for HealthcheckSpec
impl Clone for HealthcheckSpec
Source§fn clone(&self) -> HealthcheckSpec
fn clone(&self) -> HealthcheckSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HealthcheckSpec
impl Debug for HealthcheckSpec
impl Eq for HealthcheckSpec
Source§impl PartialEq for HealthcheckSpec
impl PartialEq for HealthcheckSpec
impl StructuralPartialEq for HealthcheckSpec
Auto Trait Implementations§
impl Freeze for HealthcheckSpec
impl RefUnwindSafe for HealthcheckSpec
impl Send for HealthcheckSpec
impl Sync for HealthcheckSpec
impl Unpin for HealthcheckSpec
impl UnsafeUnpin for HealthcheckSpec
impl UnwindSafe for HealthcheckSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request