Database: Removed obsolete ::getCurrentDataFile

This commit is contained in:
Paul Beckingham 2016-04-17 08:07:25 -04:00
parent e70424f32b
commit 7db6f68b92
2 changed files with 0 additions and 42 deletions

View file

@ -37,34 +37,12 @@
void Database::initialize (const std::string& location)
{
_location = location;
auto current = currentDataFile ();
// Because the data files have names YYYY-MM.data, sorting them by name also
// sorts by the intervals within.
Directory d (_location);
auto files = d.list ();
std::sort (files.begin (), files.end ());
// Ensure the list always contains the name of the current file, even if it
// does not exist.
if (std::find (files.begin (), files.end (), current) == files.end ())
files.push_back (current);
for (auto& file : files)
{
// If it looks like a data file.
if (file.find (".data") == file.length () - 5)
{
Datafile df;
df.initialize (file);
// New files need the set of current exclusions.
if (! File (file).exists ())
df.setExclusions (_exclusions);
_files.push_back (df);
}
}
}
////////////////////////////////////////////////////////////////////////////////
@ -203,31 +181,12 @@ std::string Database::dump () const
for (auto& exclusion : _exclusions)
out << " Exclusion: " << exclusion << "\n";
out << "Datafiles\n";
for (auto& df : _files)
out << df.dump ();
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////
std::string Database::currentDataFile () const
{
time_t current;
time (&current);
struct tm* t = gmtime (&current);
std::stringstream out;
out << _location
<< '/'
<< std::setw (4) << std::setfill ('0') << (t->tm_year + 1900)
<< '-'
<< std::setw (2) << std::setfill ('0') << (t->tm_mon + 1)
<< ".data";
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////
unsigned int Database::getDatafile (int year, int month)
{

View file

@ -53,7 +53,6 @@ public:
std::string dump () const;
private:
std::string currentDataFile () const;
unsigned int getDatafile (int, int);
std::vector <Daterange> segmentRange (const Daterange&);