add seed_file_management.h holding SeedFileManager
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
04bbf16731
commit
129516a48f
|
@ -184,7 +184,7 @@ add_subdirectory(lib/da_threading EXCLUDE_FROM_ALL)
|
|||
endif(NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-fuse-ld=lld")
|
||||
endif()
|
||||
|
||||
add_executable(fortuna main.cpp generator.cpp generator.h fortuna.cpp fortuna.h accumulator.cpp accumulator.h pool.cpp pool.h event_adder.h event_adder_impl.h event_scheduler.h entropy_src.h urandom_entropy_src.h do_task.cpp do_task.h util.h)
|
||||
add_executable(fortuna main.cpp generator.cpp generator.h fortuna.cpp fortuna.h accumulator.cpp accumulator.h pool.cpp pool.h event_adder.h event_adder_impl.h event_scheduler.h entropy_src.h urandom_entropy_src.h do_task.cpp do_task.h util.h seed_file_management.h)
|
||||
# ref: https://cmake.org/pipermail/cmake/2016-May/063400.html
|
||||
target_link_libraries(fortuna
|
||||
PRIVATE cryptopp
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef FORTUNA_SEED_FILE_MANAGER_H
|
||||
#define FORTUNA_SEED_FILE_MANAGER_H
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
#include "accumulator.h"
|
||||
#include "do_task.h"
|
||||
|
||||
namespace fortuna {
|
||||
|
||||
class SeedFileManager {
|
||||
public:
|
||||
struct conf
|
||||
{
|
||||
std::chrono::minutes write_interval{10};
|
||||
std::string seed_f_path = "./fortuna.seed";
|
||||
std::size_t seed_f_length = 64;
|
||||
|
||||
conf(){};
|
||||
};
|
||||
|
||||
private:
|
||||
const conf config;
|
||||
DoTask do_task;
|
||||
fortuna::accumulator::Accumulator& accumulator;
|
||||
|
||||
auto write_seed_file() -> void;
|
||||
auto update_seed_file() -> void;
|
||||
|
||||
public:
|
||||
SeedFileManager(conf config, fortuna::accumulator::Accumulator& accumulator);
|
||||
}; // class SeedFileManager
|
||||
|
||||
} // namespace fortuna
|
||||
|
||||
#endif // FORTUNA_SEED_FILE_MANAGER_H
|
Reference in New Issue