mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-16 16:12:14 +11:00
🔥 removed preallocting log functionality
This commit is contained in:
parent
ff89efe4fc
commit
73ebb6e5bd
4 changed files with 7 additions and 21 deletions
|
|
@ -47,12 +47,6 @@ else()
|
||||||
set(MAX_LOG_SIZE_VAL 100)
|
set(MAX_LOG_SIZE_VAL 100)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED PRE_LOG_SIZE)
|
|
||||||
set(PRE_LOG_SIZE_VAL ${PRE_LOG_SIZE})
|
|
||||||
else()
|
|
||||||
set(PRE_LOG_SIZE_VAL 10)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DEFINED CONSERVATIVE_DISK_SAVE)
|
if(DEFINED CONSERVATIVE_DISK_SAVE)
|
||||||
set(CONSERVATIVE_DISK_SAVE_VAL ${CONSERVATIVE_DISK_SAVE})
|
set(CONSERVATIVE_DISK_SAVE_VAL ${CONSERVATIVE_DISK_SAVE})
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,18 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable)
|
// Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable)
|
||||||
#define MAX_LOG_SIZE @MAX_LOG_SIZE_VAL@
|
#define MAX_LOG_SIZE @MAX_LOG_SIZE_VAL @
|
||||||
#define PRE_LOG_SIZE @PRE_LOG_SIZE_VAL@
|
|
||||||
|
|
||||||
//default to minecraft usernames
|
//default to minecraft usernames
|
||||||
constexpr unsigned min_name_size = 3;
|
constexpr unsigned min_name_size = 3;
|
||||||
constexpr unsigned max_name_size = 16;
|
constexpr unsigned max_name_size = 16;
|
||||||
|
|
||||||
constexpr const char *users_location = @USER_SAVE@;
|
constexpr const char *users_location = @USER_SAVE @;
|
||||||
constexpr const char *config_location = @DROGON_CONFIG@;
|
constexpr const char *config_location = @DROGON_CONFIG @;
|
||||||
|
|
||||||
// Returns money to an account on deletion (useful if you dont want any money to leave the economy)
|
// Returns money to an account on deletion (useful if you dont want any money to leave the economy)
|
||||||
#define RETURN_ON_DEL @RETURN_ON_DEL_VAL@
|
#define RETURN_ON_DEL @RETURN_ON_DEL_VAL @
|
||||||
constexpr const char *return_account = @RETURN_ON_DEL_NAME_VAL@;
|
constexpr const char *return_account = @RETURN_ON_DEL_NAME_VAL @;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if true, when frequency is hit AND changes have happened then save
|
if true, when frequency is hit AND changes have happened then save
|
||||||
|
|
@ -27,7 +26,7 @@ if false, when frequency is hit save
|
||||||
cons
|
cons
|
||||||
HIGH disk usage
|
HIGH disk usage
|
||||||
*/
|
*/
|
||||||
#define CONSERVATIVE_DISK_SAVE @CONSERVATIVE_DISK_SAVE_VAL@
|
#define CONSERVATIVE_DISK_SAVE @CONSERVATIVE_DISK_SAVE_VAL @
|
||||||
|
|
||||||
/*
|
/*
|
||||||
example, when set to 2
|
example, when set to 2
|
||||||
|
|
@ -38,4 +37,4 @@ etc
|
||||||
*/
|
*/
|
||||||
#define API_VERSION 1
|
#define API_VERSION 1
|
||||||
|
|
||||||
#define MULTI_THREADED @MULTI_THREADED_VAL@
|
#define MULTI_THREADED @MULTI_THREADED_VAL @
|
||||||
|
|
@ -14,10 +14,6 @@ void Log::AddTrans(Transaction &&t) noexcept
|
||||||
data[data.size() - 1] = std::move(t); // Place new in opened spot
|
data[data.size() - 1] = std::move(t); // Place new in opened spot
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (data.size() == data.capacity()) // If we haven't hit the max but hit capacity
|
|
||||||
{
|
|
||||||
data.reserve(data.capacity() + PRE_LOG_SIZE); // Reserve more memory
|
|
||||||
}
|
|
||||||
data.push_back(std::move(t)); // In either case we have space under max length, move to new spot
|
data.push_back(std::move(t)); // In either case we have space under max length, move to new spot
|
||||||
#endif
|
#endif
|
||||||
log_flag.SetChangesOn();
|
log_flag.SetChangesOn();
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,6 @@ User::User(uint32_t init_bal, XXH64_hash_t init_pass, const Json::Value &log_j)
|
||||||
{
|
{
|
||||||
if (log_j.size())
|
if (log_j.size())
|
||||||
{
|
{
|
||||||
#if MAX_LOG_SIZE != 1
|
|
||||||
log.data.reserve(std::min((size_t)PRE_LOG_SIZE * ((log_j.size() / PRE_LOG_SIZE) + 1), (size_t)MAX_LOG_SIZE));
|
|
||||||
#endif
|
|
||||||
for (uint32_t i = (log_j.size() - MAX_LOG_SIZE) * (log_j.size() > MAX_LOG_SIZE); i < log_j.size(); i++)
|
for (uint32_t i = (log_j.size() - MAX_LOG_SIZE) * (log_j.size() > MAX_LOG_SIZE); i < log_j.size(); i++)
|
||||||
{
|
{
|
||||||
#if MAX_LOG_SIZE == 1
|
#if MAX_LOG_SIZE == 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue