|
| | local_cache_t () |
| | Initialize the cache object. More...
|
| |
|
| ~local_cache_t () |
| | De-initialzie the cache object.
|
| |
|
void | clear () |
| | Clear all entries in the cache.
|
| |
|
void | show_stats () |
| | Show cache statistics (print to standard out).
|
| |
|
void | zero_stats () |
| | Clear the cache statistics.
|
| |
| void | add_direct (const std::string &direct_hash, const direct_mode_manifest_t &manifest) |
| | Add a new direct mode entry to the cache. More...
|
| |
| direct_mode_manifest_t | lookup_direct (const std::string &direct_hash) |
| | Check if a direct mode entry exists in the cache. 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 set of files to the cache. More...
|
| |
| std::pair< cache_entry_t, file::file_lock_t > | lookup (const std::string &hash) |
| | Check if an entry exists in the cache. More...
|
| |
| void | get_file (const std::string &hash, const std::string &source_id, const std::string &target_path, const bool is_compressed, const bool allow_hard_links) |
| | Copy a cached file to the local file system. More...
|
| |
| bool | update_stats (const std::string &hash, const cache_stats_t &delta) const noexcept |
| | Update statistics associated with the given entry. More...
|
| |
|
|
std::string | hash_to_cache_entry_path (const std::string &hash) const |
| |
|
std::string | get_cache_files_folder () const |
| |
|
void | perform_housekeeping () |
| |
◆ local_cache_t()
| bcache::local_cache_t::local_cache_t |
( |
| ) |
|
Initialize the cache object.
- Exceptions
-
| runtime_error | if the cache could not be initialized. |
◆ add()
| void bcache::local_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 set of files to the cache.
- Parameters
-
| hash | The cache entry identifier. |
| entry | The cache entry data (files, stdout, etc). |
| expected_files | Paths to the actual files in the local file system (map from file ID to an expected file descriptor). |
| allow_hard_links | Whether or not to allow hard links to be used when caching files. |
◆ add_direct()
| void bcache::local_cache_t::add_direct |
( |
const std::string & |
direct_hash, |
|
|
const direct_mode_manifest_t & |
manifest |
|
) |
| |
Add a new direct mode entry to the cache.
- Parameters
-
| direct_hash | The hash of the direct mode cache entry. |
| manifest | The direct mode manifest. |
◆ get_file()
| void bcache::local_cache_t::get_file |
( |
const std::string & |
hash, |
|
|
const std::string & |
source_id, |
|
|
const std::string & |
target_path, |
|
|
const bool |
is_compressed, |
|
|
const bool |
allow_hard_links |
|
) |
| |
Copy a cached file to the local file system.
- Parameters
-
| hash | The cache entry identifier. |
| source_id | The ID of the cached file to copy. |
| target_path | The path to the local file. |
| is_compressed | True if the cached data is compressed. |
| allow_hard_links | True if hard links are allowed. |
◆ lookup()
Check if an entry exists in the cache.
- Parameters
-
| hash | The cache entry identifier. |
- Returns
- A pair of a cache entry struct and a file lock object. If there was no cache hit, the entry will be empty, and the file lock object will not hold any lock.
◆ lookup_direct()
Check if a direct mode entry exists in the cache.
- Parameters
-
| direct_hash | The hash of the direct mode cache entry. |
- Returns
- A a direct mode manifest. If there was no cache hit the manifest will be empty.
◆ update_stats()
| bool bcache::local_cache_t::update_stats |
( |
const std::string & |
hash, |
|
|
const cache_stats_t & |
delta |
|
) |
| const |
|
noexcept |
Update statistics associated with the given entry.
- Parameters
-
| hash | The hash of the entry to which the stats belong. |
| delta | The incremental stats delta. |
- Returns
- true if the stats were successfully updated, otherwise false.
- Note
- The hash argument is only used for selecting where in the local cache structure to store the stats file.
The documentation for this class was generated from the following files: