]> pilppa.org Git - libplp.git/blobdiff - src/StoreDay.hh
Data read optimizations
[libplp.git] / src / StoreDay.hh
index 1b416e5fbb78c9c4cd782a7bf5aa58d6c2eedb97..dc2589519ab3f35c099c83fb6e86b6d8f727cc72 100644 (file)
@@ -37,17 +37,63 @@ namespace plp {
                        /*
                         * Checks whether store file exist.
                         */
-                       bool exist();
+                       bool exist(bool writable);
+                       static bool exist(std::string dev_id,
+                                       plp::Date *date,
+                                       bool writable);
+                       static bool exist_in_month(string device_id,
+                                               Date *date,
+                                               bool writable);
+                       static bool exist_in_year(string device_id,
+                                               Date *date,
+                                               bool writable);
+                       static bool get_next_date_with_data(std::string device_id,
+                                                       plp::Date *next_date,
+                                                       plp::Date *max_date);
                protected:
                        std::string     store_fname;
                        bool load();
                        plp::DataRange *get_max_or_min(EnumSummaryPeriod period_type_param, bool max);
                        static std::string get_dir_name(std::string device_id,
                                                        plp::Date *date_time_param);
+                       static std::string get_year_dir_name(std::string device_id,
+                                                       plp::Date *date_time_param);
                        static std::string get_file_name(std::string device_id,
                                                        plp::Date *date_time_param);
                        plp::DataRange *get_oldest_and_latest_data(std::string fname_param);
-                       bool exist(std::string fname_param);
+                       /**
+                        * Check whether the given file exist and has either read or write permissions.
+                        */
+                       static bool exist(std::string fname_param, bool writable);
+                       /**
+                        * Go through days in month to find out whether daily data file exist.
+                        *
+                        * If data is not found, false is returned and last scanned date is set to next_date.
+                        * If data is found true is returned and date is set to next_date.
+                        */
+                       static bool data_day_scan_days_in_month(string dev_id_param,
+                                                       Date *next_date,
+                                                       Date *max_date);
+                       /**
+                        * Go through month dir in year to find out first date with data
+                        * after the given date.
+                        *
+                        * If data is not found, false is returned and last scanned date is set to next_date.
+                        * If data is found true is returned and date is set to next_date.
+                        */
+                       static bool data_day_scan_month_in_year(string dev_id_param,
+                                                       Date *next_date,
+                                                       Date *max_date);
+                       /**
+                        * Go through year and month directories to find out first date with data
+                        * after the given date.
+                        *
+                        * If data is not found, false is returned and last scanned date is set to next_date.
+                        * If data is found true is returned and date is set to next_date.
+                        */
+                       static bool data_day_scan_years(string dev_id_param,
+                                               Date *next_date,
+                                               Date *max_date);
        };
 }