コード例 #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::validateNamespace_throw_(const backend::Namespace& nspace)
{
    if (!validateNamespace_(nspace))
    {
        LOG_ERROR("invalid namespace " << nspace);
        throw fungi::IOException("invalid namespace",
                                 nspace.c_str());
    }
}
コード例 #3
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());
}