Commit c376fafb authored by Daniele Kruse's avatar Daniele Kruse
Browse files

Added the deleteTapeFile functionality to the Nameservers

parent 42e8407c
......@@ -120,6 +120,16 @@ std::list<cta::NameServerTapeFile> cta::CastorNameServer::getTapeFiles(
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// deleteTapeFile
//------------------------------------------------------------------------------
void cta::CastorNameServer::deleteTapeFile(
const SecurityIdentity &requester,
const std::string &path,
const uint16_t copyNb) {
throw exception::Exception(std::string(__FUNCTION__) + " not implemented");
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
......
......@@ -102,6 +102,18 @@ public:
std::list<NameServerTapeFile> getTapeFiles(
const SecurityIdentity &requester,
const std::string &path);
/**
* Delete the specified tape file entry from the archive namespace.
*
* @param requester The identity of the requester.
* @param path The absolute path of the archive file.
* @param copyNb The tape copy to delete.
*/
virtual void deleteTapeFile(
const SecurityIdentity &requester,
const std::string &path,
const uint16_t copyNb);
private:
......
......@@ -261,6 +261,18 @@ public:
const SecurityIdentity &requester,
const std::string &path,
const NameServerTapeFile &tapeFile) = 0;
/**
* Delete the specified tape file entry from the archive namespace.
*
* @param requester The identity of the requester.
* @param path The absolute path of the archive file.
* @param copyNb The tape copy to delete.
*/
virtual void deleteTapeFile(
const SecurityIdentity &requester,
const std::string &path,
const uint16_t copyNb) = 0;
/**
* Gets the tape entries from the archive namespace corresponding the archive
......
......@@ -266,6 +266,26 @@ std::list<cta::NameServerTapeFile> cta::MockNameServer::getTapeFiles(const Secur
return tapeFileList;
}
//------------------------------------------------------------------------------
// deleteTapeFile
//------------------------------------------------------------------------------
void cta::MockNameServer::deleteTapeFile(const SecurityIdentity &requester, const std::string &path, const uint16_t copyNb) {
Utils::assertAbsolutePathSyntax(path);
const std::string fsPath = m_fsDir + path;
assertFsFileExists(fsPath);
switch(copyNb) {
case 1:
Utils::setXattr(fsPath.c_str(), "user.CTATapeFileCopyOne", "");
break;
case 2:
Utils::setXattr(fsPath.c_str(), "user.CTATapeFileCopyTwo", "");
break;
default:
throw exception::Exception(std::string(__FUNCTION__) + ": Invalid copyNb (only supporting 1 and 2 in the MockNameServer)");
break;
}
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
......
......@@ -103,6 +103,18 @@ public:
std::list<NameServerTapeFile> getTapeFiles(
const SecurityIdentity &requester,
const std::string &path);
/**
* Delete the specified tape file entry from the archive namespace.
*
* @param requester The identity of the requester.
* @param path The absolute path of the archive file.
* @param copyNb The tape copy to delete.
*/
virtual void deleteTapeFile(
const SecurityIdentity &requester,
const std::string &path,
const uint16_t copyNb);
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment