Synchronizer Extension API
Synchronizer extension API
Global functions
synchronizer(config: dict)
Return an instance of a class that adheres to the synchronizer plug-in API (see below). muninn will pass the content of the
synchronizer:<name>
section (minus themodule
setting) as a single positional argument to this function. The implementation of this function should only setup the configuration state and not initiate any network connections yet.
Methods
sync(self, archive: muninn.Archive, product_types: typing.List[str] = None, start: datetime.datetime = None,
end: datetime.datetime = None, force: bool = False)
A synchronizer object should have a
sync
method that performs the catalogue sync. It should update the state of the catalogue of the archive based on the state of an external database. Synchronizations should be performed on a product type by product type basis. The global list of applicable product types can be hard-coded in the extension or provided as configuration to thesynchronizer
global function. Thesync
method itself should limit itself to the list of product types given by theproduct_types
parameter if this parameter was set (and otherwise sync all product types from the internal global list). The sync should ideally be performed in chronological order, following the timestamps of modifications in the external database. Thestart
andend
parameters are meant to define the time range within the chronological timeline to synchronize. Thesync
method should only update the catalogue database by means of e.g.muninn.create_properties
,muninn.update_properties
, andmuninn.remove
calls. It should explicitly not perform anymuninn.pull
calls. Theforce
option indicates that thesync
method should always call amuninn.update_properties
for entries that were already in the muninn catalogue. Any network activity should only happen within the scope of thissync
method. The synchronizer object should not keep any connection state active after the method returns.