cri_models.sync.engine module
- class cri_models.sync.engine.SyncEngine(*args, **kwargs)[source]
Bases:
object
Base class for synchronization engines
- class cri_models.sync.engine.UnidirectionalSyncEngine(*args, **kwargs)[source]
Bases:
cri_models.sync.engine.SyncEngine
This synchronization engine always brings the remote objects to the state of the local objects.
- sync(local_objects, remote_objects, obj_map, *, pretend=False)[source]
Synchronize objects.
- The synchronization is done according to a three steps process:
We remove the remote objects who are not related to a local objects.
We create the missing remote objects for which a corresponding local objects exists.
We update the remote objects for which a corresponding local objects exists.
- Parameters
local_objects – a mapping between local objects ID and data
remote_objects – a mapping between remote objects ID and data
obj_map – a mapping between existing local objects IDs and existing remote objects IDs.
pretend – if True no action is effectively performed.
- Returns
a tuple containing added, updated, deleted objects and failed operations