diff --git a/nameserver/MockNameServer.cpp b/nameserver/MockNameServer.cpp index 0778353a11718dcecd9ddb797a637e0ed11beb7d..5fd321dcc432888be57c6ed5fff5d8a3d6b61ed8 100644 --- a/nameserver/MockNameServer.cpp +++ b/nameserver/MockNameServer.cpp @@ -457,7 +457,8 @@ cta::ArchiveDirEntry cta::MockNameServer::getArchiveDirEntry( const UserIdentity owner = getOwner(requester, path); const Checksum checksum; - ArchiveFileStatus status(owner, stat_result.st_mode, checksum, + const uint64_t size = 1234; + ArchiveFileStatus status(owner, stat_result.st_mode, size, checksum, storageClassName); return ArchiveDirEntry(entryType, name, status); diff --git a/remotens/MockRemoteNS.cpp b/remotens/MockRemoteNS.cpp index f1ddc940fcb45deded64a43f2481a030fda5d22c..07dc47b174baeafb2576777b2a23cd5219470c11 100644 --- a/remotens/MockRemoteNS.cpp +++ b/remotens/MockRemoteNS.cpp @@ -26,6 +26,14 @@ cta::MockRemoteNS::~MockRemoteNS() throw() { } +//------------------------------------------------------------------------------ +// statFile +//------------------------------------------------------------------------------ +cta::RemoteFileStatus cta::MockRemoteNS::statFile(const RemotePath &path) + const { + throw exception::Exception(std::string(__FUNCTION__) + " not implemented"); +} + //------------------------------------------------------------------------------ // regularFileExists //------------------------------------------------------------------------------ diff --git a/remotens/MockRemoteNS.hpp b/remotens/MockRemoteNS.hpp index 84ddf3f29540dcb437aaf21c680d33e00f2f61e4..99420ebb4a07ab0450b4a303e802e05291091587 100644 --- a/remotens/MockRemoteNS.hpp +++ b/remotens/MockRemoteNS.hpp @@ -33,6 +33,15 @@ public: */ ~MockRemoteNS() throw(); + /** + * Returns the status of the specified file or directory within the remote + * storage system. + * + * @param path The absolute path of the file or directory. + * @return The status of the file or directory. + */ + RemoteFileStatus statFile(const RemotePath &path) const; + /** * Returns true if the specified regular file exists. * diff --git a/remotens/RemoteFileStatus.cpp b/remotens/RemoteFileStatus.cpp index 3bb96e47fed5121f3c854be1393ca86ede05faee..a6cdf5378169596173ffd5c4f7ae2ee97b281964 100644 --- a/remotens/RemoteFileStatus.cpp +++ b/remotens/RemoteFileStatus.cpp @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "common/RemoteFileStatus.hpp" +#include "remotens/RemoteFileStatus.hpp" //------------------------------------------------------------------------------ // constructor @@ -32,14 +32,10 @@ cta::RemoteFileStatus::RemoteFileStatus(): cta::RemoteFileStatus::RemoteFileStatus( const UserIdentity &owner, const mode_t mode, - const uint64_t size, - const Checksum &checksum, - const std::string &storageClassName): + const uint64_t size): m_owner(owner), m_mode(mode), - m_size(size), - m_checksum(checksum), - m_storageClassName(storageClassName) { + m_size(size) { } //------------------------------------------------------------------------------ @@ -62,25 +58,3 @@ mode_t cta::RemoteFileStatus::getMode() const throw() { uint64_t cta::RemoteFileStatus::getSize() const throw() { return m_size; } - -//------------------------------------------------------------------------------ -// getChecksum -//------------------------------------------------------------------------------ -const cta::Checksum &cta::RemoteFileStatus::getChecksum() const throw() { - return m_checksum; -} - -//------------------------------------------------------------------------------ -// setStorageClassName -//------------------------------------------------------------------------------ -void cta::RemoteFileStatus::setStorageClassName( - const std::string &storageClassName) { - m_storageClassName = storageClassName; -} - -//------------------------------------------------------------------------------ -// getStorageClassName -//------------------------------------------------------------------------------ -const std::string &cta::RemoteFileStatus::getStorageClassName() const throw() { - return m_storageClassName; -} diff --git a/remotens/RemoteNS.hpp b/remotens/RemoteNS.hpp index d1ee85fee34c59a0e7d8574695302d4a1711a1a4..2555ebe16b87052d4107d65f962626346819fc59 100644 --- a/remotens/RemoteNS.hpp +++ b/remotens/RemoteNS.hpp @@ -19,6 +19,7 @@ #pragma once #include "common/RemotePath.hpp" +#include "remotens/RemoteFileStatus.hpp" namespace cta { @@ -34,6 +35,15 @@ public: */ virtual ~RemoteNS() throw() = 0; + /** + * Returns the status of the specified file or directory within the remote + * storage system. + * + * @param path The absolute path of the file or directory. + * @return The status of the file or directory. + */ + virtual RemoteFileStatus statFile(const RemotePath &path) const = 0; + /** * Returns true if the specified regular file exists. * diff --git a/remotens/RemoteNSDispatcher.cpp b/remotens/RemoteNSDispatcher.cpp index b2fabcea43e0280ac6fd2b58592a536db2324a08..1ef122bc7e914ede34ea96a2dced11365ed6fc15 100644 --- a/remotens/RemoteNSDispatcher.cpp +++ b/remotens/RemoteNSDispatcher.cpp @@ -52,6 +52,14 @@ void cta::RemoteNSDispatcher::registerProtocolHandler( m_handlers[protocol] = handler.release(); } +//------------------------------------------------------------------------------ +// statFile +//------------------------------------------------------------------------------ +cta::RemoteFileStatus cta::RemoteNSDispatcher::statFile(const RemotePath &path) + const { + return getHandler(path.getProtocol()).statFile(path); +} + //------------------------------------------------------------------------------ // regularFileExists //------------------------------------------------------------------------------ diff --git a/remotens/RemoteNSDispatcher.hpp b/remotens/RemoteNSDispatcher.hpp index 47db20abc81690583540be8ee5c58a51e28429a2..af5d8b1423af80b90e3a235d1e48a364bcac9d3b 100644 --- a/remotens/RemoteNSDispatcher.hpp +++ b/remotens/RemoteNSDispatcher.hpp @@ -49,6 +49,15 @@ public: void registerProtocolHandler(const std::string &protocol, std::unique_ptr<RemoteNS> handler); + /** + * Returns the status of the specified file or directory within the remote + * storage system. + * + * @param path The absolute path of the file or directory. + * @return The status of the file or directory. + */ + RemoteFileStatus statFile(const RemotePath &path) const; + /** * Returns true if the specified regular file exists. * diff --git a/remotens/RemoteNSDispatcherTest.cpp b/remotens/RemoteNSDispatcherTest.cpp index 6612bec9df0cf08f01536d8bb08a0ef41ac90906..3f984fc5feb62181ffce5071fc247bf47753c973 100644 --- a/remotens/RemoteNSDispatcherTest.cpp +++ b/remotens/RemoteNSDispatcherTest.cpp @@ -43,6 +43,11 @@ protected: ~TestRemoteNS() throw() { } + cta::RemoteFileStatus statFile(const cta::RemotePath &path) const { + throw cta::exception::Exception(std::string(__FUNCTION__) + + " not implemented"); + } + bool regularFileExists(const cta::RemotePath &path) const { incCallCounter("regularFileExists"); auto itor = std::find(m_files.begin(), m_files.end(), path);