libassetmap  1.0.0
Hash-table based archive format containing compressed data
Public Member Functions | List of all members
AssetMap::DirectoryMetadata Class Reference

Public Member Functions

 DirectoryMetadata (const IHasher &hasher, ICompress &comp, const std::filesystem::directory_entry &ent)
 Construct an instance of DirectoryMetadata. More...
 
size_t TotalRequiredSpace () const noexcept
 Obtain the worst-case required space to compress the directory passed to the constructor for the given hash and compression algo. More...
 
ptrdiff_t DataStart () const noexcept
 Obtain the offset for the beginning of data entries. More...
 
decltype(buckets) const & Buckets () const noexcept
 Obtain a list of buckets and their entries. More...
 

Constructor & Destructor Documentation

◆ DirectoryMetadata()

AssetMap::DirectoryMetadata::DirectoryMetadata ( const IHasher &  hasher,
ICompress &  comp,
const std::filesystem::directory_entry &  ent 
)
explicit

Construct an instance of DirectoryMetadata.

The constructor will iterate through the directory passed and compute all necessary data required to archive it. Iteration is recursive and anything that is not a regular file will be ignored.

Parameters
hasherAny implementation satisfying IHasher.
compAny implementation satisfying ICompress.
entAn entry that references a valid, readable directory.

Member Function Documentation

◆ Buckets()

decltype(buckets) const& AssetMap::DirectoryMetadata::Buckets ( ) const
noexcept

Obtain a list of buckets and their entries.

This function provides a vector of vector of directory_entries. The indexable position of an outer vector element is its bucket ID. Every directory entry is guaranteed to be a regular file. Or at least, it was at the time of inspection - if you (or something else) change the on-filesystem data, things may break.

Returns
vector<vector<fs::directory_entry>>

◆ DataStart()

ptrdiff_t AssetMap::DirectoryMetadata::DataStart ( ) const
noexcept

Obtain the offset for the beginning of data entries.

Returns
The equivalent of [file start] + [size of all bucket data]

◆ TotalRequiredSpace()

size_t AssetMap::DirectoryMetadata::TotalRequiredSpace ( ) const
noexcept

Obtain the worst-case required space to compress the directory passed to the constructor for the given hash and compression algo.

Returns
The size required to compress the entire dir contents.

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