server/lib/src/grow/plane_off.rs
//! **No growth plane** (a build without `estate`, H2's estate cut): the upstream and
//! the downstream link no edda `appliance-grow`, so there is no [`GrowPlane`] to make.
//! The type is uninhabited — `HolgerGrpc::grow` is always `None` — and every door
//! that would drive one answers as a box with no plane does (`no_plane`, by name).
//! The [`super::Hold`] and the releases are in every build regardless.
use super::*;
/// The growth plane of an estate build; uninhabited without `estate`.
#[derive(Debug)]
pub enum GrowPlane {}
impl GrowPlane {
pub fn is_twin(&self) -> bool {
match *self {}
}
pub fn status(&self) -> pb::GrowStatusReply {
match *self {}
}
pub fn start(&self, _req: &pb::GrowStartRequest) -> Result<pb::GrowStatusReply, String> {
match *self {}
}
pub fn resume(&self, _give_up: bool) -> Result<pb::GrowStatusReply, String> {
match *self {}
}
pub fn flush(&self, _timeout: Duration) -> pb::GrowFlushReply {
match *self {}
}
pub fn twin_report(&self, _req: &pb::TwinReportRequest) -> Result<pb::TwinReportReply, String> {
match *self {}
}
pub fn twins(&self) -> Result<pb::TwinsReply, String> {
match *self {}
}
}
/// The reason a build without the estate gives for its capacity's growth.
pub const NO_ESTATE_GROWTH: &str = "this holger was built without the estate (feature `estate`), so it has no growth ladder: the set's growth is unknown";
/// `CapacityReply`'s growth half without the estate: `GROWTH_UNKNOWN` (1, the same
/// number edda's `SetGrowth::Unknown` puts on the wire), said why, no data set, no
/// hotplug probe.
pub fn capacity_growth(_root: &Path) -> (i32, String, String, bool) {
(
crate::grpc::holger_proto::SetGrowth::GrowthUnknown as i32,
NO_ESTATE_GROWTH.to_owned(),
String::new(),
false,
)
}
#[cfg(test)]
mod tests {
#[test]
fn without_the_estate_the_growth_is_unknown_and_says_why() {
let (growth, reason, data_set, hotplug) = super::capacity_growth(&std::env::temp_dir());
assert_eq!(growth, 1, "GROWTH_UNKNOWN");
assert!(reason.contains("without the estate"), "{reason}");
assert!(data_set.is_empty() && !hotplug);
}
}