Elements 6.3.3
A C++ base framework for the Euclid Software.
Loading...
Searching...
No Matches
DataSync.cpp
Go to the documentation of this file.
1
18
20
21#include <exception> // for exception
22#include <memory> // for __shared_ptr_access, shared_ptr
23
24#include <boost/filesystem/path.hpp> // for operator/, path
25
26#include "ElementsServices/DataSync/DataSynchronizer.h" // for DataSynchronizer
27#include "ElementsServices/DataSync/DataSynchronizerMaker.h" // for createSynchronizer
28
29namespace Elements {
30inline namespace Services {
31namespace DataSync {
32
33DataSync::DataSync(path connectionFile, path dependencyFile)
34 : m_connectionConfig(connectionFile)
37 , m_dependencyConfig(m_distantRoot, m_localRoot, dependencyFile) {}
38
40 const auto& synchronizer = createSynchronizer(m_connectionConfig, m_dependencyConfig);
41 synchronizer->downloadAllFiles();
42}
43
45 try {
46 download();
47 } catch (std::exception& e) {
49 download();
50 }
51}
52
54 return m_localRoot / relativePath;
55}
56
57} // namespace DataSync
58} // namespace Services
59} // namespace Elements
void download()
Download the test data.
Definition DataSync.cpp:39
path absolutePath(path relativePath)
Get the absolute path to a local test file which has been downloaded.
Definition DataSync.cpp:53
DataSync(path connectionFile, path dependencyFile)
Initialize the synchronizer with configuration files.
Definition DataSync.cpp:33
ConnectionConfiguration m_connectionConfig
Definition DataSync.h:95
DependencyConfiguration m_dependencyConfig
Definition DataSync.h:98
void downloadWithFallback(path connectionFile)
Download the test data and provide a fallback host in case the primary host fails.
Definition DataSync.cpp:44
ELEMENTS_API std::shared_ptr< DataSynchronizer > createSynchronizer(ConnectionConfiguration connection, DependencyConfiguration dependency)
Path::Item path
importing the path item from ElementsKernel