-
Notifications
You must be signed in to change notification settings - Fork 15
/
ImportHelper.h
50 lines (38 loc) · 1.29 KB
/
ImportHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <filesystem>
#include <memory>
template<typename... ArgsT>
class IForwardIterator;
struct Box;
typedef IForwardIterator<Box> ITorrentStateIterator;
typedef std::unique_ptr<ITorrentStateIterator> ITorrentStateIteratorPtr;
class IFileStreamProvider;
class ITorrentStateStore;
typedef std::unique_ptr<ITorrentStateStore> ITorrentStateStorePtr;
class SignalHandler;
class ImportHelper
{
public:
struct Result
{
std::size_t SuccessCount;
std::size_t FailCount;
std::size_t SkipCount;
Result();
};
public:
ImportHelper(ITorrentStateStorePtr sourceStore, std::filesystem::path const& sourceDataDir,
ITorrentStateStorePtr targetStore, std::filesystem::path const& targetDataDir,
IFileStreamProvider& fileStreamProvider, SignalHandler const& signalHandler);
~ImportHelper();
Result Import(unsigned int threadCount);
private:
void ImportImpl(std::filesystem::path const& targetDataDir, ITorrentStateIterator& boxes, Result& result);
private:
ITorrentStateStorePtr const m_sourceStore;
std::filesystem::path const m_sourceDataDir;
ITorrentStateStorePtr const m_targetStore;
std::filesystem::path const m_targetDataDir;
IFileStreamProvider& m_fileStreamProvider;
SignalHandler const& m_signalHandler;
};