autotier
Automatic Tiering Fuse Filesystem
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Config Class Reference

Configuration class. More...

#include <config.hpp>

Inheritance diagram for Config:
Inheritance graph
[legend]
Collaboration diagram for Config:
Collaboration graph
[legend]

Public Types

enum  LogLevel { NONE, NORMAL, DEBUG }
 

Public Member Functions

 Config (const fs::path &config_path, std::list< Tier > &tiers, const ConfigOverrides &config_overrides)
 
 Config (const fs::path &config_path, const ConfigOverrides &config_overrides)
 
size_t copy_buff_sz (void) const
 
std::chrono::seconds tier_period_s (void) const
 
bool strict_period (void) const
 
fs::path run_path (void) const
 
void dump (const std::list< Tier > &tiers, std::stringstream &ss) const
 
- Public Member Functions inherited from ffd::ConfigParser
 ConfigParser (std::string path)
 Construct a new Config Parser object. More...
 
std::string dump_str (void) const
 Dump config to stdout as a string. More...
 
template<class T >
get (const std::string &key) const
 Get value from config map using ffd::get(). This can throw. Use this in a try...catch block. More...
 
template<class T >
get (const std::string &key, const T &fallback) const noexcept
 Try to get value from config, default to fallback if fails. Guaranteed no-throw. More...
 
template<class T >
get (const std::string &key, bool *fail_flag) const noexcept
 Try to get value from config. If ffd::get fails, return T() or 0 and set fail_flag. Guaranteed no-throw. Prints message to std::cerr to explain error. More...
 
template<class T >
get_from (const std::string &section, const std::string &key)
 Adapter for ffd::get(). Sets config_map_ptr_ to address of sub config with name section. This can throw. More...
 
template<class T >
get_from (const std::string &section, const std::string &key, const T &fallback) noexcept
 Get value from config subsection using ConfigParser::get(const std::string&,const T&) const noexcept, return fallback if the subsection DNE. More...
 
template<class T >
get_from (const std::string &section, const std::string &key, bool *fail_flag) noexcept
 Get value from config subsection using ConfigParser::get(const std::string&,bool*) const noexcept, set fail_flag if the subsection DNE. More...
 
Quota get_quota (const std::string &key, const Bytes &max) const
 Get quota from config map using ffd::get(). This can throw. Use this in a try...catch block. More...
 
Quota get_quota (const std::string &key, const Bytes &max, const Quota &fallback) const noexcept
 Try to get Quota from config, default to fallback if fails. Guaranteed no-throw. More...
 
Quota get_quota (const std::string &key, const Bytes &max, bool *fail_flag) const noexcept
 Try to get Quota from config. If ffd::get fails, return Quota(void) and set fail_flag. Guaranteed no-throw. Prints message to std::cerr to explain error. More...
 
Quota get_quota_from (const std::string &section, const std::string &key, const Bytes &max)
 Adapter for ffd::get(). Sets config_map_ptr_ to address of sub config with name section. This can throw. More...
 
Quota get_quota_from (const std::string &section, const std::string &key, const Bytes &max, const Quota &fallback) noexcept
 Get value from config subsection using ConfigParser::get(const std::string&,const T&) const noexcept, return fallback if the subsection DNE. More...
 
Quota get_quota_from (const std::string &section, const std::string &key, const Bytes &max, bool *fail_flag) noexcept
 Get value from config subsection using ConfigParser::get(const std::string&,bool*) const noexcept, set fail_flag if the subsection DNE. More...
 

Private Member Functions

void load_config (const fs::path &config_path, std::list< Tier > &tiers, const ConfigOverrides &config_overrides)
 parse global and tier options, populate list of tiers More...
 

Private Attributes

Logger::log_level_t log_level_
 value read from config file which may be overridden in main() by CLI flags [ –verbose | –quiet ] More...
 
size_t copy_buff_sz_
 Size of buffer for copying a file from one tier to another. 1MiB default. More...
 
std::chrono::seconds tier_period_s_
 Polling period to check whether to send new files in seconds. More...
 
bool strict_period_
 If true, tiering only happens once per period; if false, writing into tier that is over quota will trigger file tiering. More...
 
fs::path run_path_
 Path to database and FIFOs. Default location: /var/lib/autotier. More...
 

Additional Inherited Members

- Protected Attributes inherited from ffd::ConfigParser
std::vector< ConfigNode * > sub_confs_
 Vector of config subsections.
 
std::string current_section_
 Name of current section, set by set_subsection()
 

Detailed Description

Configuration class.

Member Function Documentation

◆ load_config()

void Config::load_config ( const fs::path &  config_path,
std::list< Tier > &  tiers,
const ConfigOverrides config_overrides 
)
private

parse global and tier options, populate list of tiers

Parameters
config_pathPath to config file
tiersList of tiers found in config
config_overridesOverridden config values from CLI flags

Member Data Documentation

◆ copy_buff_sz_

size_t Config::copy_buff_sz_
private

Size of buffer for copying a file from one tier to another. 1MiB default.

◆ log_level_

Logger::log_level_t Config::log_level_
private

value read from config file which may be overridden in main() by CLI flags [ –verbose | –quiet ]

◆ run_path_

fs::path Config::run_path_
private

Path to database and FIFOs. Default location: /var/lib/autotier.

◆ strict_period_

bool Config::strict_period_
private

If true, tiering only happens once per period; if false, writing into tier that is over quota will trigger file tiering.

◆ tier_period_s_

std::chrono::seconds Config::tier_period_s_
private

Polling period to check whether to send new files in seconds.


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