simplified changes saved

This commit is contained in:
EntireTwix 2021-06-23 18:51:10 -07:00
parent 7aadd63cd5
commit 6161ca8d59
2 changed files with 8 additions and 17 deletions

View file

@ -19,22 +19,9 @@ private:
std::mutex>
users;
#if CONSERVATIVE_DISK_SAVE
std::atomic<bool> change_flag = false; //if true changes have been made
void ChangesMade() noexcept; //called after making changes
void ChangesSaved() noexcept; //called after saving
bool GetChangeState() noexcept;
#define CHANGES_MADE ChangesMade();
#define CHANGES_SAVED ChangesSaved();
#define GET_CHANGE_STATE
#else
#define CHANGES_MADE
#define CHANGES_SAVED
#define GET_CHANGE_STATE
#endif
private:
/**
* @brief size_l should be grabbed if the operation MODIFIES the size (shared), this is so that when save claims unique
*
@ -50,6 +37,10 @@ private:
public:
std::string admin_pass;
void ChangesMade() noexcept; //called after making changes
void ChangesSaved() noexcept; //called after saving
bool GetChangeState() noexcept;
int_fast8_t AddUser(const std::string &name, const std::string &init_pass) noexcept;
int_fast8_t AdminAddUser(const std::string &attempt, std::string &&name, uint32_t init_bal, std::string &&init_pass) noexcept;

View file

@ -1,6 +1,6 @@
#pragma once
// Setting both values to 0 does not compile logging
// Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable)
constexpr unsigned max_log_size = 100;
constexpr unsigned pre_log_size = 10;
@ -9,7 +9,7 @@ constexpr unsigned max_name_size = 50;
constexpr const char *users_location = "../users.json";
constexpr const char *config_location = "../config.json";
//returns money to an account on deletion
//returns money to an account on deletion (useful if you dont want any money to leave the economy)
constexpr bool return_on_del = false;
constexpr const char *return_account = "";
@ -26,4 +26,4 @@ if false, when frequency is hit save
cons
CONSTANT disk usage
*/
#define CONSERVATIVE_DISK_SAVE true
#define CONSERVATIVE_DISK_SAVE true //TURN THIS OFF IF YOU THINK WITHIN YOUR SAVE FREQUENCY OF X MINUTES ITS GUARANTEED A CHANGE WILL OCCUR (typically massive servers)