BuildCache
Public Member Functions | Private Member Functions | Private Attributes | List of all members
bcache::cache_t Class Reference

An interface to the different caches. More...

#include <cache.hpp>

Public Member Functions

bool lookup_direct (const std::string &direct_hash, const std::map< std::string, expected_file_t > &expected_files, const bool allow_hard_links, const bool create_target_dirs, int &return_code) noexcept
 Perform a direct mode cache lookup. More...
 
void add_direct (const std::string &direct_hash, const std::string &hash, const string_list_t &implicit_input_files)
 Add a new direct mode entry to the cache. More...
 
bool lookup (const std::string &hash, const std::map< std::string, expected_file_t > &expected_files, const bool allow_hard_links, const bool create_target_dirs, int &return_code) noexcept
 Perform a cache lookup. More...
 
void add (const std::string &hash, const cache_entry_t &entry, const std::map< std::string, expected_file_t > &expected_files, const bool allow_hard_links)
 Add a new entry to the cache(s). More...
 

Private Member Functions

bool lookup_in_local_cache (const std::string &hash, const std::map< std::string, expected_file_t > &expected_files, const bool allow_hard_links, const bool create_target_dirs, int &return_code)
 
bool lookup_in_remote_cache (const std::string &hash, const std::map< std::string, expected_file_t > &expected_files, const bool allow_hard_links, const bool create_target_dirs, int &return_code)
 

Private Attributes

local_cache_t m_local_cache
 
remote_cache_t m_remote_cache
 

Detailed Description

An interface to the different caches.

Member Function Documentation

◆ add()

void bcache::cache_t::add ( const std::string &  hash,
const cache_entry_t entry,
const std::map< std::string, expected_file_t > &  expected_files,
const bool  allow_hard_links 
)

Add a new entry to the cache(s).

Parameters
hashThe hash of the cache entry.
entryThe cache entry description.
expected_filesPaths to the actual files in the local file system (map from file ID to an expected file descriptor).
allow_hard_linksTrue if we are allowed to use hard links.

◆ add_direct()

void bcache::cache_t::add_direct ( const std::string &  direct_hash,
const std::string &  hash,
const string_list_t implicit_input_files 
)

Add a new direct mode entry to the cache.

Parameters
direct_hashThe hash of the direct mode cache entry.
hashThe hash of the preprocessor mode cache entry.
implicit_input_filesA list of implicit input file paths.

◆ lookup()

bool bcache::cache_t::lookup ( const std::string &  hash,
const std::map< std::string, expected_file_t > &  expected_files,
const bool  allow_hard_links,
const bool  create_target_dirs,
int &  return_code 
)
noexcept

Perform a cache lookup.

Parameters
hashThe hash of the cache entry.
expected_filesPaths to the actual files in the local file system (map from file ID to an expected file descriptor).
allow_hard_linksTrue if we are allowed to use hard links.
create_target_dirsTrue if the target directory of the cached file must be created.
[out]return_codeThe return code of the program.
Returns
true if we had a cache hit, otherwise false.

◆ lookup_direct()

bool bcache::cache_t::lookup_direct ( const std::string &  direct_hash,
const std::map< std::string, expected_file_t > &  expected_files,
const bool  allow_hard_links,
const bool  create_target_dirs,
int &  return_code 
)
noexcept

Perform a direct mode cache lookup.

Parameters
direct_hashThe hash of the direct mode cache entry.
expected_filesPaths to the actual files in the local file system (map from file ID to an expected file descriptor).
allow_hard_linksTrue if we are allowed to use hard links.
create_target_dirsTrue if the target directory of the cached file must be created.
[out]return_codeThe return code of the program.
Returns
true if we had a cache hit, otherwise false.

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