Synchronizer handles synchronizing between two databases. More...

Import Statement: import U1db .


Detailed Description

Synchronizer {
id: mySync
synchronize: false
source: myDatabase
targets: [ {
remote: true,
ip: "",
port: 7777,
name: "example1.u1db",
resolve_to_source: true
} ]

Property Documentation

resolve_to_source : bool

If true, conflicts during sync will be resolved in favor of the content from the source database.

source : Database

Returns the source Database.

sync_output : list<Variant>

Returns the output from a sync session. The list should contain numerous QVariantMaps, each of which will have various meta-data with informative information about what happened in the background of the session.

In some cases the information will be about errors or warnings, and in other cases simple log messages. Also included would noramlly be associated properties, elements and other data.

The information can be used in any number of ways, such as on screen within an app, testing, console output, logs and more. This is designed to be flexible enough that the app developer can decide themselves how to best use the data.

synchronize : bool


targets : Variant

This QML property is under development and is subject to change.

Sets meta-data for databases to be used during a synchronization session.

The QVariant is a list that can contain definitions for more than one database to be used as a target. For example:

targets: [{remote:true},
port: 7777,

The above example defines three databases. Two of the three definitions in the example are invalid, the first ({remote:true}) and the third ({remote:"OK"}), because they are incomplete.

The second definition is a fully defined and valid definition for a local to remote synchronization of two databases:

port: 7777,

'remote' determines whether the database is on disk or located on a server. 'ip' and 'port' for a server are used only when 'remote' is set to true 'name' is the name of the local (on disk) or remote database. Note: If 'remote' is false this is the relative/absolute file location. 'resolve_to_source' determines whether to resolve conflicts automatically in favor of the source (aka local) database's values or the target's.