- Removed backlog file processing, which slows down processing.  When
  2.1 has taskd support, the backlog will be cleared, but until then there
  is no point in accumulating transactions.
This commit is contained in:
Paul Beckingham 2012-01-03 00:55:20 -05:00
parent bdc1d558f5
commit a262d41828
7 changed files with 39 additions and 5 deletions

View file

@ -425,8 +425,10 @@ void Context::shadow ()
if (shadow_file._data == location + "/undo.data") if (shadow_file._data == location + "/undo.data")
throw std::string (STRING_CONTEXT_SHADOW_U); throw std::string (STRING_CONTEXT_SHADOW_U);
/*
if (shadow_file._data == location + "/backlog.data") if (shadow_file._data == location + "/backlog.data")
throw std::string (STRING_CONTEXT_SHADOW_B); throw std::string (STRING_CONTEXT_SHADOW_B);
*/
if (shadow_file._data == location + "/synch.key") if (shadow_file._data == location + "/synch.key")
throw std::string (STRING_CONTEXT_SHADOW_S); throw std::string (STRING_CONTEXT_SHADOW_S);

View file

@ -475,7 +475,9 @@ void TDB2::set_location (const std::string& location)
pending.target (location + "/pending.data"); pending.target (location + "/pending.data");
completed.target (location + "/completed.data"); completed.target (location + "/completed.data");
undo.target (location + "/undo.data"); undo.target (location + "/undo.data");
/*
backlog.target (location + "/backlog.data"); backlog.target (location + "/backlog.data");
*/
synch_key.target (location + "/synch.key"); synch_key.target (location + "/synch.key");
} }
@ -507,8 +509,10 @@ void TDB2::add (Task& task)
undo.add_line ("new " + task.composeF4 ()); undo.add_line ("new " + task.composeF4 ());
undo.add_line ("---\n"); undo.add_line ("---\n");
/*
// Add task to backlog. // Add task to backlog.
backlog.add_task (task); backlog.add_task (task);
*/
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -536,8 +540,10 @@ void TDB2::modify (Task& task)
undo.add_line ("new " + task.composeF4 ()); undo.add_line ("new " + task.composeF4 ());
undo.add_line ("---\n"); undo.add_line ("---\n");
/*
// Add modified task to backlog. // Add modified task to backlog.
backlog.add_task (task); backlog.add_task (task);
*/
} }
} }
@ -550,7 +556,9 @@ void TDB2::commit ()
pending.commit (); pending.commit ();
completed.commit (); completed.commit ();
undo.commit (); undo.commit ();
/*
backlog.commit (); backlog.commit ();
*/
synch_key.commit (); synch_key.commit ();
context.timer_commit.stop (); context.timer_commit.stop ();
@ -1790,7 +1798,9 @@ bool TDB2::read_only ()
return pending._read_only || return pending._read_only ||
completed._read_only || completed._read_only ||
undo._read_only || undo._read_only ||
/*
backlog._read_only || backlog._read_only ||
*/
synch_key._read_only; synch_key._read_only;
} }
@ -1800,7 +1810,9 @@ void TDB2::clear ()
pending.clear (); pending.clear ();
completed.clear (); completed.clear ();
undo.clear (); undo.clear ();
/*
backlog.clear (); backlog.clear ();
*/
synch_key.clear (); synch_key.clear ();
_location = ""; _location = "";
@ -1815,7 +1827,9 @@ void TDB2::dump ()
context.debug (pending.dump ()); context.debug (pending.dump ());
context.debug (completed.dump ()); context.debug (completed.dump ());
context.debug (undo.dump ()); context.debug (undo.dump ());
/*
context.debug (backlog.dump ()); context.debug (backlog.dump ());
*/
context.debug (synch_key.dump ()); context.debug (synch_key.dump ());
context.debug (""); context.debug ("");
} }

View file

@ -128,7 +128,7 @@ public:
TF2 pending; TF2 pending;
TF2 completed; TF2 completed;
TF2 undo; TF2 undo;
TF2 backlog; // TF2 backlog;
TF2 synch_key; TF2 synch_key;
private: private:

View file

@ -25,7 +25,6 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete. #define L10N // Localization complete.
#include <sstream> #include <sstream>
@ -64,7 +63,10 @@ int CmdStatistics::execute (std::string& output)
size_t dataSize = context.tdb2.pending._file.size () size_t dataSize = context.tdb2.pending._file.size ()
+ context.tdb2.completed._file.size () + context.tdb2.completed._file.size ()
+ context.tdb2.undo._file.size () + context.tdb2.undo._file.size ()
/*
// TODO Re-enable this once 2.1 has taskd support.
+ context.tdb2.backlog._file.size () + context.tdb2.backlog._file.size ()
*/
+ context.tdb2.synch_key._file.size (); + context.tdb2.synch_key._file.size ();
// Count the undo transactions. // Count the undo transactions.

View file

@ -25,7 +25,6 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete. #define L10N // Localization complete.
#include <iostream> #include <iostream>

View file

