proof-of-concept: Track modifications of records in Kinto and store the collection timestamps into a specific bucket and collection.
This plugin is useful to allow for polling on several collections changes with one HTTP request.
pip install kinto-changes
In the Kinto settings:
kinto.includes = kinto_changes kinto.event_listeners = changes kinto.event_listeners.changes.use = kinto_changes.listener
Now everytime a record is modified, the list of current timestamps is available
at GET /v1/buckets/monitor/collections/changes/records
.
It is possible to choose which collections are monitored:
kinto.event_listeners.changes.collections = <list of URIs>
For example, to be notified of record updates in the certificates
collection,
or every collections of the settings
bucket:
kinto.event_listeners.changes.collections = /buckets/blocklists/collections/certificates /buckets/settings
By default the list of timestamps is readable by everyone. The list of authorized principals can be specified in settings:
kinto.event_listeners.changes.principals = system.Authenticated group:admins twitter:@natim
By default, the list of timestamps is available in the changes
collection in
the monitor
bucket. This can be specified in settings:
kinto.event_listeners.changes.bucket = monitor kinto.event_listeners.changes.collection = changes
If specified in settings, the changes will have a http_host
attribute.
This can be used to distinguish changes from several Kinto instances.
kinto.http_host = website.domain.tld