feat: report store durability status

This commit is contained in:
Eric Wendland 2026-07-05 18:10:41 +02:00
commit 6953e3acde
7 changed files with 124 additions and 18 deletions

View file

@ -5868,18 +5868,37 @@ pub fn handle_request(
) -> Result<ControlResponse, NodeError> {
let store = Store::open(&node.paths.metadata_db())?;
match request {
ControlRequest::Status => Ok(ControlResponse::Status(StatusResponse {
home: node.paths.home().to_path_buf(),
socket: node.paths.socket_path(),
agent_id: node.agent_id.clone(),
node_id: node.node_id.clone(),
iroh_enabled: node.iroh_status.enabled,
endpoint_id: node.iroh_status.endpoint_id.clone(),
iroh_relay_mode: node.iroh_status.relay_mode.clone(),
iroh_local_discovery: node.iroh_status.local_discovery,
iroh: node.iroh_status.note.clone(),
native_backends: native_backend_statuses(),
})),
ControlRequest::Status => {
let store_schema_version = store.schema_version()?;
let store_journal_mode = store.journal_mode()?;
let store_synchronous = store.synchronous_mode()?;
let store_ok = store_schema_version == geth_store::CURRENT_SCHEMA_VERSION
&& store_journal_mode == geth_store::FILE_JOURNAL_MODE
&& store_synchronous == geth_store::SYNCHRONOUS_MODE;
Ok(ControlResponse::Status(StatusResponse {
home: node.paths.home().to_path_buf(),
socket: node.paths.socket_path(),
agent_id: node.agent_id.clone(),
node_id: node.node_id.clone(),
store_schema_version,
store_current_schema_version: geth_store::CURRENT_SCHEMA_VERSION,
store_journal_mode,
store_synchronous,
store_status: if store_ok { "ok" } else { "check" }.to_owned(),
store_note: format!(
"expected schema {}, journal {}, synchronous {}",
geth_store::CURRENT_SCHEMA_VERSION,
geth_store::FILE_JOURNAL_MODE,
geth_store::SYNCHRONOUS_MODE
),
iroh_enabled: node.iroh_status.enabled,
endpoint_id: node.iroh_status.endpoint_id.clone(),
iroh_relay_mode: node.iroh_status.relay_mode.clone(),
iroh_local_discovery: node.iroh_status.local_discovery,
iroh: node.iroh_status.note.clone(),
native_backends: native_backend_statuses(),
}))
}
ControlRequest::NodeId => Ok(ControlResponse::NodeId(NodeIdResponse {
agent_id: node.agent_id.clone(),
node_id: node.node_id.clone(),