mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-28 14:47:11 -07:00
* [Card Database] Improve loading times through binary cache Took 10 minutes Took 9 minutes Took 16 seconds * [Card Database] Remove lib qt include Took 18 minutes Took 14 seconds * Downgrade to 6.3 datastream Took 5 minutes * go up to 6.4 datastream Took 1 minute * Address comments * Small bug fixes Took 20 minutes Took 10 seconds * More fixes. Took 4 minutes Took 4 seconds * Even more fixes. Took 11 minutes Took 4 seconds * More fixes. Took 6 minutes Took 26 seconds Took 8 minutes * Namespace instead of class Took 6 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
#ifndef CARDDATABASE_CACHE_H
|
|
#define CARDDATABASE_CACHE_H
|
|
|
|
#include "card_database_data.h"
|
|
|
|
#include <QByteArray>
|
|
#include <libcockatrice/interfaces/interface_card_set_priority_controller.h>
|
|
|
|
namespace CardDatabaseCache
|
|
{
|
|
/**
|
|
* @brief Writes a fully-built database snapshot to a binary cache file.
|
|
* @param cachePath Path of the cache file to write.
|
|
* @param data The snapshot to serialize.
|
|
* @param sourceHash Hash of the source XML used to validate the cache later.
|
|
* @return True if the cache was written successfully.
|
|
*/
|
|
bool write(const QString &cachePath, const CardDatabaseData &data, const QByteArray &sourceHash);
|
|
|
|
/**
|
|
* @brief Reads a database snapshot from a binary cache file.
|
|
* @param cachePath Path of the cache file to read.
|
|
* @param data Snapshot to populate.
|
|
* @param sourceHash Expected hash of the source XML; read fails if it differs.
|
|
* @param priorityController Controller used to reconstruct CardSet state.
|
|
* @return True if a valid, up-to-date cache was read.
|
|
*/
|
|
bool read(const QString &cachePath,
|
|
CardDatabaseData &data,
|
|
const QByteArray &sourceHash,
|
|
ICardSetPriorityController *priorityController);
|
|
} // namespace CardDatabaseCache
|
|
|
|
#endif // CARDDATABASE_CACHE_H
|