@ -80,7 +80,7 @@
#include <CmdStatistics.h> #include <CmdStatistics.h>
#include <CmdStop.h> #include <CmdStop.h>
#include <CmdSummary.h> #include <CmdSummary.h>
#include <CmdSynch.h> //#include <CmdSynch.h>
#include <CmdTags.h> #include <CmdTags.h>
#include <CmdTimesheet.h> #include <CmdTimesheet.h>
#include <CmdUndo.h> #include <CmdUndo.h>
@ -151,7 +151,7 @@ void Command::factory (std::map <std::string, Command*>& all)
c = new CmdStatistics (); all[c->keyword ()] = c; c = new CmdStatistics (); all[c->keyword ()] = c;
c = new CmdStop (); all[c->keyword ()] = c; c = new CmdStop (); all[c->keyword ()] = c;
c = new CmdSummary (); all[c->keyword ()] = c; c = new CmdSummary (); all[c->keyword ()] = c;
c = new CmdSynch (); all[c->keyword ()] = c; // c = new CmdSynch (); all[c->keyword ()] = c;
c = new CmdTags (); all[c->keyword ()] = c; c = new CmdTags (); all[c->keyword ()] = c;
c = new CmdTimesheet (); all[c->keyword ()] = c; c = new CmdTimesheet (); all[c->keyword ()] = c;
c = new CmdUndo (); all[c->keyword ()] = c; c = new CmdUndo (); all[c->keyword ()] = c;

View file

@ -36,7 +36,10 @@ Context context;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv) int main (int argc, char** argv)
{ {
/*
UnitTest t (15); UnitTest t (15);
*/
UnitTest t (12);
try try
{ {
@ -45,7 +48,9 @@ int main (int argc, char** argv)
unlink ("./pending.data"); unlink ("./pending.data");
unlink ("./completed.data"); unlink ("./completed.data");
unlink ("./undo.data"); unlink ("./undo.data");
/*
unlink ("./backlog.data"); unlink ("./backlog.data");
*/
unlink ("./synch.key"); unlink ("./synch.key");
// Set the context to allow GC. // Set the context to allow GC.
@ -58,13 +63,17 @@ int main (int argc, char** argv)
std::vector <Task> pending = context.tdb2.pending.get_tasks (); std::vector <Task> pending = context.tdb2.pending.get_tasks ();
std::vector <Task> completed = context.tdb2.completed.get_tasks (); std::vector <Task> completed = context.tdb2.completed.get_tasks ();
std::vector <std::string> undo = context.tdb2.undo.get_lines (); std::vector <std::string> undo = context.tdb2.undo.get_lines ();
/*
std::vector <Task> backlog = context.tdb2.backlog.get_tasks (); std::vector <Task> backlog = context.tdb2.backlog.get_tasks ();
*/
std::vector <std::string> synch_key = context.tdb2.synch_key.get_lines (); std::vector <std::string> synch_key = context.tdb2.synch_key.get_lines ();
t.is ((int) pending.size (), 0, "TDB2 Read empty pending"); t.is ((int) pending.size (), 0, "TDB2 Read empty pending");
t.is ((int) completed.size (), 0, "TDB2 Read empty completed"); t.is ((int) completed.size (), 0, "TDB2 Read empty completed");
t.is ((int) undo.size (), 0, "TDB2 Read empty undo"); t.is ((int) undo.size (), 0, "TDB2 Read empty undo");
/*
t.is ((int) backlog.size (), 0, "TDB2 Read empty backlog"); t.is ((int) backlog.size (), 0, "TDB2 Read empty backlog");
*/
t.is ((int) synch_key.size (), 0, "TDB2 Read empty synch.key"); t.is ((int) synch_key.size (), 0, "TDB2 Read empty synch.key");
// Add a task. // Add a task.
@ -74,13 +83,17 @@ int main (int argc, char** argv)
pending = context.tdb2.pending.get_tasks (); pending = context.tdb2.pending.get_tasks ();
completed = context.tdb2.completed.get_tasks (); completed = context.tdb2.completed.get_tasks ();
undo = context.tdb2.undo.get_lines (); undo = context.tdb2.undo.get_lines ();
/*
backlog = context.tdb2.backlog.get_tasks (); backlog = context.tdb2.backlog.get_tasks ();
*/
synch_key = context.tdb2.synch_key.get_lines (); synch_key = context.tdb2.synch_key.get_lines ();
t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task"); t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task");
t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks"); t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks");
t.is ((int) undo.size (), 3, "TDB2 after add, 3 undo lines"); t.is ((int) undo.size (), 3, "TDB2 after add, 3 undo lines");
/*
t.is ((int) backlog.size (), 1, "TDB2 after add, 1 backlog task"); t.is ((int) backlog.size (), 1, "TDB2 after add, 1 backlog task");
*/
t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch.key"); t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch.key");
task.set ("description", "This is a test"); task.set ("description", "This is a test");
@ -89,13 +102,17 @@ int main (int argc, char** argv)
pending = context.tdb2.pending.get_tasks (); pending = context.tdb2.pending.get_tasks ();
completed = context.tdb2.completed.get_tasks (); completed = context.tdb2.completed.get_tasks ();
undo = context.tdb2.undo.get_lines (); undo = context.tdb2.undo.get_lines ();
/*
backlog = context.tdb2.backlog.get_tasks (); backlog = context.tdb2.backlog.get_tasks ();
*/
synch_key = context.tdb2.synch_key.get_lines (); synch_key = context.tdb2.synch_key.get_lines ();
t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task"); t.is ((int) pending.size (), 1, "TDB2 after add, 1 pending task");
t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks"); t.is ((int) completed.size (), 0, "TDB2 after add, 0 completed tasks");
t.is ((int) undo.size (), 7, "TDB2 after add, 7 undo lines"); t.is ((int) undo.size (), 7, "TDB2 after add, 7 undo lines");
/*
t.is ((int) backlog.size (), 2, "TDB2 after add, 2 backlog task"); t.is ((int) backlog.size (), 2, "TDB2 after add, 2 backlog task");
*/
t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch.key"); t.is ((int) synch_key.size (), 0, "TDB2 after add, 0 synch.key");
context.tdb2.commit (); context.tdb2.commit ();