Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r85c0a859a587d035997f3d163dcf4303afb86d05 -rf724589acaa51725f5e5f8a746404d01804efbcf --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 85c0a859a587d035997f3d163dcf4303afb86d05) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision f724589acaa51725f5e5f8a746404d01804efbcf) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file StorageGlobals.cpp - * \author (last) Behrouz NematiPour - * \date (last) 01-Sep-2023 + * \author (last) Dara Navaei + * \date (last) 07-Feb-2024 * \author (original) Behrouz NematiPour * \date (original) 26-Aug-2020 * @@ -31,11 +31,6 @@ */ namespace Storage { - - /****** TO BE CONSISTENT, ALWAYS INCLUDE '/' AT THE END OF ALL THE FOLDER/DIR/PATH IN HERE ******/ - - const char *Standard_tmp = "/tmp/"; - const char *POST_LOG = "post.log"; // this file shall reside in the home folder where the application stored. @@ -54,18 +49,25 @@ const char *USB_File_System = "vfat"; // SD-CARD - const short Log_Min_Available_Total_Space_Percent = 15; // Min free : 15 // always has to be 15 percent free space available, less than this triggers the log cleanup. - const short Log_Max_Allowable_Event_Space_Percent = 25; - const short Log_Max_Allowable_Datum_Space_Percent = 25; - const short Log_Max_Allowable_AppED_Space_Percent = Log_Max_Allowable_Event_Space_Percent + Log_Max_Allowable_Datum_Space_Percent; // 50 - const short Log_Max_Allowable_Debug_Space_Percent = 15; - const short Log_Max_Allowable_Trtmt_Space_Percent = 10; - // // Max Usage : 75 = 25 + 25 + 15 + 10 + // // Max Usage : 80 = 25 + 25 + 15 + 15 // // Max Used : 85 = 100 - 15 - // // Min Buffer : 10 = 85 - 75 + // // Min Buffer : 5 = 85 - 80 // IMPORTANT: we have to keep 10% buffer otherwise competition between filling and deleting logs will cause application to crash eventually. + const short Log_Min_Available_Total_Space_Percent = 15; // Min free : 15 // always has to be 15 percent free space available, less than this triggers the log cleanup. + const short Log_Max_Allowable_AppED_Space_Percent = 50; + const short Log_Max_Allowable_Debug_Space_Percent = 15; + const short Log_Max_Allowable_Cloud_Space_Percent = 15; short Log_Min_Available_Total_Space_IsLow(short vPercent) { return vPercent < Log_Min_Available_Total_Space_Percent; } + // Settings/Encrypted + // the settings are roughly using the 5MB round it to 8MB to be 25% of 32MB of total encrypted partition. + // therefore the Txr shall not use more than 75% to leave the 25 for settings. + // when reaches that percent will be deleted to get total usage of 50% + // 50% percent of 32MB is 16MB which is enough to keep 10K (estimated each txr are 4K rounded to 5K and doubled.) of ~1600 files. + const short Txr_Min_Available_Total_Space_Percent = 20; // min space needed for settings by the current definitions. + const short Txr_Max_Allowable_Trtmt_Space_Percent = 50; // the treatment files are moved to the encrypted partition. + short Txr_Min_Available_Total_Space_IsLow(short vPercent) { return vPercent < Txr_Min_Available_Total_Space_Percent; } + #ifdef BUILD_FOR_TARGET const char *SDCard_Base_Path_Name = "/media/sd-card/"; #else @@ -132,13 +134,18 @@ #endif } - // Please notice that is the folder not the path + // and it needs to be concatenated after SDCard_Base_Path_Name for each build configuration const char *Log_Folder_Base = SDCard_Base_Path_Name; // Base Log Folder const char *Log_Folder_Application = "log/" ; // Event/Data Log const char *Log_Folder_Service = "service/" ; // Service Log - const char *Log_Folder_Treatment = "treatment/" ; // Treatment Log + const char *Log_Folder_CloudSync = "cloudsync/log/" ; // CloudSync Log + // Txr_Max_Allowable_Trtmt_Space_Percent notice that is the folder not the path + + const char *Txr_Folder_Base = Settings_Path_Name ; // Base Txr Folder + const char *Txr_Folder_Treatment = "treatment/" ; // Treatment Rep + // TODO : These need to be removed from here because they are only used in their specific classes. // Date and Time const char *Date_Time_Set_Sh = "date_time_set.sh";