syncevolution/src/syncevo/DevNullConfigNode.h
Patrick Ohly c16f1b0756 sync: avoid maintaining suspend/resume meta data during ephemeral sync
Both maintaining the map items inside the Synthesis engine and storing
them in .ini hash config nodes inside SyncEvolution are fairly heavy
operations which are not needed at all during an ephemeral sync (= no
meta data stored, done by the PIM Manager when triggering a pure PBAP
sync).

Using the new Synthesis CA_ResumeSupported DB capability it is
possible to suppress these operations without having to fiddle with
the Synthesis DB API that SyncEvolution provides. To make it possible
at the DB layer to detect that the meta data is not needed, the
ConfigNode passed to it must be marked as volatile.

This change sped up a sync with 10000 unmodified, known items from 38s
to 23s.
2013-07-12 11:44:39 +02:00

64 lines
2.2 KiB
C++

/*
* Copyright (C) 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef INCL_SYNCEVO_DEVNULL_CONFIG_NODE
# define INCL_SYNCEVO_DEVNULL_CONFIG_NODE
#include <syncevo/ConfigNode.h>
#include <syncevo/util.h>
SE_BEGIN_CXX
/**
* A read-only node which raises an exception when someone tries to
* write into it.
*/
class DevNullConfigNode : public ConfigNode {
string m_name;
public:
DevNullConfigNode(const string &name) : m_name() {}
virtual string getName() const { return m_name; }
virtual bool isVolatile() const { return true; }
virtual void flush() {}
virtual InitStateString readProperty(const string &property) const { return ""; }
virtual void writeProperty(const string &property,
const InitStateString &value,
const string &comment = string(""))
{
SE_THROW(m_name + ": virtual read-only configuration node, cannot write property " +
property + " = " + value);
}
virtual void readProperties(PropsType &props) const {}
virtual void writeProperties(const PropsType &props)
{
if (!props.empty()) {
SE_THROW(m_name + ": virtual read-only configuration node, cannot write properties");
}
}
virtual void removeProperty(const string &property) {}
virtual void clear() {}
virtual bool exists() const { return false; }
virtual bool isReadOnly() const { return true; }
};
SE_END_CXX
#endif // SYNCEVO_DEVNULL_CONFIG_NODE