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
a857fdba
Commit
a857fdba
authored
Aug 24, 2015
by
Daniele Kruse
Browse files
Started restructuring the Archive/Retrieve Job
parent
6a46cb58
Changes
30
Hide whitespace changes
Inline
Side-by-side
common/CMakeLists.txt
View file @
a857fdba
...
...
@@ -9,12 +9,11 @@ set (COMMON_LIB_SRC_FILES
archiveRoutes/ArchiveRouteId.cpp
archiveNS/ArchiveDirEntry.cpp
archiveNS/ArchiveDirIterator.cpp
archiveNS/ArchiveFile
Info
.cpp
archiveNS/ArchiveFile.cpp
archiveNS/ArchiveFileStatus.cpp
archiveNS/StorageClass.cpp
archiveNS/Tape.cpp
archiveNS/TapeCopyInfo.cpp
archiveNS/TapeCopyLocationAndStatus.cpp
archiveNS/TapeFileLocation.cpp
CreationLog.cpp
checksum/ByteArray.cpp
checksum/Checksum.cpp
...
...
common/archiveNS/
TapeCopyLocationAndStatus
.cpp
→
common/archiveNS/
ArchiveFile
.cpp
View file @
a857fdba
...
...
@@ -16,27 +16,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"
common/archiveNS/TapeCopyLocationAndStatus
.hpp"
#include
"
ArchiveFile
.hpp"
namespace
cta
{
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
TapeCopyLocationAndStatus
::
TapeCopyLocationAndStatus
()
{
ArchiveFile
::
ArchiveFile
()
:
fileId
(
0
),
size
(
0
),
lastModificationTime
(
0
)
{
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
TapeCopyLocationAndStatus
::
TapeCopyLocationAndStatus
(
const
std
::
string
&
vid
,
const
uint64_t
fSeq
,
const
uint64_t
blockId
,
const
uint64_t
size
,
const
uint64_t
fileId
,
const
Checksum
&
checksum
)
:
vid
(
vid
),
fSeq
(
fSeq
),
blockId
(
blockId
),
size
(
size
),
fileId
(
fileId
),
checksum
(
checksum
)
{}
ArchiveFile
::
ArchiveFile
(
const
std
::
string
&
path
,
const
std
::
string
&
nsHostName
,
uint64_t
fileId
,
uint64_t
size
,
const
Checksum
&
checksum
,
const
time_t
lastModificationTime
)
:
path
(
path
),
nsHostName
(
nsHostName
),
fileId
(
fileId
),
size
(
size
),
checksum
(
checksum
),
lastModificationTime
(
lastModificationTime
)
{}
}
common/archiveNS/ArchiveFile
Info
.hpp
→
common/archiveNS/ArchiveFile.hpp
View file @
a857fdba
...
...
@@ -25,22 +25,55 @@ namespace cta {
/**
* A class containing the location and properties of an archive file.
*/
class
ArchiveFile
Info
{
class
ArchiveFile
{
public:
/**
* Constructor.
*/
ArchiveFile
Info
();
ArchiveFile
();
/**
* Constructor.
*
* @param path The location of the file at NS lookup time
* @param nsHostName The NS host name
* @param fileId The file ID (to be used in the tape copy header)
* @param size The file size
* @param checksum The file checksum
* @param lastModificationTime The last modification time of the file
*/
ArchiveFile
Info
(
const
std
::
string
&
lastKnownPath
,
uint64_t
fileId
,
ArchiveFile
(
const
std
::
string
&
path
,
const
std
::
string
&
nsHostName
,
uint64_t
fileId
,
uint64_t
size
,
const
Checksum
&
checksum
,
const
time_t
lastModificationTime
);
std
::
string
lastKnownPath
;
/**< The location of the file at NS lookup time */
uint64_t
fileId
;
/**< The file ID (to be used in the tape copy header, among other */
uint64_t
size
;
/**< The file's size */
/**
* The location of the file at NS lookup time
*/
std
::
string
path
;
/**
* The NS host name
*/
std
::
string
nsHostName
;
/**
* The file ID (to be used in the tape copy header)
*/
uint64_t
fileId
;
/**
* The file size
*/
uint64_t
size
;
/**
* The file checksum
*/
Checksum
checksum
;
/**
* The last modification time of the file
*/
time_t
lastModificationTime
;
};
}
common/archiveNS/ArchiveFileInfo.cpp
deleted
100644 → 0
View file @
6a46cb58
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"ArchiveFileInfo.hpp"
namespace
cta
{
ArchiveFileInfo
::
ArchiveFileInfo
()
:
fileId
(
0
),
size
(
0
),
lastModificationTime
(
0
)
{
}
ArchiveFileInfo
::
ArchiveFileInfo
(
const
std
::
string
&
lastKnownPath
,
uint64_t
fileId
,
uint64_t
size
,
const
Checksum
&
checksum
,
const
time_t
lastModificationTime
)
:
lastKnownPath
(
lastKnownPath
),
fileId
(
fileId
),
size
(
size
),
checksum
(
checksum
),
lastModificationTime
(
lastModificationTime
)
{}
}
common/archiveNS/TapeCopyLocationAndStatus.hpp
deleted
100644 → 0
View file @
6a46cb58
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include
<string>
#include
"common/archiveNS/ArchiveFileStatus.hpp"
namespace
cta
{
/**
* The path and status of an archive file.
*/
struct
TapeCopyLocationAndStatus
{
/** Constructor. */
TapeCopyLocationAndStatus
();
/**
* Constructor.
*
* @param path The path of the file in the archive.
* @param status The status of the file in the archive.
*/
TapeCopyLocationAndStatus
(
const
std
::
string
&
vid
,
const
uint64_t
fSeq
,
const
uint64_t
blockId
,
const
uint64_t
size
,
const
uint64_t
fileId
,
const
Checksum
&
checksum
);
std
::
string
vid
;
/**< The tape on which the copy is located */
uint64_t
fSeq
;
/**< The file sequence number (fSeq) for the copy on tape */
uint64_t
blockId
;
/**< The tape block holding the first header block for the file */
uint64_t
size
;
/**< The tape copy's size */
uint64_t
fileId
;
/**< The file ID as recorded in the tape copy's header */
Checksum
checksum
;
/**< The tape copy's checksum */
/**
* The hostname of the nameserver holding the file
*/
std
::
string
nsHostName
;
};
// class TapeCopyLocationAndStatus
}
// namespace cta
common/archiveNS/Tape
CopyInfo
.cpp
→
common/archiveNS/Tape
FileLocation
.cpp
View file @
a857fdba
...
...
@@ -16,23 +16,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/archiveNS/Tape
CopyInfo
.hpp"
#include
"common/archiveNS/Tape
FileLocation
.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
Tape
CopyInfo
::
TapeCopyInfo
()
:
cta
::
Tape
FileLocation
::
TapeFileLocation
()
:
fSeq
(
0
),
blockId
(
0
)
{
blockId
(
0
),
vid
(
""
),
copyNumber
(
0
)
{
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
TapeCopyInfo
::
TapeCopyInfo
(
const
std
::
string
&
vid
,
const
uint64_t
fSeq
,
const
uint64_t
blockId
,
uint16_t
copyNumber
)
:
vid
(
vid
),
cta
::
TapeFileLocation
::
TapeFileLocation
(
const
uint64_t
fSeq
,
const
uint64_t
blockId
,
const
std
::
string
&
vid
,
const
uint8_t
copyNumber
)
:
fSeq
(
fSeq
),
blockId
(
blockId
),
vid
(
vid
),
copyNumber
(
copyNumber
)
{
}
common/archiveNS/Tape
CopyInfo
.hpp
→
common/archiveNS/Tape
FileLocation
.hpp
View file @
a857fdba
...
...
@@ -26,38 +26,22 @@ namespace cta {
/**
* The location of a tape copy.
*/
struct
Tape
CopyInfo
{
struct
Tape
FileLocation
{
/**
* Constructor.
*/
Tape
CopyInfo
();
Tape
FileLocation
();
/**
* Constructor.
*
* @param vid The volume identifier of the tape.
* @param fSeq The sequence number of the file.
* @param blockId The block identifier of the file.
* @param copyNumber The copy number for this tape copy.
* @param vid The vid of the tape containing the file. TODO: to be put in the mount object in the future
* @param copyNumber The copy number of the tape file. TODO: to be put in the mount object in the future
*/
TapeCopyInfo
(
const
std
::
string
&
vid
,
const
uint64_t
fSeq
,
const
uint64_t
blockId
,
uint16_t
copyNumber
);
/**
* The path of the archive file.
*/
//std::string archiveFilePath;
/**
* The ID of the file
*/
//uint64_t fileId;
/**
* The volume identifier of the tape.
*/
std
::
string
vid
;
TapeFileLocation
(
const
uint64_t
fSeq
,
const
uint64_t
blockId
,
const
std
::
string
&
vid
,
const
uint8_t
copyNumber
);
/**
* The sequence number of the file.
...
...
@@ -70,15 +54,15 @@ struct TapeCopyInfo {
uint64_t
blockId
;
/**
* The
hostname of the nameserver hold
in
g
the f
il
e
* The
vid of the tape containing the file. TODO: to be put in the mount object
in the f
utur
e
*/
std
::
string
nsHostName
;
std
::
string
vid
;
/**
* The copy number f
or
th
is
tape
copy
* The copy number
o
f th
e
tape
file. TODO: to be put in the mount object in the future
*/
uint
16
_t
copyNumber
;
uint
8
_t
copyNumber
;
};
// struct Tape
Copy
Location
};
// struct Tape
File
Location
}
// namepsace cta
common/remoteFS/RemoteFileStatus.hpp
View file @
a857fdba
...
...
@@ -59,9 +59,7 @@ struct RemoteFileStatus {
mode_t
mode
;
/**
* Returns the size of the file in bytes.
*
* @return The size of the file in bytes.
* The size of the file in bytes.
*/
uint64_t
size
;
...
...
scheduler/ArchiveJob.cpp
View file @
a857fdba
...
...
@@ -27,23 +27,14 @@ cta::ArchiveJob::~ArchiveJob() throw() {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
ArchiveJob
::
ArchiveJob
()
{
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
ArchiveJob
::
ArchiveJob
(
const
std
::
string
&
tapePoolName
,
const
ArchiveFileInfo
&
archiveFile
,
const
RemotePathAndStatus
&
remoteFile
,
const
TapeCopyLocationAndStatus
&
tapeCopy
,
const
uint16_t
copyNb
)
:
tapePoolName
(
tapePoolName
),
cta
::
ArchiveJob
::
ArchiveJob
(
/*ArchiveMount &mount,*/
const
ArchiveFile
&
archiveFile
,
const
RemotePathAndStatus
&
remotePathAndStatus
,
const
TapeFileLocation
&
tapeFileLocation
)
:
/*mount(mount),*/
archiveFile
(
archiveFile
),
remoteFile
(
remoteFile
),
tapeCopy
(
tapeCopy
),
copyNumber
(
copyNb
)
{}
remotePathAndStatus
(
remotePathAndStatus
),
tapeFileLocation
(
tapeFileLocation
)
{}
//------------------------------------------------------------------------------
// complete
...
...
@@ -55,7 +46,7 @@ void cta::ArchiveJob::complete() {
//------------------------------------------------------------------------------
// failed
//------------------------------------------------------------------------------
void
cta
::
ArchiveJob
::
failed
()
{
void
cta
::
ArchiveJob
::
failed
(
const
cta
::
exception
::
Exception
&
ex
)
{
throw
NotImplemented
(
""
);
}
...
...
scheduler/ArchiveJob.hpp
View file @
a857fdba
...
...
@@ -18,8 +18,8 @@
#pragma once
#include
"common/archiveNS/Tape
Copy
Location
AndStatus
.hpp"
#include
"common/archiveNS/ArchiveFile
Info
.hpp"
#include
"common/archiveNS/Tape
File
Location.hpp"
#include
"common/archiveNS/ArchiveFile.hpp"
#include
"common/exception/Exception.hpp"
#include
"common/remoteFS/RemotePathAndStatus.hpp"
...
...
@@ -27,10 +27,9 @@
#include
<string>
namespace
cta
{
// Forward declaration
// class ArchivePath;
class
ArchiveMount
;
class
RemotePathAndStatus
;
// Forward declaration
class
ArchiveMount
;
/**
* Class representing the transfer of a single copy of a remote file to tape.
...
...
@@ -42,33 +41,26 @@ class ArchiveJob {
* constructor of ArchiveJob.
*/
friend
class
ArchiveMount
;
CTA_GENERATE_EXCEPTION_CLASS
(
NotImplemented
);
protected:
/**
* Constructor. It is not protected as the ArchiveJob is generated by the
* ArchiveMount.
* Empty constructor. TODO: to be removed in the future when we put in the reference to the owning mount;
*/
ArchiveJob
()
;
ArchiveJob
()
{}
/**
* Constructor. It is not protected as the ArchiveJob is generated by the
* ArchiveMount.
*
* @param tapePoolName the name of the tape pool the tape copy should be
* stored in.
* @param archiveFile informations about the file for which we are storing
* this tape copy.
* @param remoteFile location and properties of the remote file
* @param copyNb the copy number
* Constructor.
*
* @param mount the mount that generated this job
* @param archiveFile informations about the file that we are storing
* @param remotePathAndStatus location and properties of the remote file
* @param tapeFileLocation the location within the tape
*/
ArchiveJob
(
const
std
::
string
&
tapePoolName
,
const
ArchiveFileInfo
&
archiveFile
,
const
RemotePathAndStatus
&
remoteFile
,
const
TapeCopyLocationAndStatus
&
tapeCopy
,
const
uint16_t
copyNb
);
ArchiveJob
(
/*ArchiveMount &mount,*/
const
ArchiveFile
&
archiveFile
,
const
RemotePathAndStatus
&
remotePathAndStatus
,
const
TapeFileLocation
&
tapeFileLocation
);
public:
...
...
@@ -77,31 +69,11 @@ public:
*/
virtual
~
ArchiveJob
()
throw
()
=
0
;
/**
* Returns the name of the destination tape pool.
*
* @return the name of the destination tape pool.
*/
const
std
::
string
&
getTapePoolName
()
const
throw
();
/**
* Returns the The URL of the remote source file.
*
* @return The The URL of the remote source file.
*/
std
::
string
getRemoteFile
()
const
throw
();
/**
* Indicates that the job was successful and updates the backend store
*
*/
virtual
void
complete
();
/**
* Stores the reason for a failure prior to calling failed();
* @param ex the reason for failure in the form of an exception.
*/
void
setFailureReason
(
const
cta
::
exception
::
Exception
&
ex
);
/**
* Triggers a scheduler update following the failure of the job.
...
...
@@ -113,7 +85,7 @@ public:
* in a second thread.
*
*/
virtual
void
failed
();
virtual
void
failed
(
const
cta
::
exception
::
Exception
&
ex
);
/**
* Indicates that the job should be tried again (typically reaching the end
...
...
@@ -122,19 +94,28 @@ public:
virtual
void
retry
();
public:
std
::
string
tapePoolName
;
/**< The name of the destination tape pool. */
ArchiveFileInfo
archiveFile
;
/**< All information related to the archive file for which we
* are recording this tape copy. */
RemotePathAndStatus
remoteFile
;
/**< The size of the file to be archived in bytes. */
TapeCopyLocationAndStatus
tapeCopy
;
uint16_t
copyNumber
;
/**< The copy number for this tape copy */
CTA_GENERATE_EXCEPTION_CLASS
(
LocationNotSet
);
/**< Accessor to the tape location status */
CTA_GENERATE_EXCEPTION_CLASS
(
NotImplemented
);
/**
* The mount that generated this job
*/
//ArchiveMount &mount;
/**
* The NS archive file information
*/
ArchiveFile
archiveFile
;
/**
* The remote file information
*/
RemotePathAndStatus
remotePathAndStatus
;
/**
* The location of the tape file
*/
TapeFileLocation
tapeFileLocation
;
};
// class ArchiveJob
...
...
scheduler/ArchiveMount.cpp
View file @
a857fdba
...
...
@@ -52,6 +52,20 @@ std::string cta::ArchiveMount::getDensity() const throw() {
return
"UNKNOWN_DENSITY_FOR_ARCHIVE_MOUNT"
;
}
//------------------------------------------------------------------------------
// getPoolName
//------------------------------------------------------------------------------
std
::
string
cta
::
ArchiveMount
::
getPoolName
()
const
throw
()
{
return
"UNKNOWN_POOL_FOR_ARCHIVE_MOUNT"
;
}
//------------------------------------------------------------------------------
// getCopyNumber
//------------------------------------------------------------------------------
int
cta
::
ArchiveMount
::
getCopyNumber
()
const
throw
()
{
return
1
;
}
//------------------------------------------------------------------------------
// getMountTransactionId
//------------------------------------------------------------------------------
...
...
scheduler/ArchiveMount.hpp
View file @
a857fdba
...
...
@@ -102,6 +102,20 @@ namespace cta {
*/
std
::
unique_ptr
<
ArchiveJob
>
getNextJob
();
/**
* Returns the tape pool of the tape to be mounted.
*
* @return The tape pool of the tape to be mounted.
*/
virtual
std
::
string
getPoolName
()
const
throw
();
/**
* Returns the copy number of the tape to be mounted.
*
* @return The copy number of the tape to be mounted.
*/
virtual
int
getCopyNumber
()
const
throw
();
/**
* Destructor.
*/
...
...
scheduler/OStoreDB/OStoreDB.cpp
View file @
a857fdba
...
...
@@ -37,7 +37,7 @@
#include
"common/archiveNS/Tape.hpp"
#include
"ArchiveToDirRequest.hpp"
#include
"RetrieveToFileRequest.hpp"
#include
"common/archiveNS/Tape
CopyInfo
.hpp"
#include
"common/archiveNS/Tape
FileLocation
.hpp"
#include
"RetrieveToDirRequest.hpp"
#include
"ArchiveToTapeCopyRequest.hpp"
#include
<algorithm>
...
...
scheduler/RetrieveFromTapeCopyRequest.cpp
View file @
a857fdba
...
...
@@ -17,7 +17,7 @@
*/
#include
"scheduler/RetrieveFromTapeCopyRequest.hpp"
#include
"common/archiveNS/Tape
CopyInfo
.hpp"
#include
"common/archiveNS/Tape
FileLocation
.hpp"
//------------------------------------------------------------------------------
// constructor
...
...
@@ -37,7 +37,7 @@ cta::RetrieveFromTapeCopyRequest::~RetrieveFromTapeCopyRequest() throw() {
cta
::
RetrieveFromTapeCopyRequest
::
RetrieveFromTapeCopyRequest
(
const
std
::
string
&
archiveFile
,
const
uint64_t
copyNb
,
const
Tape
CopyInfo
&
tapeCopy
,
const
Tape
FileLocation
&
tapeCopy
,
const
std
::
string
&
remoteFile
,
const
uint64_t
priority
,
const
CreationLog
&
creationLog
)
:
...
...
scheduler/RetrieveFromTapeCopyRequest.hpp
View file @
a857fdba
...
...
@@ -19,7 +19,7 @@
#pragma once
#include
"scheduler/RetrieveRequest.hpp"
#include
"common/archiveNS/Tape
CopyInfo
.hpp"
#include
"common/archiveNS/Tape
FileLocation
.hpp"
#include
<list>
#include
<string>
...
...
@@ -57,7 +57,7 @@ struct RetrieveFromTapeCopyRequest: public RetrieveRequest {
RetrieveFromTapeCopyRequest
(
const
std
::
string
&
archiveFile
,
const
uint64_t
copyNb
,
const
Tape
CopyInfo
&
tapeCopy
,
const
Tape
FileLocation
&
tapeCopy
,
const
std
::
string
&
remoteFile
,
const
uint64_t
priority
,
const
CreationLog
&
creationLog
);
...
...
@@ -75,7 +75,7 @@ struct RetrieveFromTapeCopyRequest: public RetrieveRequest {
/**
* The location of the copy on tape.
*/
Tape
CopyInfo
tapeCopy
;
Tape
FileLocation
tapeCopy
;
/**
* The URL of the destination remote file.
...
...
scheduler/RetrieveJob.cpp
View file @
a857fdba
...
...
@@ -27,23 +27,16 @@ cta::RetrieveJob::~RetrieveJob() throw() {
//------------------------------------------------------------------------------