5f61785608
This patch introduces code changes for the new layout without actually using it yet. Therefore all existing tests for the older layout still pass. The new meaning of the former "server name" is introduced: - A plain string now refers to a peer configuration (can be client or server). - The @ sign allows selecting a specific context. Different contexts have independent sets of local sources and peer definitions. - An empty peer name selects a view on the configuration which contains no peer-specific properties. Not fully implemented yet. The FileConfigTree is instantiated with a root which is one level high up compare to before this patch (for example, "~/.config/syncevolution" instead of "./config/syncevolution/scheduleworld") and then config files include that dropped level in their relative path name ("scheduleworld/config.ini" instead of "config.ini"). This allows accessing the global properties in "~/.config/syncevolution/config.ini" and will be used to move peers further down the hierarchy ("~/.config/syncevolution/peers/scheduleworld/config.ini"). To keep the output of "--print-servers" consistent, the FileConfigTree gets another parameter which identifies the subset of the larger tree that is referenced by this FileConfigTree instance. One side effect of this change is that FileConfigTree instances are no longer completely separate. Something to keep in mind when instantiating SyncContext multiple times (MB#8006). Code may no longer make assumptions in which config node a property is stored. This is determined by the new getNode() calls based on the property attributes (hidden, sharing). The new layout is represented as a set of config nodes. Older layouts use the same set of nodes with identical instances assigned to them, if they don't really have separate files for each of them. SyncSourceNodes no longer grants direct access to the nodes, to catch code which incorrectly access a specific node directly. For the same reason the name of the nodes changed. Code which needs access to all hidden or all visible properties now does this via a config node returned by getProperties(). Currently this is identical to the underlying nodes. Once the new layout is active, this node will act as a multiplexer which gathers properties from all underlying nodes when reading and picks the right one when writing. The "change ID" parameter for sources has been obsolete for a while and was removed. Reorganized the property registration so that it is a bit easier to see which properties are hidden and which use non-default sharing. The default sharing is "no sharing". Some other code was improved while touching it: - removed useless visibility[] array in favor of a i != 0 check in SyncConfig::copy() - added default parameters to save/checkPassword() methods - some constness definition changes - Property::getProperty() is a virtual call which could only be overloaded in one case because the constness was wrong; now getProperty() always returns the string value and getPropertyValue() some other kind of representation of it, depending on the class. - ConstSyncSourceNodes is based on SyncSourceNodes instead of duplicating it, which simplifies the implementation. The simplified SyncSourceAdmin API changed slightly: instead of passing a pointer to the source's SyncSourceNodes, the default nodes are now found via the SyncSource pointer. For callers this is a bit less work and it is more general.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
/*
|
|
* Copyright (C) 2008-2009 Patrick Ohly <patrick.ohly@gmx.de>
|
|
*
|
|
* 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_EVOLUTION_VOLATILE_CONFIG_TREE
|
|
# define INCL_EVOLUTION_VOLATILE_CONFIG_TREE
|
|
|
|
#include <syncevo/FileConfigTree.h>
|
|
#include <syncevo/declarations.h>
|
|
SE_BEGIN_CXX
|
|
|
|
|
|
/**
|
|
* This class can store properties while in memory, but will never
|
|
* save them persistently. Implemented by instantiating a FileConfigTree
|
|
* with invalid path and intercepting its flush() method.
|
|
*/
|
|
class VolatileConfigTree : public FileConfigTree {
|
|
public:
|
|
VolatileConfigTree() :
|
|
FileConfigTree("/dev/null", "", false)
|
|
{}
|
|
|
|
virtual void flush() {}
|
|
};
|
|
|
|
|
|
SE_END_CXX
|
|
#endif
|