mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Rework policies to return branches rather than path strings
This commit is contained in:
parent
7e084ea7db
commit
86b50d2d4e
86 changed files with 1259 additions and 3088 deletions
|
|
@ -27,25 +27,24 @@
|
|||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lfs
|
||||
{
|
||||
static
|
||||
int
|
||||
create(const Branches::CPtr &branches_,
|
||||
StrVec *paths_)
|
||||
create(const Branches::Ptr &branches_,
|
||||
std::vector<Branch*> &paths_)
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
uint64_t lfs;
|
||||
fs::info_t info;
|
||||
const string *basepath;
|
||||
Branch *obranch;
|
||||
|
||||
obranch = nullptr;
|
||||
error = ENOENT;
|
||||
lfs = std::numeric_limits<uint64_t>::max();
|
||||
basepath = NULL;
|
||||
for(const auto &branch : *branches_)
|
||||
for(auto &branch : *branches_)
|
||||
{
|
||||
if(branch.ro_or_nc())
|
||||
error_and_continue(error,EROFS);
|
||||
|
|
@ -60,38 +59,38 @@ namespace lfs
|
|||
continue;
|
||||
|
||||
lfs = info.spaceavail;
|
||||
basepath = &branch.path;
|
||||
obranch = &branch;
|
||||
}
|
||||
|
||||
if(basepath == NULL)
|
||||
if(!obranch)
|
||||
return (errno=error,-1);
|
||||
|
||||
paths_->push_back(*basepath);
|
||||
paths_.push_back(obranch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
Policy::LFS::Action::operator()(const Branches::CPtr &branches_,
|
||||
Policy::LFS::Action::operator()(const Branches::Ptr &branches_,
|
||||
const char *fusepath_,
|
||||
StrVec *paths_) const
|
||||
std::vector<Branch*> &paths_) const
|
||||
{
|
||||
return Policies::Action::eplfs(branches_,fusepath_,paths_);
|
||||
}
|
||||
|
||||
int
|
||||
Policy::LFS::Create::operator()(const Branches::CPtr &branches_,
|
||||
Policy::LFS::Create::operator()(const Branches::Ptr &branches_,
|
||||
const char *fusepath_,
|
||||
StrVec *paths_) const
|
||||
std::vector<Branch*> &paths_) const
|
||||
{
|
||||
return ::lfs::create(branches_,paths_);
|
||||
}
|
||||
|
||||
int
|
||||
Policy::LFS::Search::operator()(const Branches::CPtr &branches_,
|
||||
Policy::LFS::Search::operator()(const Branches::Ptr &branches_,
|
||||
const char *fusepath_,
|
||||
StrVec *paths_) const
|
||||
std::vector<Branch*> &paths_) const
|
||||
{
|
||||
return Policies::Search::eplfs(branches_,fusepath_,paths_);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue