Commit 6cbb249e authored by Steven Murray's avatar Steven Murray
Browse files

Added Scheduler::checkAndGetNextArchiveFileId()

parent 54b1e56a
......@@ -84,6 +84,27 @@ void Scheduler::authorizeAdmin(const common::dataStructures::SecurityIdentity &c
lc.log(log::INFO, "In Scheduler::authorizeAdmin(): success.");
}
//------------------------------------------------------------------------------
// checkAndGetNextArchiveFileId
//------------------------------------------------------------------------------
uint64_t Scheduler::checkAndGetNextArchiveFileId(const std::string &instanceName,
const std::string &storageClassName, const common::dataStructures::UserIdentity &user, log::LogContext &lc) {
cta::utils::Timer t;
const uint64_t archiveFileId = m_catalogue.checkAndGetNextArchiveFileId(instanceName, storageClassName, user);
const auto catalogueTime = t.secs();
const auto schedulerDbTime = catalogueTime;
log::ScopedParamContainer spc(lc);
spc.add("instanceName", instanceName)
.add("storageClass", storageClassName)
.add("fileId", archiveFileId)
.add("catalogueTime", catalogueTime)
.add("schedulerDbTime", schedulerDbTime);
lc.log(log::INFO, "Checked request and got next archive file ID");
return archiveFileId;
}
//------------------------------------------------------------------------------
// queueArchive
//------------------------------------------------------------------------------
......
......@@ -87,6 +87,28 @@ public:
*/
void ping(log::LogContext & lc);
/**
* Checks the specified archival could take place and returns a new and
* unique archive file identifier that can be used by a new archive file
* within the catalogue.
*
* @param diskInstanceName The name of the disk instance to which the
* storage class belongs.
* @param storageClassName The name of the storage class of the file to be
* archived. The storage class name is only guaranteed to be unique within
* its disk instance. The storage class name will be used by the Catalogue
* to determine the destination tape pool for each tape copy.
* @param user The user for whom the file is to be archived. This will be
* used by the Catalogue to determine the mount policy to be used when
* archiving the file.
* @return The new archive file identifier.
*/
uint64_t checkAndGetNextArchiveFileId(
const std::string &diskInstanceName,
const std::string &storageClassName,
const common::dataStructures::UserIdentity &user,
log::LogContext &lc);
/**
* Queue an archive request and return the CTA file ID.
* Throws a UserError exception in case of wrong request parameters (ex. no route to tape)
......
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