Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
216bd16d
Commit
216bd16d
authored
May 06, 2019
by
Cedric CAFFY
Browse files
Changed the cta::eos and castor::tape::diskFile namespace into cta::disk namespace
parent
50bdb549
Changes
32
Hide whitespace changes
Inline
Side-by-side
disk/CryptoPPTest.cpp
View file @
216bd16d
...
...
@@ -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
=
ca
stor
::
tape
::
disk
File
::
CryptoPPSigner
::
sign
(
std
::
string
signature
=
c
t
a
::
disk
::
CryptoPPSigner
::
sign
(
payload
,
m_key
);
}
}
...
...
@@ -164,8 +164,8 @@ namespace unitTests {
}
private:
virtual
void
run
()
{
c
astor
::
tape
::
file
::
RadosStriperPool
striperPool
;
ca
stor
::
tape
::
disk
File
::
DiskFileFactory
dff
(
m_keyPath
,
0
,
c
ta
::
disk
::
RadosStriperPool
striperPool
;
c
t
a
::
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
(
ca
stor
::
tape
::
disk
File
::
CryptoPPSigner
::
sign
(
msg
,
CryptoPPKey
));
std
::
string
CryptoPPSign
(
c
t
a
::
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="
,
ca
stor
::
tape
::
disk
File
::
CryptoPPSigner
::
sign
(
"rsoCb+KBj9j9Xk6wr5Cgh+TVuI3eDZHTzD9z8pTFjBPEjdyfiTFIeQ=="
,
CryptoPPKey
));
c
t
a
::
disk
::
CryptoPPSigner
::
sign
(
"rsoCb+KBj9j9Xk6wr5Cgh+TVuI3eDZHTzD9z8pTFjBPEjdyfiTFIeQ=="
,
CryptoPPKey
));
ASSERT_EQ
(
"uf8Cgkwtmh9K1VFLfeIfkZFQMd/pfSGCHNYPByH0nm0COPHNQAkYEI38ez9DS43fsIBVU9Gdrs0x50dVIntzawgzDrjp8YJIeARJF73he8M+6/FUgWJumNMoDE8fdvgiBaCFTv4+di5vtSb/abKVfqY9IbUPSDByxYjDKKI0OF0="
,
ca
stor
::
tape
::
disk
File
::
CryptoPPSigner
::
sign
(
"MtvFsd09F8UQNpwsULF6eMyVkRDIU+uAvBXyJs/LoNM5HrjoJgZrig=="
,
CryptoPPKey
));
c
t
a
::
disk
::
CryptoPPSigner
::
sign
(
"MtvFsd09F8UQNpwsULF6eMyVkRDIU+uAvBXyJs/LoNM5HrjoJgZrig=="
,
CryptoPPKey
));
ASSERT_EQ
(
"EzSR5Fd1kfmdrVhCiYgoWQ7E1MSdv8OYng3L7LepCfS9OStlEFTkJcMezt4VRqUZnarlcIZ0yPAvrmOUscjrAOAbqA0rMYKsvHnAwd19RaH54QZhtRCDwMloxpuLmUC1cmyJ/PAdRoMYCoHiMVr7yQw0CnVJ5168MUe5o0v3swY="
,
ca
stor
::
tape
::
disk
File
::
CryptoPPSigner
::
sign
(
"v3lPb49U+Zz+DNdzoTf2R8AU+AFP+/9/7nLlJV1+HNf3Z+Nzl/HuiQ=="
,
CryptoPPKey
));
c
t
a
::
disk
::
CryptoPPSigner
::
sign
(
"v3lPb49U+Zz+DNdzoTf2R8AU+AFP+/9/7nLlJV1+HNf3Z+Nzl/HuiQ=="
,
CryptoPPKey
));
}
}
disk/DiskFile.cpp
View file @
216bd16d
...
...
@@ -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
,
c
astor
::
tape
::
file
::
RadosStriperPool
&
striperPool
)
:
c
ta
::
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 disk
File
}}
//end of namespace
cta::
disk
disk/DiskFile.hpp
View file @
216bd16d
...
...
@@ -37,15 +37,14 @@
* There is still a single .cpp file
*/
namespace
ca
stor
{
namespace
tape
{
namespace
c
t
a
{
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
,
c
astor
::
tape
::
file
::
RadosStriperPool
&
striperPool
);
c
ta
::
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
;
c
astor
::
tape
::
file
::
RadosStriperPool
&
m_striperPool
;
c
ta
::
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
disk/DiskFileImplementations.hpp
View file @
216bd16d
...
...
@@ -32,12 +32,11 @@
#include
<cryptopp/rsa.h>
#include
<radosstriper/libradosstriper.hpp>
namespace
ca
stor
{
namespace
tape
{
namespace
c
t
a
{
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 disk
File
}
}
}
//end of namespace disk
}
disk/DiskReporter.hpp
View file @
216bd16d
...
...
@@ -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
disk/DiskReporterFactory.cpp
View file @
216bd16d
...
...
@@ -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
);
...
...
disk/DiskReporterFactory.hpp
View file @
216bd16d
...
...
@@ -25,7 +25,7 @@
#include
<string>
#include
<future>
namespace
cta
{
namespace
eos
{
namespace
cta
{
namespace
disk
{
class
DiskReporterFactory
{
public:
...
...
disk/EOSReporter.cpp
View file @
216bd16d
...
...
@@ -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
)
{}
...
...
disk/EOSReporter.hpp
View file @
216bd16d
...
...
@@ -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
{
...
...
disk/NullReporter.hpp
View file @
216bd16d
...
...
@@ -20,7 +20,7 @@
#include
"DiskReporter.hpp"
namespace
cta
{
namespace
eos
{
namespace
cta
{
namespace
disk
{
class
NullReporter
:
public
DiskReporter
{
public:
...
...
disk/RadosStriperPool.cpp
View file @
216bd16d
...
...
@@ -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
disk/RadosStriperPool.hpp
View file @
216bd16d
...
...
@@ -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
scheduler/ArchiveJob.hpp
View file @
216bd16d
...
...
@@ -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.
...
...
scheduler/ArchiveMount.cpp
View file @
216bd16d
...
...
@@ -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
);
}
...
...
scheduler/ArchiveMount.hpp
View file @
216bd16d
...
...
@@ -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
scheduler/DiskReportRunner.hpp
View file @
216bd16d
...
...
@@ -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
scheduler/OStoreDB/OStoreDB.cpp
View file @
216bd16d
...
...
@@ -4131,7 +4131,7 @@ void OStoreDB::RepackArchiveReportBatch::report(log::LogContext& lc){
}
timingList
.
insertAndReset
(
"asyncUpdateOrDeleteLaunchTime"
,
t
);
struct
DiskFileRemovers
{
std
::
unique_ptr
<
ca
stor
::
tape
::
disk
File
::
AsyncDiskFileRemover
>
asyncRemover
;
std
::
unique_ptr
<
c
t
a
::
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
ca
stor
::
tape
::
disk
File
::
AsyncDiskFileRemoverFactory
asyncDiskFileRemoverFactory
;
std
::
unique_ptr
<
ca
stor
::
tape
::
disk
File
::
AsyncDiskFileRemover
>
asyncRemover
(
asyncDiskFileRemoverFactory
.
createAsyncDiskFileRemover
(
d
.
subrequestInfo
.
repackInfo
.
fileBufferURL
));
c
t
a
::
disk
::
AsyncDiskFileRemoverFactory
asyncDiskFileRemoverFactory
;
std
::
unique_ptr
<
c
t
a
::
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
ca
stor
::
tape
::
disk
File
::
DirectoryFactory
directoryFactory
;
c
t
a
::
disk
::
DirectoryFactory
directoryFactory
;
std
::
string
directoryPath
=
cta
::
utils
::
getEnclosingPath
(
bufferURL
);
std
::
unique_ptr
<
ca
stor
::
tape
::
disk
File
::
Directory
>
directory
;
std
::
unique_ptr
<
c
t
a
::
disk
::
Directory
>
directory
;
try
{
directory
.
reset
(
directoryFactory
.
createDirectory
(
directoryPath
));
directory
->
rmdir
();
...
...
scheduler/RetrieveMount.cpp
View file @
216bd16d
...
...
@@ -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
);
}
...
...
scheduler/RetrieveMount.hpp
View file @
216bd16d
...
...
@@ -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
...
...
scheduler/Scheduler.cpp
View file @
216bd16d
...
...
@@ -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
<<
"/"
;
ca
stor
::
tape
::
disk
File
::
DirectoryFactory
dirFactory
;
std
::
unique_ptr
<
ca
stor
::
tape
::
disk
File
::
Directory
>
dir
;
c
t
a
::
disk
::
DirectoryFactory
dirFactory
;
std
::
unique_ptr
<
c
t
a
::
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
())){
c
astor
::
tape
::
file
::
RadosStriperPool
radosStriperPool
;
ca
stor
::
tape
::
disk
File
::
DiskFileFactory
fileFactory
(
""
,
0
,
radosStriperPool
);
ca
stor
::
tape
::
disk
File
::
ReadFile
*
fileReader
=
fileFactory
.
createReadFile
(
dirBufferURL
.
str
()
+
fileName
.
str
());
c
ta
::
disk
::
RadosStriperPool
radosStriperPool
;
c
t
a
::
disk
::
DiskFileFactory
fileFactory
(
""
,
0
,
radosStriperPool
);
c
t
a
::
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
;
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment