Porytiles
Loading...
Searching...
No Matches
porytiles2::TilesetRepo Class Reference

Repository interface for the Tileset aggregate root. More...

#include <tileset_repo.hpp>

Public Member Functions

virtual ~TilesetRepo ()=default
 
 TilesetRepo (gsl::not_null< ArtifactChecksumProvider * > checksum_provider, gsl::not_null< TilesetArtifactKeyProvider * > key_provider, gsl::not_null< TilesetArtifactReader * > reader, gsl::not_null< TilesetArtifactWriter * > writer)
 Constructs a TilesetRepo with the required dependencies.
 
ChainableResult< void > save (const Tileset &tileset) const
 Persists a given Tileset and caches new artifact checksums.
 
ChainableResult< std::unique_ptr< Tileset > > load (const std::string &name) const
 Loads an existing Tileset from storage.
 
bool exists (const std::string &name) const
 Checks if the given Tileset exists in the backing store.
 
const ArtifactChecksumProviderchecksum_provider () const
 Gets a reference to the ArtifactChecksumProvider for this repo.
 
const TilesetArtifactKeyProviderkey_provider () const
 Gets a reference to the TilesetArtifactKeyProvider for this repo.
 

Detailed Description

Repository interface for the Tileset aggregate root.

The TilesetRepo makes no assumptions about the structure of the backing store for the Tileset. Presumably, this store is the canonical 'data/tilesets' directory, but the details here are implementation-defined.

Definition at line 25 of file tileset_repo.hpp.

Constructor & Destructor Documentation

◆ ~TilesetRepo()

virtual porytiles2::TilesetRepo::~TilesetRepo ( )
virtualdefault

◆ TilesetRepo()

porytiles2::TilesetRepo::TilesetRepo ( gsl::not_null< ArtifactChecksumProvider * >  checksum_provider,
gsl::not_null< TilesetArtifactKeyProvider * >  key_provider,
gsl::not_null< TilesetArtifactReader * >  reader,
gsl::not_null< TilesetArtifactWriter * >  writer 
)
inlineexplicit

Constructs a TilesetRepo with the required dependencies.

Initializes the repository with all necessary components for tileset persistence operations. These dependencies provide the concrete implementations for metadata management, key generation, and artifact I/O operations.

Parameters
checksum_providerProvider for computing and caching artifact checksums
key_providerProvider for generating keys and discovering artifacts in the backing store
readerReader implementation for loading artifacts from the backing store
writerWriter implementation for saving artifacts to the backing store

Definition at line 41 of file tileset_repo.hpp.

Member Function Documentation

◆ checksum_provider()

const ArtifactChecksumProvider & porytiles2::TilesetRepo::checksum_provider ( ) const
inline

Gets a reference to the ArtifactChecksumProvider for this repo.

Returns
Reference to the provider

Definition at line 83 of file tileset_repo.hpp.

◆ exists()

bool porytiles2::TilesetRepo::exists ( const std::string &  name) const

Checks if the given Tileset exists in the backing store.

Parameters
nameThe name of the Tileset to check.
Returns
True if the named tileset exists, false otherwise.

Definition at line 333 of file tileset_repo.cpp.

◆ key_provider()

const TilesetArtifactKeyProvider & porytiles2::TilesetRepo::key_provider ( ) const
inline

Gets a reference to the TilesetArtifactKeyProvider for this repo.

Returns
Reference to the provider

Definition at line 93 of file tileset_repo.hpp.

◆ load()

ChainableResult< std::unique_ptr< Tileset > > porytiles2::TilesetRepo::load ( const std::string &  name) const

Loads an existing Tileset from storage.

Parameters
nameThe name of the Tileset to load.
Returns
A Tileset Result on success, otherwise an error description.

Definition at line 132 of file tileset_repo.cpp.

◆ save()

ChainableResult< void > porytiles2::TilesetRepo::save ( const Tileset tileset) const

Persists a given Tileset and caches new artifact checksums.

When persisting a Tileset, the repository saves the tileset and caches new artifact checksums for the persisted data.

Parameters
tilesetThe Tileset to save.
Returns
An empty ChainableResult on success, otherwise an error trace.

Definition at line 24 of file tileset_repo.cpp.


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