Manages loading, saving, and merging of ASAP index files for ASAPCabinetFE. More...
#include <asap_index_manager.h>
Public Member Functions | |
AsapIndexManager (const Settings &settings) | |
Constructs an AsapIndexManager with the given settings. | |
bool | load (const Settings &settings, std::vector< TableData > &tables, LoadingProgress *progress=nullptr) override |
Loads table data from the ASAP index file. | |
bool | save (const Settings &settings, const std::vector< TableData > &tables, LoadingProgress *progress=nullptr) override |
Saves table data to the ASAP index file. | |
std::vector< TableData > | mergeTables (const Settings &settings, const std::vector< TableData > &newTables, LoadingProgress *progress=nullptr) override |
Merges new table data with existing index data. | |
Manages loading, saving, and merging of ASAP index files for ASAPCabinetFE.
This class provides methods to load table data from an existing ASAP index file, save table data to a new or updated index file, and merge new table data with existing index entries. It uses JSON for data serialization, supports progress tracking with LoadingProgress, and relies on Settings for configuration.
AsapIndexManager::AsapIndexManager | ( | const Settings & | settings | ) |
Constructs an AsapIndexManager with the given settings.
settings | The application settings containing the index file path. |
|
overridevirtual |
Loads table data from the ASAP index file.
Attempts to read and parse the asapcab_index.json file specified in settings.indexPath, populating the tables vector with TableData objects.
settings | The application settings containing the index file path. |
tables | Reference to the vector to store the loaded table data. |
progress | Optional pointer to LoadingProgress for real-time updates. |
Implements ITableCallbacks.
|
overridevirtual |
Merges new table data with existing index data.
Compares new table data with existing index entries, updating tables with higher-quality metadata (based on jsonOwner priority), adding new tables, and removing deleted ones. Preserves user fields like playCount. Returns the merged table data.
settings | The application settings containing the index file path. |
newTables | The new table data to merge. |
progress | Optional pointer to LoadingProgress for real-time updates. |
Implements ITableCallbacks.
|
overridevirtual |
Saves table data to the ASAP index file.
Serializes the provided tables vector into a JSON array and writes it to asapcab_index.json at settings.indexPath.
settings | The application settings containing the index file path. |
tables | The vector of TableData to save. |
progress | Optional pointer to LoadingProgress for real-time updates. |
Implements ITableCallbacks.