コード例 #1
0
void
SCOCacheMountPoint::addNamespace(const backend::Namespace& nspace)
{
    VERIFY(initialised_);

    LOG_INFO(path_ << ": adding namespace " << nspace << " to mountpoint");

    validateNamespace_throw_(nspace);

    if (hasNamespace(nspace))
    {
        // be more forgiving?
        LOG_ERROR(path_ << " namespace " << nspace << " already exists");
        throw fungi::IOException("namespace already exists",
                                 nspace.c_str(),
                                 EEXIST);
    }

    try
    {
        fs::create_directories(path_ / nspace.str());
    }
    catch(std::exception&)
    {
        LOG_ERROR("Problem adding namespace " << nspace << " to mountpoint " <<
                  getPath());
    }
}
コード例 #2
0
void
SCOCacheMountPoint::removeNamespace(const backend::Namespace& nspace)
{
    VERIFY(initialised_);

    LOG_INFO(path_ << ": removing namespace " << nspace << " from mountpoint");

    if (!hasNamespace(nspace))
    {
        // be more forgiving?
        LOG_ERROR(path_ << " namespace " << nspace << " does not exist");
        throw fungi::IOException("namespace does not exist",
                                 nspace.c_str(),
                                 ENOENT);
    }

    validateNamespace_throw_(nspace);
    fs::remove_all(path_ / nspace.str());
}
コード例 #3
0
void
SCOCacheMountPoint::validateNamespace_throw_(const backend::Namespace& nspace)
{
    if (!validateNamespace_(nspace))
    {
        LOG_ERROR("invalid namespace " << nspace);
        throw fungi::IOException("invalid namespace",
                                 nspace.c_str());
    }
}
コード例 #4
0
bool
SCOCacheMountPoint::hasNamespace(const backend::Namespace& nspace)
{
    VERIFY(initialised_);
    return fs::exists(path_ / nspace.str());
}
コード例 #5
0
// Y42: Not needed since lost+found is not a valid namespace name
bool
SCOCacheMountPoint::validateNamespace_(const backend::Namespace& nspace)
{
    return (nspace.str() != "lost+found");
}
コード例 #6
0
std::shared_ptr<failovercache::Backend>
FailOverCacheTestContext::backend(const be::Namespace& nspace)
{
    return acceptor_.find_backend_(nspace.str());
}