Skip to main content

format_target

Function format_target 

Source
pub async fn format_target(
    args: &RestoreArgs,
    inventory: &ArchiveInventory,
) -> Result<FormatTargetOutcome, RestoreError>
Expand description

Format the target log directory, seed it with the recovered topics, and return the cluster id it was formatted with.

The formatter generates a cluster id when none is given and does not report it back, so this passes an explicit --cluster-id and keeps it for the report. An operator who restores a cluster has to know its identity.

ยงErrors

Returns RestoreError::InvalidArgument when --node-id is absent: every restored partition names the target node as leader and sole replica, and defaulting that identity to node 0 could silently name a node the operator never said exists. Returns RestoreError::Format when the formatter rejects the target-side flags, and RestoreError::Io when the target cannot be written.