BuildCache
Public Member Functions | Static Protected Member Functions | Private Member Functions | List of all members
bcache::remote_cache_provider_t Class Referenceabstract
Inheritance diagram for bcache::remote_cache_provider_t:
bcache::http_cache_provider_t bcache::redis_cache_provider_t bcache::s3_cache_provider_t

Public Member Functions

virtual ~remote_cache_provider_t ()
 De-initialzie the remote cache object.
 
virtual bool connect (const std::string &host_description)=0
 Connect to the remote cache. More...
 
virtual bool is_connected () const =0
 Check if we have a connection to the remote cache. More...
 
virtual cache_entry_t lookup (const std::string &hash)=0
 Check if an entry exists in the cache. More...
 
virtual void add (const std::string &hash, const cache_entry_t &entry, const std::map< std::string, expected_file_t > &expected_files)=0
 Adds a set of files to the cache. More...
 
virtual void get_file (const std::string &hash, const std::string &source_id, const std::string &target_path, const bool is_compressed)=0
 Copy a cached file to the local file system. More...
 

Static Protected Member Functions

static bool parse_host_description (const std::string &host_description, std::string &host, int &port, std::string &path)
 Parse a host description string. More...
 
static int connection_timeout_ms ()
 Get the timeout for remote connections. More...
 
static int transfer_timeout_ms ()
 Get the timeout for remote transfers. More...
 

Private Member Functions

 remote_cache_provider_t (const remote_cache_provider_t &)=delete
 
remote_cache_provider_toperator= (const remote_cache_provider_t &)=delete
 

Member Function Documentation

◆ add()

virtual void bcache::remote_cache_provider_t::add ( const std::string &  hash,
const cache_entry_t entry,
const std::map< std::string, expected_file_t > &  expected_files 
)
pure virtual

Adds a set of files to the cache.

Parameters
hashThe cache entry identifier.
entryThe cache entry data (files, stdout, etc).
expected_filesPaths to the actual files in the local file system (map from file ID to an expected file descriptor).

Implemented in bcache::redis_cache_provider_t, and bcache::http_cache_provider_t.

◆ connect()

virtual bool bcache::remote_cache_provider_t::connect ( const std::string &  host_description)
pure virtual

Connect to the remote cache.

Parameters
host_descriptionA string describing the host to connect to (excluding protocol).
Returns
true if the connection was successful.

Implemented in bcache::redis_cache_provider_t, bcache::http_cache_provider_t, and bcache::s3_cache_provider_t.

◆ connection_timeout_ms()

int bcache::remote_cache_provider_t::connection_timeout_ms ( )
staticprotected

Get the timeout for remote connections.

Returns
the timeout, in milliseconds.

◆ get_file()

virtual void bcache::remote_cache_provider_t::get_file ( const std::string &  hash,
const std::string &  source_id,
const std::string &  target_path,
const bool  is_compressed 
)
pure virtual

Copy a cached file to the local file system.

Parameters
hashThe cache entry identifier.
source_idThe ID of the remote file to copy.
target_pathThe path to the local file.
is_compressedTrue if the remote data is compressed.

Implemented in bcache::redis_cache_provider_t, and bcache::http_cache_provider_t.

◆ is_connected()

virtual bool bcache::remote_cache_provider_t::is_connected ( ) const
pure virtual

Check if we have a connection to the remote cache.

Returns
true if we have a connection to the remote cache.

Implemented in bcache::redis_cache_provider_t, and bcache::http_cache_provider_t.

◆ lookup()

virtual cache_entry_t bcache::remote_cache_provider_t::lookup ( const std::string &  hash)
pure virtual

Check if an entry exists in the cache.

Parameters
hashThe cache entry identifier.
Returns
A cache entry struct. If there was no cache hit the entry will be empty.

Implemented in bcache::redis_cache_provider_t, and bcache::http_cache_provider_t.

◆ parse_host_description()

bool bcache::remote_cache_provider_t::parse_host_description ( const std::string &  host_description,
std::string &  host,
int &  port,
std::string &  path 
)
staticprotected

Parse a host description string.

Parameters
host_descriptionThe host description string.
[out]hostThe host name.
[out]portThe port (optional - defaults to -1).
[out]pathThe path (optional - defaults to "").
Returns
true if the parser was successful, or false if it failed.

◆ transfer_timeout_ms()

int bcache::remote_cache_provider_t::transfer_timeout_ms ( )
staticprotected

Get the timeout for remote transfers.

Returns
the timeout, in milliseconds.

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