Porytiles
Loading...
Searching...
No Matches
porytiles::ArtifactChecksumProvider Class Referenceabstract

Abstract service for managing artifact checksums. More...

#include <artifact_checksum_provider.hpp>

Inheritance diagram for porytiles::ArtifactChecksumProvider:
[legend]

Public Member Functions

virtual ~ArtifactChecksumProvider ()=default
 
virtual std::unordered_map< ArtifactKey, std::string > compute_tileset_artifact_checksums (const std::vector< ArtifactKey > &keys) const =0
 Computes checksums for the given Tileset artifacts.
 
virtual std::unordered_map< ArtifactKey, std::string > load_cached_tileset_checksums (const std::string &name) const =0
 Loads the cached checksums for the given Tileset.
 
virtual ChainableResult< void > cache_tileset_checksums (const std::string &name, const std::unordered_map< ArtifactKey, std::string > &checksums) const =0
 Caches checksums for the given Tileset to persistent storage.
 
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

Abstract service for managing artifact checksums.

The ArtifactChecksumProvider provides an interface for accessing and managing checksums for both Porymap and Porytiles artifacts.

Among other things, this service is essential for the compilation pipeline to determine when assets need to be recompiled based on changes to source files or existing artifacts.

Definition at line 22 of file artifact_checksum_provider.hpp.

Constructor & Destructor Documentation

◆ ~ArtifactChecksumProvider()

virtual porytiles::ArtifactChecksumProvider::~ArtifactChecksumProvider ( )
virtualdefault

Member Function Documentation

◆ all_checksums_tileset_match()

bool porytiles::ArtifactChecksumProvider::all_checksums_tileset_match ( const std::string &  name,
const std::vector< ArtifactKey > &  artifact_keys 
) const
inline

Checks if all artifact checksums for the given Tileset match their cached values.

This method compares current checksums against cached checksums for the specified artifact keys and returns true if all match. It's effectively a convenience wrapper around find_unsynced_artifacts that simply checks if there are no unsynced artifacts.

Parameters
nameThe name of the tileset to check
artifact_keysThe keys of artifacts to check
Returns
True if all checksums match, false if any differ

Definition at line 110 of file artifact_checksum_provider.hpp.

◆ cache_tileset_checksums()

virtual ChainableResult< void > porytiles::ArtifactChecksumProvider::cache_tileset_checksums ( const std::string &  name,
const std::unordered_map< ArtifactKey, std::string > &  checksums 
) const
pure virtual

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

Implemented in porytiles::NoopArtifactChecksumProvider, and porytiles::ProjectArtifactChecksumProvider.

◆ cached_checksums_exist()

bool porytiles::ArtifactChecksumProvider::cached_checksums_exist ( const std::string &  name) const
inline

Check if any cached checksums exist for the given tileset.

Parameters
nameThe name of the tileset to check
Returns
If any cached checksums exist for the given tileset

Definition at line 92 of file artifact_checksum_provider.hpp.

◆ compute_tileset_artifact_checksums()

virtual std::unordered_map< ArtifactKey, std::string > porytiles::ArtifactChecksumProvider::compute_tileset_artifact_checksums ( const std::vector< ArtifactKey > &  keys) const
pure virtual

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

Implemented in porytiles::NoopArtifactChecksumProvider, and porytiles::ProjectArtifactChecksumProvider.

◆ find_unsynced_tileset_artifacts()

std::vector< ArtifactKey > porytiles::ArtifactChecksumProvider::find_unsynced_tileset_artifacts ( const std::string &  name,
const std::vector< ArtifactKey > &  keys_to_check 
) const
inline

Finds all artifacts for the given Tileset with unsynced changes compared to cached checksums.

This method compares current checksums against cached checksums for the specified artifact keys and returns a vector of keys that don't match.

Parameters
nameThe name of the tileset to check
keys_to_checkThe keys of artifacts to check
Returns
Vector of artifact keys that have mismatched checksums

Definition at line 66 of file artifact_checksum_provider.hpp.

◆ load_cached_tileset_checksums()

virtual std::unordered_map< ArtifactKey, std::string > porytiles::ArtifactChecksumProvider::load_cached_tileset_checksums ( const std::string &  name) const
pure virtual

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

Implemented in porytiles::NoopArtifactChecksumProvider, and porytiles::ProjectArtifactChecksumProvider.


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