Class Reindexer

Class Documentation

class Reindexer

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

Reindexing is an operation where a bag that is missing a metadata.yaml file can have a new file created through parsing of the metadata stored within the actual files of the bag. For instance: Imagine we are working with SQL databases (.db3). We can open the individual .db3 files within the bag and read their metadata (not the messages themselves) to replicate a usable metadata.yaml file, so that the bag can once again be read by the standard read command.

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_ = {}