Commit 216bd16d authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

Changed the cta::eos and castor::tape::diskFile namespace into cta::disk namespace

parent 50bdb549
......@@ -38,7 +38,7 @@ namespace unitTests {
virtual void run() {
for (int i=0; i<100; i++) {
std::string payload = "Some payload... And some more...";
std::string signature = castor::tape::diskFile::CryptoPPSigner::sign(
std::string signature = cta::disk::CryptoPPSigner::sign(
payload, m_key);
}
}
......@@ -164,8 +164,8 @@ namespace unitTests {
}
private:
virtual void run() {
castor::tape::file::RadosStriperPool striperPool;
castor::tape::diskFile::DiskFileFactory dff(m_keyPath, 0,
cta::disk::RadosStriperPool striperPool;
cta::disk::DiskFileFactory dff(m_keyPath, 0,
striperPool);
for (int i=0; i<5; i++) {
// Read keys in parallel and in a loop to test MT protection of the
......@@ -230,7 +230,7 @@ namespace unitTests {
// This is the output of:
// echo -n 'Any random message will do!' | openssl dgst -sha1 -sign ~/testRSAPrivate.pem | openssl enc -base64 | tr -d '\n' ; echo
std::string osslSign("bfqLxACTFS7fMKH5ewNUOaglRlIGCEPWGhx4fRPErFGHtuCi2yWlYFsXIfjBxOT+yCyKRpTnZWGJTbcP72eT7os2qCqIOejAM3nTcsChHN5f3UyADvsi1f7C3DqhYVKVFQPaBdb3zm8IBHsFjmu2EzVE5juc1C9L+ztVmoABptw=");
std::string CryptoPPSign(castor::tape::diskFile::CryptoPPSigner::sign(msg,CryptoPPKey));
std::string CryptoPPSign(cta::disk::CryptoPPSigner::sign(msg,CryptoPPKey));
// std::cout << CryptoPPSign << std::endl;
ASSERT_EQ(osslSign,CryptoPPSign);
// A few examples generated with openssl's command line:
......@@ -241,10 +241,10 @@ namespace unitTests {
// ~/testRSAPrivate.pem contains the same content as the variable somePrivateKey.
ASSERT_EQ("O8nSHzVPXyNRGRu8vaQ+CrqJjlv28qdsiFCTjlmeMFgc/aEnlJq+2b2q5al7BiHmPAFOd6fUkvn8xlFBm9IUlPFENhPLuMKJGqRSBndE7At0t+/vbS9UVnKiuOjrFepXo8JOvbt7lpqfp3jBwrQE5OZpOT92Nh8GXlpiCksvoxI=",
castor::tape::diskFile::CryptoPPSigner::sign("rsoCb+KBj9j9Xk6wr5Cgh+TVuI3eDZHTzD9z8pTFjBPEjdyfiTFIeQ==",CryptoPPKey));
cta::disk::CryptoPPSigner::sign("rsoCb+KBj9j9Xk6wr5Cgh+TVuI3eDZHTzD9z8pTFjBPEjdyfiTFIeQ==",CryptoPPKey));
ASSERT_EQ("uf8Cgkwtmh9K1VFLfeIfkZFQMd/pfSGCHNYPByH0nm0COPHNQAkYEI38ez9DS43fsIBVU9Gdrs0x50dVIntzawgzDrjp8YJIeARJF73he8M+6/FUgWJumNMoDE8fdvgiBaCFTv4+di5vtSb/abKVfqY9IbUPSDByxYjDKKI0OF0=",
castor::tape::diskFile::CryptoPPSigner::sign("MtvFsd09F8UQNpwsULF6eMyVkRDIU+uAvBXyJs/LoNM5HrjoJgZrig==",CryptoPPKey));
cta::disk::CryptoPPSigner::sign("MtvFsd09F8UQNpwsULF6eMyVkRDIU+uAvBXyJs/LoNM5HrjoJgZrig==",CryptoPPKey));
ASSERT_EQ("EzSR5Fd1kfmdrVhCiYgoWQ7E1MSdv8OYng3L7LepCfS9OStlEFTkJcMezt4VRqUZnarlcIZ0yPAvrmOUscjrAOAbqA0rMYKsvHnAwd19RaH54QZhtRCDwMloxpuLmUC1cmyJ/PAdRoMYCoHiMVr7yQw0CnVJ5168MUe5o0v3swY=",
castor::tape::diskFile::CryptoPPSigner::sign("v3lPb49U+Zz+DNdzoTf2R8AU+AFP+/9/7nLlJV1+HNf3Z+Nzl/HuiQ==",CryptoPPKey));
cta::disk::CryptoPPSigner::sign("v3lPb49U+Zz+DNdzoTf2R8AU+AFP+/9/7nLlJV1+HNf3Z+Nzl/HuiQ==",CryptoPPKey));
}
}
......@@ -35,12 +35,11 @@
#include <cryptopp/base64.h>
#include <cryptopp/osrng.h>
namespace castor {
namespace tape {
namespace diskFile {
namespace cta {
namespace disk {
DiskFileFactory::DiskFileFactory(const std::string & xrootPrivateKeyFile, uint16_t xrootTimeout,
castor::tape::file::RadosStriperPool & striperPool):
cta::disk::RadosStriperPool & striperPool):
m_NoURLLocalFile("^(localhost:|)(/.*)$"),
m_NoURLRemoteFile("^([^:]*:)(.*)$"),
m_NoURLRadosStriperFile("^localhost:([^/]+)/(.*)$"),
......@@ -795,4 +794,4 @@ std::set<std::string> XRootdDirectory::getFilesName(){
return ret;
}
}}} //end of namespace diskFile
}} //end of namespace cta::disk
......@@ -37,15 +37,14 @@
* There is still a single .cpp file
*/
namespace castor {
namespace tape {
namespace cta {
namespace disk {
// Forward declaration of RadosStriperPool
namespace file { class RadosStriperPool; }
class RadosStriperPool;
/**
* Namespace managing the reading and writing of files to and from disk.
*/
namespace diskFile {
class ReadFile;
class WriteFile;
......@@ -60,7 +59,7 @@ namespace castor {
typedef cta::utils::Regex Regex;
public:
DiskFileFactory(const std::string & xrootPrivateKey, uint16_t xrootTimeout,
castor::tape::file::RadosStriperPool & striperPool);
cta::disk::RadosStriperPool & striperPool);
ReadFile * createReadFile(const std::string & path);
WriteFile * createWriteFile(const std::string & path);
private:
......@@ -74,7 +73,7 @@ namespace castor {
CryptoPP::RSA::PrivateKey m_xrootPrivateKey;
bool m_xrootPrivateKeyLoaded;
const uint16_t m_xrootTimeout;
castor::tape::file::RadosStriperPool & m_striperPool;
cta::disk::RadosStriperPool & m_striperPool;
public:
/** Return the private key. Read it from the file if necessary. */
......@@ -240,7 +239,6 @@ namespace castor {
std::string m_URL;
};
} //end of namespace diskFile
}}
} //end of namespace disk
} //end of namespace cta
......@@ -32,12 +32,11 @@
#include <cryptopp/rsa.h>
#include <radosstriper/libradosstriper.hpp>
namespace castor {
namespace tape {
namespace cta {
namespace disk {
/**
* Namespace managing the reading and writing of files to and from disk.
*/
namespace diskFile {
//Forward declarations
class XRootdDiskFileRemover;
......@@ -278,5 +277,5 @@ namespace castor {
const uint16_t c_xrootTimeout = 15;
};
} //end of namespace diskFile
}}
} //end of namespace disk
}
......@@ -20,7 +20,7 @@
#include <future>
namespace cta { namespace eos {
namespace cta { namespace disk {
class DiskReporter {
public:
......@@ -31,4 +31,4 @@ protected:
std::promise<void> m_promise;
};
}} // name space cta::clientsystem
\ No newline at end of file
}} // name space cta::disk
\ No newline at end of file
......@@ -22,7 +22,7 @@
#include "common/exception/Exception.hpp"
#include "common/threading/MutexLocker.hpp"
namespace cta { namespace eos {
namespace cta { namespace disk {
DiskReporter* DiskReporterFactory::createDiskReporter(const std::string URL) {
threading::MutexLocker ml(m_mutex);
......
......@@ -25,7 +25,7 @@
#include <string>
#include <future>
namespace cta { namespace eos {
namespace cta { namespace disk {
class DiskReporterFactory {
public:
......
......@@ -21,7 +21,7 @@
#include "EOSReporter.hpp"
#include "common/exception/XrootCl.hpp"
namespace cta { namespace eos {
namespace cta { namespace disk {
EOSReporter::EOSReporter(const std::string& hostURL, const std::string& queryValue):
m_fs(hostURL), m_query(queryValue) {}
......
......@@ -23,7 +23,7 @@
#include <future>
namespace cta { namespace eos {
namespace cta { namespace disk {
const uint16_t CTA_EOS_QUERY_TIMEOUT = 15; // Timeout in seconds that is rounded up to the nearest 15 seconds
class EOSReporter: public DiskReporter, public XrdCl::ResponseHandler {
......
......@@ -20,7 +20,7 @@
#include "DiskReporter.hpp"
namespace cta { namespace eos {
namespace cta { namespace disk {
class NullReporter: public DiskReporter {
public:
......
......@@ -36,9 +36,8 @@ private:
};
}
namespace castor {
namespace tape {
namespace file {
namespace cta {
namespace disk {
//------------------------------------------------------------------------------
// Accessor to next striper pool index
......@@ -157,6 +156,5 @@ void RadosStriperPool::disconnectAll() {
m_stripers.clear();
}
} // namespace file
} // namespace tape
} // namespace castor
} // namespace disk
} // namespace cta
......@@ -24,9 +24,8 @@
#include <map>
#include <memory>
namespace castor {
namespace tape {
namespace file {
namespace cta {
namespace disk {
/**
* Utility singleton managing the rados stripers connections by name.
* The destructor will implicitly release the pool connections.
......@@ -78,6 +77,5 @@ private:
unsigned int m_striperIdx;
};
} // namespace file
} // namespace tape
} // namespace castor
} // namespace disk
} // namespace cta
\ No newline at end of file
......@@ -131,7 +131,7 @@ private:
/**
* The reporter for the job. TODO: this should be generic and fed with a factory.
*/
std::unique_ptr<cta::eos::DiskReporter> m_reporter;
std::unique_ptr<cta::disk::DiskReporter> m_reporter;
/**
* Report time measurement.
......
......@@ -117,7 +117,7 @@ void cta::ArchiveMount::checkTapeFSeqAndDeleteTapeFilesForWriting(uint64_t fSeq)
//------------------------------------------------------------------------------
// createDiskReporter
//------------------------------------------------------------------------------
cta::eos::DiskReporter* cta::ArchiveMount::createDiskReporter(std::string& URL) {
cta::disk::DiskReporter* cta::ArchiveMount::createDiskReporter(std::string& URL) {
return m_reporterFactory.createDiskReporter(URL);
}
......
......@@ -186,7 +186,7 @@ namespace cta {
* @param reporterState void promise to be set when the report is done asynchronously.
* @return pointer to the reporter created.
*/
eos::DiskReporter * createDiskReporter(std::string & URL);
disk::DiskReporter * createDiskReporter(std::string & URL);
/**
* Update the catalog with a set of TapeFileWritten events.
......@@ -219,7 +219,7 @@ namespace cta {
private:
/** An initialized-once factory for archive reports (indirectly used by ArchiveJobs) */
eos::DiskReporterFactory m_reporterFactory;
disk::DiskReporterFactory m_reporterFactory;
}; // class ArchiveMount
} // namespace cta
......@@ -33,6 +33,6 @@ public:
private:
Scheduler & m_scheduler;
eos::DiskReporterFactory m_reporterFactory;
disk::DiskReporterFactory m_reporterFactory;
};
} // namespace cta
\ No newline at end of file
......@@ -4131,7 +4131,7 @@ void OStoreDB::RepackArchiveReportBatch::report(log::LogContext& lc){
}
timingList.insertAndReset("asyncUpdateOrDeleteLaunchTime", t);
struct DiskFileRemovers{
std::unique_ptr<castor::tape::diskFile::AsyncDiskFileRemover> asyncRemover;
std::unique_ptr<cta::disk::AsyncDiskFileRemover> asyncRemover;
RepackReportBatch::SubrequestInfo<objectstore::ArchiveRequest> & subrequestInfo;
typedef std::list<DiskFileRemovers> List;
};
......@@ -4145,8 +4145,8 @@ void OStoreDB::RepackArchiveReportBatch::report(log::LogContext& lc){
lc.log(log::INFO, "In OStoreDB::RepackArchiveReportBatch::report(): deleted request.");
try {
//Subrequest deleted, async delete the file from the disk
castor::tape::diskFile::AsyncDiskFileRemoverFactory asyncDiskFileRemoverFactory;
std::unique_ptr<castor::tape::diskFile::AsyncDiskFileRemover> asyncRemover(asyncDiskFileRemoverFactory.createAsyncDiskFileRemover(d.subrequestInfo.repackInfo.fileBufferURL));
cta::disk::AsyncDiskFileRemoverFactory asyncDiskFileRemoverFactory;
std::unique_ptr<cta::disk::AsyncDiskFileRemover> asyncRemover(asyncDiskFileRemoverFactory.createAsyncDiskFileRemover(d.subrequestInfo.repackInfo.fileBufferURL));
diskFileRemoverList.push_back({std::move(asyncRemover),d.subrequestInfo});
diskFileRemoverList.back().asyncRemover->asyncDelete();
} catch (const cta::exception::Exception &ex){
......@@ -4185,9 +4185,9 @@ void OStoreDB::RepackArchiveReportBatch::report(log::LogContext& lc){
}
if(repackRequestStatus == objectstore::serializers::RepackRequestStatus::RRS_Complete){
//Repack Request is complete, delete the directory in the buffer
castor::tape::diskFile::DirectoryFactory directoryFactory;
cta::disk::DirectoryFactory directoryFactory;
std::string directoryPath = cta::utils::getEnclosingPath(bufferURL);
std::unique_ptr<castor::tape::diskFile::Directory> directory;
std::unique_ptr<cta::disk::Directory> directory;
try{
directory.reset(directoryFactory.createDirectory(directoryPath));
directory->rmdir();
......
......@@ -216,7 +216,7 @@ void cta::RetrieveMount::flushAsyncSuccessReports(std::queue<std::unique_ptr<cta
//------------------------------------------------------------------------------
// createDiskReporter()
//------------------------------------------------------------------------------
cta::eos::DiskReporter* cta::RetrieveMount::createDiskReporter(std::string& URL) {
cta::disk::DiskReporter* cta::RetrieveMount::createDiskReporter(std::string& URL) {
return m_reporterFactory.createDiskReporter(URL);
}
......
......@@ -181,7 +181,7 @@ namespace cta {
* @param URL: report address
* @return pointer to the reporter created.
*/
eos::DiskReporter * createDiskReporter(std::string & URL);
disk::DiskReporter * createDiskReporter(std::string & URL);
/**
* Destructor.
......@@ -211,7 +211,7 @@ namespace cta {
bool m_diskRunning;
/** An initialized-once factory for archive reports (indirectly used by ArchiveJobs) */
eos::DiskReporterFactory m_reporterFactory;
disk::DiskReporterFactory m_reporterFactory;
}; // class RetrieveMount
......
......@@ -441,8 +441,8 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
cta::catalogue::ArchiveFileItor archiveFilesForCatalogue = m_catalogue.getArchiveFilesForRepackItor(repackInfo.vid, fSeq);
std::stringstream dirBufferURL;
dirBufferURL << repackInfo.repackBufferBaseURL << "/" << repackInfo.vid << "/";
castor::tape::diskFile::DirectoryFactory dirFactory;
std::unique_ptr<castor::tape::diskFile::Directory> dir;
cta::disk::DirectoryFactory dirFactory;
std::unique_ptr<cta::disk::Directory> dir;
dir.reset(dirFactory.createDirectory(dirBufferURL.str()));
std::set<std::string> filesInDirectory;
if(dir->exist()){
......@@ -483,9 +483,9 @@ void Scheduler::expandRepackRequest(std::unique_ptr<RepackRequest>& repackReques
fileName << std::setw(9) << std::setfill('0') << retrieveSubRequest.fSeq;
bool createArchiveSubrequest = false;
if(filesInDirectory.count(fileName.str())){
castor::tape::file::RadosStriperPool radosStriperPool;
castor::tape::diskFile::DiskFileFactory fileFactory("",0,radosStriperPool);
castor::tape::diskFile::ReadFile *fileReader = fileFactory.createReadFile(dirBufferURL.str() + fileName.str());
cta::disk::RadosStriperPool radosStriperPool;
cta::disk::DiskFileFactory fileFactory("",0,radosStriperPool);
cta::disk::ReadFile *fileReader = fileFactory.createReadFile(dirBufferURL.str() + fileName.str());
if(fileReader->size() == archiveFile.fileSize){
createArchiveSubrequest = true;
retrieveSubrequests.pop_back();
......@@ -1389,11 +1389,11 @@ SchedulerDatabase::JobsFailedSummary Scheduler::getRetrieveJobsFailedSummary(log
// reportArchiveJobsBatch
//------------------------------------------------------------------------------
void Scheduler::reportArchiveJobsBatch(std::list<std::unique_ptr<ArchiveJob> >& archiveJobsBatch,
eos::DiskReporterFactory & reporterFactory, log::TimingList& timingList, utils::Timer& t,
disk::DiskReporterFactory & reporterFactory, log::TimingList& timingList, utils::Timer& t,
log::LogContext& lc){
// Create the reporters
struct JobAndReporter {
std::unique_ptr<eos::DiskReporter> reporter;
std::unique_ptr<disk::DiskReporter> reporter;
ArchiveJob * archiveJob;
};
std::list<JobAndReporter> pendingReports;
......@@ -1460,11 +1460,11 @@ void Scheduler::reportArchiveJobsBatch(std::list<std::unique_ptr<ArchiveJob> >&
//------------------------------------------------------------------------------
void Scheduler::
reportRetrieveJobsBatch(std::list<std::unique_ptr<RetrieveJob>> & retrieveJobsBatch,
eos::DiskReporterFactory & reporterFactory, log::TimingList & timingList, utils::Timer & t, log::LogContext & lc)
disk::DiskReporterFactory & reporterFactory, log::TimingList & timingList, utils::Timer & t, log::LogContext & lc)
{
// Create the reporters
struct JobAndReporter {
std::unique_ptr<eos::DiskReporter> reporter;
std::unique_ptr<disk::DiskReporter> reporter;
RetrieveJob * retrieveJob;
};
std::list<JobAndReporter> pendingReports;
......
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