Commit aac771e5 authored by Steven Murray's avatar Steven Murray
Browse files

DataTransferSessionGooddayRecall compiles but is far from complete

parent 0a3732b6
......@@ -34,6 +34,13 @@ add_library (ctascheduler SHARED
target_link_libraries (ctascheduler ${SQLITE3_LIBRARY_RELEASE} ctacommon)
include_directories(${CMAKE_BINARY_DIR})
add_library(ctaOStoreSchedulerDB SHARED
OStoreDB/OStoreDB.cpp)
target_link_libraries(ctaOStoreSchedulerDB
CTAObjectStore)
add_library (ctaschedulerunittests SHARED
mockDB/MockSchedulerDatabase.cpp
mockDB/MockSchedulerDatabaseFactory.cpp
......@@ -43,13 +50,6 @@ add_library (ctaschedulerunittests SHARED
target_link_libraries (ctaschedulerunittests ${SQLITE3_LIBRARY_RELEASE})
include_directories(${CMAKE_BINARY_DIR})
add_library(ctaOStoreSchedulerDB SHARED
OStoreDB/OStoreDB.cpp)
target_link_libraries(ctaOStoreSchedulerDB
CTAObjectStore)
target_link_libraries(ctaschedulerunittests
ctascheduler
ctaOStoreSchedulerDB)
/*
* 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 "scheduler/DummyScheduler.hpp"
//-----------------------------------------------------------------------------
// constructor
//-----------------------------------------------------------------------------
Scheduler() {
}
//-----------------------------------------------------------------------------
// destructor
//-----------------------------------------------------------------------------
~Scheduler() throw() {
}
//-----------------------------------------------------------------------------
// getArchiveRequests
//-----------------------------------------------------------------------------
std::map<TapePool, std::list<ArchiveToTapeCopyRequest> > getArchiveRequests(
const SecurityIdentity &requester) const;
//-----------------------------------------------------------------------------
// getArchiveRequests
//-----------------------------------------------------------------------------
std::list<ArchiveToTapeCopyRequest> getArchiveRequests(
const SecurityIdentity &requester,
const std::string &tapePoolName) const;
//-----------------------------------------------------------------------------
// deleteArchiveRequest
//-----------------------------------------------------------------------------
void deleteArchiveRequest(
const SecurityIdentity &requester,
const std::string &remoteFile);
//-----------------------------------------------------------------------------
// getRetrieveRequests
//-----------------------------------------------------------------------------
std::map<Tape, std::list<RetrieveFromTapeCopyRequest> > getRetrieveRequests(
const SecurityIdentity &requester) const;
// getRetrieveRequests
std::list<RetrieveFromTapeCopyRequest> getRetrieveRequests(
const SecurityIdentity &requester,
const std::string &vid) const;
void deleteRetrieveRequest(
const SecurityIdentity &requester,
const std::string &remoteFile);
void createAdminUser(
const SecurityIdentity &requester,
const UserIdentity &user,
const std::string &comment);
void createAdminUserWithoutAuthorizingRequester(
const SecurityIdentity &requester,
const UserIdentity &user,
const std::string &comment);
void deleteAdminUser(
const SecurityIdentity &requester,
const UserIdentity &user);
std::list<AdminUser> getAdminUsers(const SecurityIdentity &requester) const;
void createAdminHost(
const SecurityIdentity &requester,
const std::string &hostName,
const std::string &comment);
void createAdminHostWithoutAuthorizingRequester(
const SecurityIdentity &requester,
const std::string &hostName,
const std::string &comment);
void deleteAdminHost(
const SecurityIdentity &requester,
const std::string &hostName);
std::list<AdminHost> getAdminHosts(const SecurityIdentity &requester) const;
void createStorageClass(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbCopies,
const std::string &comment);
void createStorageClass(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbCopies,
const uint32_t id,
const std::string &comment);
void deleteStorageClass(
const SecurityIdentity &requester,
const std::string &name);
std::list<StorageClass> getStorageClasses(
const SecurityIdentity &requester) const;
void createTapePool(
const SecurityIdentity &requester,
const std::string &name,
const uint32_t nbPartialTapes,
const std::string &comment);
void deleteTapePool(
const SecurityIdentity &requester,
const std::string &name);
std::list<TapePool> getTapePools(
const SecurityIdentity &requester) const;
void createArchiveRoute(
const SecurityIdentity &requester,
const std::string &storageClassName,
const uint16_t copyNb,
const std::string &tapePoolName,
const std::string &comment);
void deleteArchiveRoute(
const SecurityIdentity &requester,
const std::string &storageClassName,
const uint16_t copyNb);
std::list<ArchiveRoute> getArchiveRoutes(
const SecurityIdentity &requester) const;
void createLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name,
const std::string &comment);
void deleteLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name);
std::list<LogicalLibrary> getLogicalLibraries(
const SecurityIdentity &requester) const;
void createTape(
const SecurityIdentity &requester,
const std::string &vid,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
const CreationLog &creationLog);
void deleteTape(
const SecurityIdentity &requester,
const std::string &vid);
Tape getTape(
const SecurityIdentity &requester,
const std::string &vid) const;
std::list<Tape> getTapes(
const SecurityIdentity &requester) const;
void createDir(
const SecurityIdentity &requester,
const std::string &path,
const mode_t mode);
void setOwner(
const SecurityIdentity &requester,
const std::string &path,
const UserIdentity &owner);
UserIdentity getOwner(
const SecurityIdentity &requester,
const std::string &path) const;
void deleteDir(
const SecurityIdentity &requester,
const std::string &path);
std::string getVidOfFile(
const SecurityIdentity &requester,
const std::string &path,
const uint16_t copyNb) const;
ArchiveDirIterator getDirContents(
const SecurityIdentity &requester,
const std::string &path) const;
std::unique_ptr<ArchiveFileStatus> statArchiveFile(
const SecurityIdentity &requester,
const std::string &path) const;
void setDirStorageClass(
const SecurityIdentity &requester,
const std::string &path,
const std::string &storageClassName);
void clearDirStorageClass(
const SecurityIdentity &requester,
const std::string &path);
std::string getDirStorageClass(
const SecurityIdentity &requester,
const std::string &path) const;
void queueArchiveRequest(
const SecurityIdentity &requester,
const std::list<std::string> &remoteFiles,
const std::string &archiveFileOrDir);
void queueRetrieveRequest(
const SecurityIdentity &requester,
const std::list<std::string> &archiveFiles,
const std::string &remoteFileOrDir);
std::unique_ptr<TapeMount> getNextMount(const std::string &logicalLibraryName,
const std::string & driveName);
/*
* 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 "scheduler/Scheduler.hpp"
namespace cta {
/**
* Class implementimg a dummy tape resource scheduler.
*/
class DummyScheduler: public Scheduler {
public:
/**
* Constructor.
*/
Scheduler();
/**
* Destructor.
*/
~Scheduler() throw();
/**
* Returns all of the queued archive requests. The returned requests are
* grouped by tape pool and then sorted by creation time, oldest first.
*
* @param requester The identity of the user requesting the list.
* @return The queued requests.
*/
std::map<TapePool, std::list<ArchiveToTapeCopyRequest> > getArchiveRequests(
const SecurityIdentity &requester) const;
/**
* Returns the list of queued archive requests for the specified tape pool.
* The returned requests are sorted by creation time, oldest first.
*
* @param requester The identity of the user requesting the list.
* @param tapePoolName The name of the tape pool.
* @return The queued requests.
*/
std::list<ArchiveToTapeCopyRequest> getArchiveRequests(
const SecurityIdentity &requester,
const std::string &tapePoolName) const;
/**
* Deletes the specified archive request.
*
* @param requester The identity of the requester.
* @param archiveFile The absolute path of the destination file within the
* archive namespace.
*/
void deleteArchiveRequest(
const SecurityIdentity &requester,
const std::string &remoteFile);
/**
* Returns all of the queued retrieve requests. The returned requests are
* grouped by tape and then sorted by creation time, oldest first.
*
* @param requester The identity of requester.
* @return all of the queued retrieve requests. The returned requsts are
* grouped by tape and then sorted by creation time, oldest first.
*/
std::map<Tape, std::list<RetrieveFromTapeCopyRequest> > getRetrieveRequests(
const SecurityIdentity &requester) const;
/**
* Returns the queued retrieve requests for the specified tape. The
* returned requests are sorted by creation time, oldest first.
*
* @param requester The identity of the requester.
* @param vid The volume identifier of the tape.
* @return The queued retrieve requests for the specified tape. The
* returned requests are sorted by creation time, oldest first.
*/
std::list<RetrieveFromTapeCopyRequest> getRetrieveRequests(
const SecurityIdentity &requester,
const std::string &vid) const;
/**
* Deletes the specified retrieve request.
*
* @param requester The identity of the requester.
* @param remoteFile The URL of the remote file.
*/
void deleteRetrieveRequest(
const SecurityIdentity &requester,
const std::string &remoteFile);
/**
* Creates the specified administrator.
*
* @param requester The identity of the requester.
* @param user The identity of the administrator.
* @param comment The comment describing the sministrator.
*/
void createAdminUser(
const SecurityIdentity &requester,
const UserIdentity &user,
const std::string &comment);
/**
* Creates the specified administrator without performing any authorisation
* checks.
*
* This method provides a way to bootstrap the list of administrators.
* This method does not perform any authorizations checks therefore please
* take any necessary precautions before calling this method.
*
* @param requester The identity of the user requesting the creation of the
* administrator.
* @param user The identity of the administrator.
* @param comment The comment describing the sministrator.
*/
void createAdminUserWithoutAuthorizingRequester(
const SecurityIdentity &requester,
const UserIdentity &user,
const std::string &comment);
/**
* Deletes the specified administrator.
*
* @param requester The identity of the user requesting the deletion of the
* administrator.
* @param user The identity of the administrator.
*/
void deleteAdminUser(
const SecurityIdentity &requester,
const UserIdentity &user);
/**
* Returns the current list of administrators in lexicographical order.
*
* @param requester The identity of the user requesting the list.
* @return The current list of administrators in lexicographical order.
*/
std::list<AdminUser> getAdminUsers(const SecurityIdentity &requester) const;
/**
* Creates the specified administration host.
*
* @param requester The identity of the requester.
* @param hostName The network name of the administration host.
* @param comment The comment describing the administration host.
*/
void createAdminHost(
const SecurityIdentity &requester,
const std::string &hostName,
const std::string &comment);
/**
* Creates the specified administration host with performing any authorisation
* checks.
*
* This method provides a way to bootstrap the list of administration hosts.
* This method does not perform any authorizations checks therefore please
* take any necessary precautions before calling this method.
*
* @param requester The identity of the requester.
* @param hostName The network name of the administration host.
* @param comment The comment describing the administration host.
*/
void createAdminHostWithoutAuthorizingRequester(
const SecurityIdentity &requester,
const std::string &hostName,
const std::string &comment);
/**
* Deletes the specified administration host.
*
* @param requester The identity of the user requesting the deletion of the
* administration host.
* @param hostName The network name of the administration host.
*/
void deleteAdminHost(
const SecurityIdentity &requester,
const std::string &hostName);
/**
* Returns the current list of administration hosts in lexicographical order.
*
* @param requester The identity of the user requesting the list.
* @return The current list of administration hosts in lexicographical order.
*/
std::list<AdminHost> getAdminHosts(const SecurityIdentity &requester) const;
/**
* Creates the specified storage class.
*
* @param requester The identity of the user requesting the creation of the
* storage class.
* @param name The name of the storage class.
* @param nbCopies The number of copies a file associated with this storage
* class should have on tape.
* @param comment The comment describing the storage class.
*/
void createStorageClass(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbCopies,
const std::string &comment);
/**
* Creates the specified storage class.
*
* @param requester The identity of the user requesting the creation of the
* storage class.
* @param name The name of the storage class.
* @param nbCopies The number of copies a file associated with this storage
* class should have on tape.
* @param id The numeric identifer of the storage class.
* @param comment The comment describing the storage class.
*/
void createStorageClass(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbCopies,
const uint32_t id,
const std::string &comment);
/**
* Deletes the specified storage class.
*
* @param requester The identity of the user requesting the deletion of the
* storage class.
* @param name The name of the storage class.
*/
void deleteStorageClass(
const SecurityIdentity &requester,
const std::string &name);
/**
* Gets the current list of storage classes in lexicographical order.
*
* @param requester The identity of the user requesting the list.
* @return The current list of storage classes in lexicographical order.
*/
std::list<StorageClass> getStorageClasses(
const SecurityIdentity &requester) const;
/**
* Creates a tape pool with the specifed name.
*
* @param requester The identity of the user requesting the creation of the
* tape pool.
* @param name The name of the tape pool.
* @param nbPartialTapes The maximum number of tapes that can be partially
* full at any moment in time.
* @param comment The comment describing the tape pool.
*/
void createTapePool(
const SecurityIdentity &requester,
const std::string &name,
const uint32_t nbPartialTapes,
const std::string &comment);
/**
* Delete the tape pool with the specifed name.
*
* @param requester The identity of the user requesting the deletion of the
* tape pool.
* @param name The name of the tape pool.
*/
void deleteTapePool(
const SecurityIdentity &requester,
const std::string &name);
/**
* Gets the current list of tape pools in lexicographical order.
*
* @param requester The identity of the user requesting the list.
* @return The current list of tape pools in lexicographical order.
*/
std::list<TapePool> getTapePools(
const SecurityIdentity &requester) const;
/**
* Creates the specified archive route.
*
* @param requester The identity of the user requesting the creation of the
* archive route.
* @param storageClassName The name of the storage class that identifies the
* source disk files.
* @param copyNb The tape copy number.
* @param tapePoolName The name of the destination tape pool.
* @param comment The comment describing the archive route.
*/
void createArchiveRoute(
const SecurityIdentity &requester,
const std::string &storageClassName,
const uint16_t copyNb,
const std::string &tapePoolName,
const std::string &comment);
/**
* Deletes the specified archive route.
*
* @param requester The identity of the user requesting the deletion of the
* archive route.
* @param storageClassName The name of the storage class that identifies the
* source disk files.
* @param copyNb The tape copy number.
*/
void deleteArchiveRoute(
const SecurityIdentity &requester,
const std::string &storageClassName,
const uint16_t copyNb);
/**
* Gets the current list of archive routes.
*
* @param requester The identity of the user requesting the list.
*/
std::list<ArchiveRoute> getArchiveRoutes(
const SecurityIdentity &requester) const;
/**
* Creates a logical library with the specified name.
*
* @param requester The identity of the user requesting the creation of the
* logical library.
* @param name The name of the logical library.
* @param comment The comment describing the logical library.
*/
void createLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name,
const std::string &comment);
/**
* Deletes the logical library with the specified name.
*
* @param requester The identity of the user requesting the deletion of the
* logical library.
* @param name The name of the logical library.
*/
void deleteLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name);
/**
* Returns the current list of libraries in lexicographical order.
*
* @param requester The identity of the user requesting the list.
* @return The current list of libraries in lexicographical order.
*/