Porytiles
Loading...
Searching...
No Matches
porytiles::ProjectArtifactChecksumProvider Class Referencefinal

Pokeemerald project filesystem-based implementation of ArtifactChecksumProvider. More...

#include <project_artifact_checksum_provider.hpp>

Inheritance diagram for porytiles::ProjectArtifactChecksumProvider:
[legend]
Collaboration diagram for porytiles::ProjectArtifactChecksumProvider:
[legend]

Public Member Functions

 ProjectArtifactChecksumProvider (std::filesystem::path project_root)
 
std::unordered_map< ArtifactKey, std::string > compute_tileset_artifact_checksums (const std::vector< ArtifactKey > &keys) const override
 Computes checksums for the given Tileset artifacts.
 
std::unordered_map< ArtifactKey, std::string > load_cached_tileset_checksums (const std::string &tileset_name) const override
 Loads the cached checksums for the given Tileset.
 
ChainableResult< void > cache_tileset_checksums (const std::string &tileset_name, const std::unordered_map< ArtifactKey, std::string > &checksums) const override
 Caches checksums for the given Tileset to persistent storage.
 
- Public Member Functions inherited from porytiles::ArtifactChecksumProvider
virtual ~ArtifactChecksumProvider ()=default
 
std::vector< ArtifactKeyfind_unsynced_tileset_artifacts (const std::string &name, const std::vector< ArtifactKey > &keys_to_check) const
 Finds all artifacts for the given Tileset with unsynced changes compared to cached checksums.
 
bool cached_checksums_exist (const std::string &name) const
 Check if any cached checksums exist for the given tileset.
 
bool all_checksums_tileset_match (const std::string &name, const std::vector< ArtifactKey > &artifact_keys) const
 Checks if all artifact checksums for the given Tileset match their cached values.
 

Detailed Description

Pokeemerald project filesystem-based implementation of ArtifactChecksumProvider.

This class computes and caches checksums for tileset artifacts stored in a pokeemerald project. Checksums are persisted as JSON in the porytiles utility directory at porytiles/tilesets/{tileset_name}/tileset.cache.json.

Key paths are relativized against the project root before being stored, ensuring checksums remain valid even when the project directory is moved.

See also
ArtifactChecksumProvider for the abstract interface

Definition at line 24 of file project_artifact_checksum_provider.hpp.

Constructor & Destructor Documentation

◆ ProjectArtifactChecksumProvider()

porytiles::ProjectArtifactChecksumProvider::ProjectArtifactChecksumProvider ( std::filesystem::path  project_root)
inlineexplicit

Definition at line 26 of file project_artifact_checksum_provider.hpp.

Member Function Documentation

◆ cache_tileset_checksums()

ChainableResult< void > porytiles::ProjectArtifactChecksumProvider::cache_tileset_checksums ( const std::string &  name,
const std::unordered_map< ArtifactKey, std::string > &  checksums 
) const
overridevirtual

Caches checksums for the given Tileset to persistent storage.

Parameters
nameThe name of the Tileset for which to cache checksums
checksumsA mapping of artifact keys to their checksums to be cached
Returns
ChainableResult indicating success or failure of the cache operation

Implements porytiles::ArtifactChecksumProvider.

Definition at line 69 of file project_artifact_checksum_provider.cpp.

◆ compute_tileset_artifact_checksums()

std::unordered_map< ArtifactKey, std::string > porytiles::ProjectArtifactChecksumProvider::compute_tileset_artifact_checksums ( const std::vector< ArtifactKey > &  keys) const
overridevirtual

Computes checksums for the given Tileset artifacts.

Parameters
keysThe artifact keys for which to compute checksums
Returns
A mapping of artifact keys to their computed checksum

Implements porytiles::ArtifactChecksumProvider.

Definition at line 27 of file project_artifact_checksum_provider.cpp.

◆ load_cached_tileset_checksums()

std::unordered_map< ArtifactKey, std::string > porytiles::ProjectArtifactChecksumProvider::load_cached_tileset_checksums ( const std::string &  name) const
overridevirtual

Loads the cached checksums for the given Tileset.

Parameters
nameThe name of the Tileset for which to load cached checksums
Returns
A mapping of artifact keys to their cached checksums

Implements porytiles::ArtifactChecksumProvider.

Definition at line 47 of file project_artifact_checksum_provider.cpp.


The documentation for this class was generated from the following files: