Project

General

Profile

Download (3.44 KB) Statistics
| Branch: | Revision:
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_COPYMANAGEROPTIONS_H_
#define __COPYTOOL_COPYMANAGEROPTIONS_H_

#include <cstdint>
#include <map>
#include <string>

namespace DBS
{

class CopyManagerOptions
{
public:

eee13fa3 david.sorber
// Log option defaults
4fd46efa david.sorber
static const bool DEFAULT_ENABLE_LOG{false};
eee13fa3 david.sorber
static const bool DEFAULT_LOG_TO_STDERR{true};
static const int DEFAULT_LOG_LEVEL{3};
static inline const std::string DEFAULT_LOG_FILE_PATH{"./copyfile.log"};
2c54c4c3 david.sorber
eee13fa3 david.sorber
static const uint32_t DEFAULT_FC_THRESHOLD{1000};
static const uint32_t DEFAULT_NUM_COPY_THREADS{4};
static const bool DEFAULT_COPY_TOPLEVEL{false};
2c54c4c3 david.sorber
CopyManagerOptions(
eee13fa3 david.sorber
const std::string& srcPath,
const std::string& destPath,
bool disableLog,
bool logToStderr,
const std::string& logFilePath,
int logLevel,
uint32_t flowCtrlThreshold,
uint32_t numProcThreads,
bool copyTopLevel);
2c54c4c3 david.sorber
~CopyManagerOptions();

//--- Getters -------------------------------------------------------------
inline const std::string& getSrcPath() const
{
eee13fa3 david.sorber
return r_srcPath;
2c54c4c3 david.sorber
}

inline const std::string& getDestPath() const
{
return m_destPath;
}

4fd46efa david.sorber
inline bool getEnableLog() const
eee13fa3 david.sorber
{
4fd46efa david.sorber
return m_enableLog;
eee13fa3 david.sorber
}

inline bool getLogToStderr() const
{
return m_logToStderr;
}

inline int getLogLevel() const
2c54c4c3 david.sorber
{
return m_logLevel;
}

eee13fa3 david.sorber
inline const std::string& getLogFilePath() const
{
return r_logFilePath;
}

2c54c4c3 david.sorber
inline uint32_t getFlowControlThreshold() const
{
return m_flowControlThreshold;
}

eee13fa3 david.sorber
inline uint32_t getNumCopyThreads() const
{
return m_numCopyThreads;
}

inline bool getCopyTopLevel() const
2c54c4c3 david.sorber
{
eee13fa3 david.sorber
return m_copyTopLevel;
2c54c4c3 david.sorber
}

//--- Setters -------------------------------------------------------------
eee13fa3 david.sorber
inline void setDestPath(const std::string& destPath)
{
m_destPath = destPath;
}

2c54c4c3 david.sorber
inline void setFlowControlThreshold(uint32_t threshold)
{
m_flowControlThreshold = threshold;
}

private:

eee13fa3 david.sorber
// Fundamental options/settings
const std::string& r_srcPath; // source path; "copy from"
2c54c4c3 david.sorber
std::string m_destPath; // destination path; "copy to"

eee13fa3 david.sorber
// Logging related options
4fd46efa david.sorber
bool m_enableLog; // Enable/disable the log
eee13fa3 david.sorber
bool m_logToStderr; // Write log messages to stderr instead of file
6248f75f david.sorber
const std::string& r_logFilePath; // Path to log file
eee13fa3 david.sorber
int m_logLevel; // Log messages >= selected level will be output

// Other options
uint32_t m_flowControlThreshold; // Max level of entry queue for flow control purposes
uint32_t m_numCopyThreads; // Number of copy threads to spawn
bool m_copyTopLevel; // Copy top level source dir to dest dir
2c54c4c3 david.sorber
};

} // namespace DBS


#endif //__COPYTOOL_COPYMANAGEROPTIONS_H_