#pragma once #include #include #include #include #include namespace Void::Storage { struct VerifyReport { std::uint64_t manifest_generation{0}; Sequence checkpoint_sequence{0}; std::uint64_t tables_verified{0}; std::uint64_t blocks_verified{0}; std::uint64_t wal_segments_verified{0}; std::uint64_t wal_batches_verified{0}; }; struct SalvageReport { Sequence highest_recovered_sequence{0}; std::uint64_t recovered_batches{0}; std::uint64_t keys_recovered{0}; std::uint64_t tombstones_preserved{0}; std::uint64_t truncated_or_skipped_bytes{0}; }; /// Read-only full structural & block-level verification of an offline or /// quiesced Storage directory (CURRENT, MANIFEST, every block of every table, /// and every manifest-listed WAL segment). [[nodiscard]] Result verify_directory( const std::filesystem::path& directory, const Limits& limits = {}, std::shared_ptr port = nullptr); /// Restore a verified backup directory into `destination` without mutating /// `backup_dir`. [[nodiscard]] Result restore_backup( const std::filesystem::path& backup_dir, const std::filesystem::path& destination, const Limits& limits = {}, std::shared_ptr port = nullptr); /// Offline salvage: extracts the valid prefix of committed data and valid /// tables/WAL records from `source_dir` into a fresh `destination_dir`. /// Refuses same-directory salvage. [[nodiscard]] Result salvage_directory( const std::filesystem::path& source_dir, const std::filesystem::path& destination_dir, const Limits& limits = {}, std::shared_ptr port = nullptr); } // namespace Void::Storage