Skip to content
Snippets Groups Projects
Commit 42e09821 authored by Daniele Kruse's avatar Daniele Kruse
Browse files

Added the backend location path parameter to castor.conf and passed it to the backendVFS

parent de58886b
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,8 @@
#include <stdio.h>
#include <memory>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/stat.h>
namespace cta { namespace objectstore {
......@@ -161,10 +162,9 @@ void BackendVFS::remove(std::string name) {
bool BackendVFS::exists(std::string name) {
std::string path = m_root + "/" + name;
std::string lockPath = m_root + "/." + name + ".lock";
if (::access(path.c_str(), F_OK) || ::access(lockPath.c_str(), F_OK))
return false;
return true;
std::string lockPath = m_root + "/." + name + ".lock";
struct stat buffer;
return (stat(path.c_str(), &buffer)==0 && stat(lockPath.c_str(), &buffer)==0);
}
......@@ -186,7 +186,7 @@ BackendVFS::ScopedLock * BackendVFS::lockHelper(
std::string name, int type) {
std::string path = m_root + "/." + name + ".lock";
std::unique_ptr<ScopedLock> ret(new ScopedLock);
ret->set(::open(path.c_str(), O_RDONLY, S_IRWXU));
ret->set(::open(path.c_str(), O_RDONLY));
cta::exception::Errnum::throwOnMinusOne(ret->m_fd,
"In BackendStoreVFS::lockHelper, failed to open the lock file.");
cta::exception::Errnum::throwOnMinusOne(::flock(ret->m_fd, LOCK_EX),
......
......@@ -556,7 +556,9 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
zmqContext.get());
/************BEGIN: boilerplate code to prepare the objectstoreDB object**************/
cta::objectstore::BackendVFS g_backend;
cta::objectstore::BackendVFS g_backend(m_config.objectStoreBackendPath);
// Make sure we will not delete the contents of objectstore when deleting the object
g_backend.noDeleteOnExit();
class BackendPopulator {
public:
......
......@@ -53,6 +53,7 @@ castor::tape::tapeserver::daemon::TapeDaemonConfig
config.cupvHost = castorConf.getConfEntString("UPV" , "HOST", log);
config.vdqmHost = castorConf.getConfEntString("VDQM", "HOST", log);
config.vmgrHost = castorConf.getConfEntString("VMGR", "HOST", log);
config.objectStoreBackendPath = castorConf.getConfEntString("TapeServer", "ObjectStoreBackendPath", log);
config.rmcPort = castorConf.getConfEntInt("RMC", "PORT",
(unsigned short)RMC_PORT, log);
config.rmcMaxRqstAttempts = castorConf.getConfEntInt("RMC",
......
......@@ -46,6 +46,11 @@ struct TapeDaemonConfig {
* The CASTOR configuration parameters used by the Catalogue.
*/
CatalogueConfig catalogueConfig;
/**
* This is the path to the objectstore backend
*/
std::string objectStoreBackendPath;
/**
* The network name of the host on which the cupv daemon is running.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment