pub mod compact;
pub mod repair;
pub mod verify;
pub use compact::{compact_cluster, stream_large_blob};
pub use repair::{auto_rebalance_cluster, repair_cluster};
pub use verify::{prepare_seamless_upgrade, verify_cluster};
pub const UNSCHEDULED: &str = "unscheduled";
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct NotImplemented {
pub feature: &'static str,
pub roadmap: &'static str,
}
impl NotImplemented {
pub const VERIFY: Self = Self {
feature: "verify",
roadmap: "2.1.0",
};
pub const REPAIR: Self = Self {
feature: "repair",
roadmap: "2.2.0",
};
pub const COMPACT: Self = Self {
feature: "compact",
roadmap: "2.2.0",
};
pub const REBALANCE: Self = Self {
feature: "rebalance",
roadmap: "2.2.0",
};
pub const SCALE: Self = Self {
feature: "scale",
roadmap: "2.2.0",
};
pub const UPGRADE: Self = Self {
feature: "upgrade",
roadmap: UNSCHEDULED,
};
pub const STREAM: Self = Self {
feature: "stream",
roadmap: UNSCHEDULED,
};
pub const BACKUP: Self = Self {
feature: "backup",
roadmap: UNSCHEDULED,
};
pub const RESTORE: Self = Self {
feature: "restore",
roadmap: UNSCHEDULED,
};
pub const TTL: Self = Self {
feature: "ttl",
roadmap: UNSCHEDULED,
};
pub const K8S_OPERATOR: Self = Self {
feature: "kubernetes operator",
roadmap: UNSCHEDULED,
};
pub const IO_URING: Self = Self {
feature: "io_uring",
roadmap: UNSCHEDULED,
};
pub const KAFKA_SINK: Self = Self {
feature: "kafka sink",
roadmap: UNSCHEDULED,
};
pub const DOWNSAMPLING: Self = Self {
feature: "downsampling",
roadmap: UNSCHEDULED,
};
pub const TIERING_COMPRESSION: Self = Self {
feature: "tiering compression",
roadmap: UNSCHEDULED,
};
}
impl std::fmt::Display for NotImplemented {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{} is not implemented (roadmap: {})",
self.feature, self.roadmap
)
}
}
impl std::error::Error for NotImplemented {}
impl From<NotImplemented> for crate::Error {
fn from(feature: NotImplemented) -> Self {
crate::Error::Other(feature.to_string())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn message_names_the_feature_and_the_roadmap() {
assert_eq!(
NotImplemented::VERIFY.to_string(),
"verify is not implemented (roadmap: 2.1.0)"
);
assert_eq!(
NotImplemented::UPGRADE.to_string(),
"upgrade is not implemented (roadmap: unscheduled)"
);
}
#[test]
fn converts_into_the_crate_error_with_the_same_message() {
let error: crate::Error = NotImplemented::REPAIR.into();
assert_eq!(
error.to_string(),
"repair is not implemented (roadmap: 2.2.0)"
);
}
}