mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-29 11:26:44 -05:00
add file caching across opens and runtime control
This commit is contained in:
parent
02b657edff
commit
529a953e30
13 changed files with 601 additions and 336 deletions
|
|
@ -52,6 +52,7 @@ Config::Config()
|
|||
cache_symlinks(false),
|
||||
cache_readdir(false),
|
||||
async_read(true),
|
||||
cache_files(CacheFiles::LIBFUSE),
|
||||
POLICYINIT(access),
|
||||
POLICYINIT(chmod),
|
||||
POLICYINIT(chown),
|
||||
|
|
@ -124,3 +125,74 @@ Config::set_category_policy(const string &category_,
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Config::CacheFiles::operator int() const
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
Config::CacheFiles::operator std::string() const
|
||||
{
|
||||
switch(_data)
|
||||
{
|
||||
case OFF:
|
||||
return "off";
|
||||
case PARTIAL:
|
||||
return "partial";
|
||||
case FULL:
|
||||
return "full";
|
||||
case AUTO_FULL:
|
||||
return "auto-full";
|
||||
case LIBFUSE:
|
||||
return "libfuse";
|
||||
case INVALID:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
Config::CacheFiles::CacheFiles()
|
||||
: _data(INVALID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Config::CacheFiles::CacheFiles(Config::CacheFiles::Enum data_)
|
||||
: _data(data_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
Config::CacheFiles::valid() const
|
||||
{
|
||||
return (_data != INVALID);
|
||||
}
|
||||
|
||||
Config::CacheFiles&
|
||||
Config::CacheFiles::operator=(const Config::CacheFiles::Enum data_)
|
||||
{
|
||||
_data = data_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Config::CacheFiles&
|
||||
Config::CacheFiles::operator=(const std::string &data_)
|
||||
{
|
||||
if(data_ == "off")
|
||||
_data = OFF;
|
||||
else if(data_ == "partial")
|
||||
_data = PARTIAL;
|
||||
else if(data_ == "full")
|
||||
_data = FULL;
|
||||
else if(data_ == "auto-full")
|
||||
_data = AUTO_FULL;
|
||||
else if(data_ == "libfuse")
|
||||
_data = LIBFUSE;
|
||||
else
|
||||
_data = INVALID;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue