Elements 6.1.2
A C++ base framework for the Euclid Software.
Loading...
Searching...
No Matches
DataSync.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012-2020 Euclid Science Ground Segment
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 3.0 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
22
23namespace Elements {
24inline namespace Services {
25namespace DataSync {
26
27DataSync::DataSync(path connectionFile, path dependencyFile)
28 : m_connectionConfig(connectionFile)
29 , m_distantRoot(m_connectionConfig.distantRoot)
30 , m_localRoot(m_connectionConfig.localRoot)
31 , m_dependencyConfig(m_distantRoot, m_localRoot, dependencyFile) {}
32
34 const auto& synchronizer = createSynchronizer(m_connectionConfig, m_dependencyConfig);
35 synchronizer->downloadAllFiles();
36}
37
39 try {
40 download();
41 } catch (std::exception& e) {
43 download();
44 }
45}
46
48 return m_localRoot / relativePath;
49}
50
51} // namespace DataSync
52} // namespace Services
53} // namespace Elements
The connection configuration mainly holds:
A class to download test data from a data repository prior to the unit test run.
Definition: DataSync.h:47
void download()
Download the test data.
Definition: DataSync.cpp:33
path absolutePath(path relativePath)
Get the absolute path to a local test file which has been downloaded.
Definition: DataSync.cpp:47
ConnectionConfiguration m_connectionConfig
Definition: DataSync.h:94
DependencyConfiguration m_dependencyConfig
Definition: DataSync.h:97
void downloadWithFallback(path connectionFile)
Download the test data and provide a fallback host in case the primary host fails.
Definition: DataSync.cpp:38
ELEMENTS_API std::shared_ptr< DataSynchronizer > createSynchronizer(ConnectionConfiguration connection, DependencyConfiguration dependency)
Path::Item path
importing the path item from ElementsKernel
Definition: DataSyncUtils.h:41