root/src/CopyManager.h @ 856fcf9a
| 2c54c4c3 | david.sorber | /********************************************************************
|
||
* CONFIDENTIAL - All source code is the propriety and confidential *
|
||||
* information of David Sorber. *
|
||||
* *
|
||||
* Copyright 2024 David Sorber *
|
||||
* Unpublished -- all rights reserved under the copyright laws *
|
||||
* of the United States. *
|
||||
********************************************************************/
|
||||
#ifndef __COPYTOOL_COPYMANAGER_H_
|
||||
#define __COPYTOOL_COPYMANAGER_H_
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include "CopyManagerOptions.h"
|
||||
#include "ProtectedQueue.h"
|
||||
namespace sfs = std::filesystem;
|
||||
namespace DBS
|
||||
{
|
||||
class CopyManager
|
||||
{
|
||||
public:
|
||||
| eee13fa3 | david.sorber | // Maximum "count" size per sendfile() documentation
|
||
static inline size_t MAX_COPY_SIZE{0x7ffff000};
|
||||
| 2c54c4c3 | david.sorber | static inline const sfs::directory_entry ENTRY_TERMINATOR{};
|
||
CopyManager(CopyManagerOptions& options);
|
||||
~CopyManager();
|
||||
int run();
|
||||
private:
|
||||
void mainThreadBody();
|
||||
| eee13fa3 | david.sorber | void copyThreadBody();
|
||
| 2c54c4c3 | david.sorber | |||
CopyManagerOptions& r_options;
|
||||
ProtectedQueue<sfs::directory_entry> m_entryQueue;
|
||||
std::atomic_bool m_terminate;
|
||||
std::thread* p_mainThread;
|
||||
| eee13fa3 | david.sorber | std::vector<std::thread*> m_copyThreads;
|
||
| 2c54c4c3 | david.sorber | |||
};
|
||||
} // namespace DBS
|
||||
#endif //__COPYTOOL_COPYMANAGER_H_
|