OnDiskBlockStore throws an exception earlier (i.e. already in the constructor) if it can't access the base directory

This commit is contained in:
Sebastian Messmer 2015-10-29 15:49:59 +01:00
parent 1bd64c2f7f
commit 7402af10c4

View File

@ -13,7 +13,12 @@ namespace blockstore {
namespace ondisk { namespace ondisk {
OnDiskBlockStore::OnDiskBlockStore(const boost::filesystem::path &rootdir) OnDiskBlockStore::OnDiskBlockStore(const boost::filesystem::path &rootdir)
: _rootdir(rootdir) {} : _rootdir(rootdir) {
if (!bf::exists(rootdir)) {
throw std::runtime_error("Base directory not found");
}
//TODO Test for read access, write access, enter (x) access, and throw runtime_error in case
}
//TODO Do I have to lock tryCreate/remove and/or load? Or does ParallelAccessBlockStore take care of that? //TODO Do I have to lock tryCreate/remove and/or load? Or does ParallelAccessBlockStore take care of that?