~ubuntu-branches/ubuntu/trusty/syncevolution/trusty-proposed

« back to all changes in this revision

Viewing changes to src/syncevo/TrackingSyncSource.h

  • Committer: Bazaar Package Importer
  • Author(s): Tino Keitel
  • Date: 2011-07-20 16:02:02 UTC
  • mfrom: (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110720160202-e8uf7ogw4vh0q0f3
Tags: 1.1.99.5a-1
* New upstream version 1.1.99.5a, first release candiate for 1.2
* Added python-openssl dependency, the HTTP server needs it for HTTPS support
* Added versioned dependency on libsynthesis0 to get required features
* Fixed .orig.tar.gz generation in get-orig-source target
* Added myself to Uploaders:, thanks to David for sponsoring
* Use updated upstream tag for source package generation
* Removed 0001-Replace-with-in-call-to-PKG_CHECK_MODULES.patch, fixed upstream
* Renamed NEWS.Debian to NEWS so that it is actually used
* Updated NEWS for 1.1.99.5a

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
    virtual bool isEmpty() = 0;
122
122
 
123
123
    /**
 
124
     * A unique identifier for the current state of the complete database.
 
125
     * The semantic is the following:
 
126
     * - empty string implies "state unknown" or "identifier not supported" (the default implementation)
 
127
     * - id not empty and id_1 == id_2 implies "nothing has changed";
 
128
     *   the inverse is not true (ids may be different although nothing has changed)
 
129
     */
 
130
    virtual std::string databaseRevision() { return ""; }
 
131
 
 
132
    /**
124
133
     * fills the complete mapping from LUID to revision string of all
125
134
     * currently existing items
126
135
     *
135
144
    virtual void listAllItems(SyncSourceRevisions::RevisionMap_t &revisions) = 0;
136
145
 
137
146
    /**
 
147
     * Called at the start of the sync session to tell
 
148
     * the derived class about the cached information if (and only
 
149
     * if) listAllItems() and updateAllItems() were not called. The derived class
 
150
     * might not need this information, so the default implementation
 
151
     * simply ignores.
 
152
     *
 
153
     * A more complex API could have been defined to only prepare the
 
154
     * information when needed, but that seemed unnecessarily complex.
 
155
     */
 
156
    virtual void setAllItems(const RevisionMap_t &revisions) {}
 
157
 
 
158
    /**
 
159
     * updates the revision map to reflect the current state
 
160
     *
 
161
     * May be called instead of listAllItems() if the caller has
 
162
     * a valid list to start from. If the implementor
 
163
     * cannot update the list, it must start from scratch by
 
164
     * reseting the list and calling listAllItems(). The default
 
165
     * implementation of this method does that.
 
166
     */
 
167
    virtual void updateAllItems(SyncSourceRevisions::RevisionMap_t &revisions) {
 
168
        revisions.clear();
 
169
        listAllItems(revisions);
 
170
    }
 
171
 
 
172
    /**
138
173
     * Create or modify an item.
139
174
     *
140
175
     * The sync source should be flexible: if the LUID is non-empty, it
199
234
     * Returns the preferred mime type of the items handled by the sync source.
200
235
     * Example: "text/x-vcard"
201
236
     */
202
 
    virtual const char *getMimeType() const = 0;
 
237
    virtual std::string getMimeType() const = 0;
203
238
 
204
239
    /**
205
240
     * Returns the version of the mime type used by client.
206
241
     * Example: "2.1"
207
242
     */
208
 
    virtual const char *getMimeVersion() const = 0;
 
243
    virtual std::string getMimeVersion() const = 0;
209
244
 
210
245
    using SyncSource::getName;
211
246
 
212
247
  private:
213
248
    void checkStatus(SyncSourceReport &changes);
214
 
 
 
249
    boost::shared_ptr<ConfigNode> m_trackingNode;
 
250
 
 
251
    /**
 
252
     * Stores meta information besides the item list:
 
253
     * - "databaseRevision" = result of databaseRevision() at end of last sync
 
254
     *
 
255
     * Shares the same key/value store as m_trackingNode,
 
256
     * which uses the "item-" prefix in its keys to
 
257
     * avoid name clashes.
 
258
     */
 
259
    boost::shared_ptr<ConfigNode> m_metaNode;
 
260
 
 
261
 protected:
215
262
    /* implementations of SyncSource callbacks */
216
263
    virtual void beginSync(const std::string &lastToken, const std::string &resumeToken);
217
264
    virtual std::string endSync(bool success);
222
269
    virtual void readItemRaw(const std::string &luid, std::string &item);
223
270
    virtual void enableServerMode();
224
271
    virtual bool serverModeEnabled() const;
225
 
    virtual const char *getPeerMimeType() const;
226
 
 
227
 
    boost::shared_ptr<ConfigNode> m_trackingNode;
 
272
    virtual std::string getPeerMimeType() const;
228
273
};
229
274
 
230
275