TDB2: Explicitly mark updates done as addition to optimize performance
We are able to avoid loading the completed.data in certain scenarios.
This commit is contained in:
committed by
Paul Beckingham
parent
48be6986c2
commit
f0cc0151b7
@@ -572,7 +572,7 @@ void TDB2::add (Task& task, bool add_to_backlog /* = true */)
|
|||||||
if (add_to_backlog)
|
if (add_to_backlog)
|
||||||
context.hooks.onAdd (task);
|
context.hooks.onAdd (task);
|
||||||
|
|
||||||
update (uuid, task, add_to_backlog);
|
update (uuid, task, add_to_backlog, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -598,14 +598,15 @@ void TDB2::modify (Task& task, bool add_to_backlog /* = true */)
|
|||||||
void TDB2::update (
|
void TDB2::update (
|
||||||
const std::string& uuid,
|
const std::string& uuid,
|
||||||
Task& task,
|
Task& task,
|
||||||
const bool add_to_backlog)
|
const bool add_to_backlog,
|
||||||
|
const bool addition)
|
||||||
{
|
{
|
||||||
// Validate to add metadata.
|
// Validate to add metadata.
|
||||||
task.validate (false);
|
task.validate (false);
|
||||||
|
|
||||||
// If the task already exists, it is a modification, else addition.
|
// If the task already exists, it is a modification, else addition.
|
||||||
Task original;
|
Task original;
|
||||||
if (get (task.get ("uuid"), original))
|
if (not addition && get (task.get ("uuid"), original))
|
||||||
{
|
{
|
||||||
// Update the task, wherever it is.
|
// Update the task, wherever it is.
|
||||||
if (!pending.modify_task (task))
|
if (!pending.modify_task (task))
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void gather_changes ();
|
void gather_changes ();
|
||||||
void update (const std::string&, Task&, const bool);
|
void update (const std::string&, Task&, const bool, const bool addition = false);
|
||||||
bool verifyUniqueUUID (const std::string&);
|
bool verifyUniqueUUID (const std::string&);
|
||||||
void show_diff (const std::string&, const std::string&, const std::string&);
|
void show_diff (const std::string&, const std::string&, const std::string&);
|
||||||
void revert_undo (std::vector <std::string>&, std::string&, std::string&, std::string&, std::string&);
|
void revert_undo (std::vector <std::string>&, std::string&, std::string&, std::string&, std::string&);
|
||||||
|
|||||||
Reference in New Issue
Block a user