BuildCache
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
bcache::cache_entry_t Class Reference

Meta data for a single cache entry. More...

#include <cache_entry.hpp>

Public Types

enum  comp_mode_t { comp_mode_t::NONE = 0, comp_mode_t::ALL = 1 }
 Compression mode. More...
 

Public Member Functions

 cache_entry_t ()
 Construct an empty/invalid cache entry.
 
 cache_entry_t (const std::vector< std::string > &file_ids, const comp_mode_t compression_mode, const std::string &std_out, const std::string &std_err, const int return_code)
 Construct a valid cache entry. More...
 
 operator bool () const
 
std::string serialize () const
 Serialize a cache entry. More...
 
const std::vector< std::string > & file_ids () const
 
comp_mode_t compression_mode () const
 
const std::string & std_out () const
 
const std::string & std_err () const
 
int return_code () const
 

Static Public Member Functions

static cache_entry_t deserialize (const std::string &data)
 Deserialize a cache entry. More...
 

Private Attributes

std::vector< std::string > m_file_ids
 
comp_mode_t m_compression_mode = comp_mode_t::NONE
 
std::string m_std_out
 
std::string m_std_err
 
int m_return_code = 0
 
bool m_valid = false
 

Detailed Description

Meta data for a single cache entry.

Member Enumeration Documentation

◆ comp_mode_t

Compression mode.

Enumerator
NONE 

Compress nothing (i.e. the entry is uncompressed in the cache).

ALL 

Compress all files and stdout + stderr.

Constructor & Destructor Documentation

◆ cache_entry_t()

bcache::cache_entry_t::cache_entry_t ( const std::vector< std::string > &  file_ids,
const comp_mode_t  compression_mode,
const std::string &  std_out,
const std::string &  std_err,
const int  return_code 
)

Construct a valid cache entry.

Parameters
file_idsID:s of the cached files.
compression_modeCompression mode.
std_outstdout from the program run.
std_errstderr from the program run.
return_codeProgram return code (0 = success).

Member Function Documentation

◆ compression_mode()

comp_mode_t bcache::cache_entry_t::compression_mode ( ) const
inline
Returns
the compression mode.

◆ deserialize()

cache_entry_t bcache::cache_entry_t::deserialize ( const std::string &  data)
static

Deserialize a cache entry.

Parameters
dataThe serialized data.
Returns
the deserialized cache entry.

◆ file_ids()

const std::vector<std::string>& bcache::cache_entry_t::file_ids ( ) const
inline
Returns
the ID:s of the cached files.

◆ operator bool()

bcache::cache_entry_t::operator bool ( ) const
inline
Returns
true if this object represents a valid cache entry. E.g. for a cache miss, the return value is false.

◆ return_code()

int bcache::cache_entry_t::return_code ( ) const
inline
Returns
the program return code (0 = success).

◆ serialize()

std::string bcache::cache_entry_t::serialize ( ) const

Serialize a cache entry.

Returns
a serialized data as a string object.

◆ std_err()

const std::string& bcache::cache_entry_t::std_err ( ) const
inline
Returns
the stderr from the program run.

◆ std_out()

const std::string& bcache::cache_entry_t::std_out ( ) const
inline
Returns
the stdout from the program run.

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