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

Abstract service for managing artifact checksums. More...

#include <artifact_checksum_provider.hpp>

Inheritance diagram for porytiles2::ArtifactChecksumProvider:
[legend]

Public Member Functions

virtual ~ArtifactChecksumProvider ()=default
 
virtual std::unordered_map< ArtifactKey, std::string > compute_tileset_artifact_checksums (const std::string &tileset_name) const =0
 Computes checksums for the artifacts that belong to the given Tileset.
 
virtual std::unordered_map< ArtifactKey, std::string > load_cached_tileset_checksums (const std::string &tileset_name) const =0
 Loads the cached checksums for the given Tileset.
 
virtual Result< void > cache_tileset_checksums (const std::string &tileset_name, const std::unordered_map< ArtifactKey, std::string > &checksums) const =0
 Caches checksums for the given Tileset to persistent storage.
 
virtual std::vector< ArtifactKeyfind_unsynced_tileset_artifacts (const std::string &tileset_name, const std::vector< ArtifactKey > &artifact_keys) const
 Finds all artifacts for the given Tileset with unsynced changes compared to cached checksums.
 
virtual bool all_checksums_tileset_match (const std::string &tileset_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 metadata about both Porymap and Porytiles artifacts. This includes computing and storing checksums for integrity verification, retrieving modification timestamps, and determining temporal relationships between different artifact sets.

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 23 of file artifact_checksum_provider.hpp.

Constructor & Destructor Documentation

◆ ~ArtifactChecksumProvider()

virtual porytiles2::ArtifactChecksumProvider::~ArtifactChecksumProvider ( )
virtualdefault

Member Function Documentation

◆ all_checksums_tileset_match()

bool porytiles2::ArtifactChecksumProvider::all_checksums_tileset_match ( const std::string &  tileset_name,
const std::vector< ArtifactKey > &  artifact_keys 
) const
virtual

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
tileset_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 27 of file artifact_checksum_provider.cpp.

◆ cache_tileset_checksums()

virtual Result< void > porytiles2::ArtifactChecksumProvider::cache_tileset_checksums ( const std::string &  tileset_name,
const std::unordered_map< ArtifactKey, std::string > &  checksums 
) const
pure virtual

Caches checksums for the given Tileset to persistent storage.

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

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

◆ compute_tileset_artifact_checksums()

virtual std::unordered_map< ArtifactKey, std::string > porytiles2::ArtifactChecksumProvider::compute_tileset_artifact_checksums ( const std::string &  tileset_name) const
pure virtual

Computes checksums for the artifacts that belong to the given Tileset.

Parameters
tileset_nameThe name of the Tileset for which to compute checksums
Returns
A mapping of artifact keys to their computed checksum

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

◆ find_unsynced_tileset_artifacts()

std::vector< ArtifactKey > porytiles2::ArtifactChecksumProvider::find_unsynced_tileset_artifacts ( const std::string &  tileset_name,
const std::vector< ArtifactKey > &  artifact_keys 
) const
virtual

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
tileset_nameThe name of the tileset to check
artifact_keysThe keys of artifacts to check
Returns
Vector of artifact keys that have mismatched checksums

Definition at line 9 of file artifact_checksum_provider.cpp.

◆ load_cached_tileset_checksums()

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

Loads the cached checksums for the given Tileset.

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

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


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