Class Reindexer

Class Documentation

class Reindexer

Tool to reconstruct bag metadata files in the event of loss or corruption

Reindexing recreates metadata.yaml for a bag that is missing that file. This is done by opening the storage directly and reading the contents to accumulate metadata.

Reindexing has some limitations - It cannot perfectly replicate the original metadata file, since some information known by the program from the start up command cannot be found within the metadata. But it should at least repair a bag to the point it can be read again.

Public Functions

Reindexer(std::unique_ptr<rosbag2_storage::StorageFactoryInterface> storage_factory = std::make_unique<rosbag2_storage::StorageFactory>(), std::unique_ptr<rosbag2_storage::MetadataIo> metadata_io = std::make_unique<rosbag2_storage::MetadataIo>())
virtual ~Reindexer() = default
void reindex(const rosbag2_storage::StorageOptions &storage_options)

Use the supplied storage options to reindex a bag defined by the storage options URI.

Protected Attributes

std::unique_ptr<rosbag2_storage::StorageFactoryInterface> storage_factory_ = {}
std::unique_ptr<rosbag2_storage::MetadataIo> metadata_io_ = {}
rosbag2_storage::BagMetadata metadata_ = {}
std::vector<rosbag2_storage::TopicMetadata> topics_metadata_ = {}