Skip to main content

Plug Kinto notifications to a collection endpoint.

Project description

Kinto Changes

https://img.shields.io/github/workflow/status/Kinto/kinto-changes/test/master https://img.shields.io/pypi/v/kinto-changes.svg https://coveralls.io/repos/Kinto/kinto-changes/badge.svg?branch=master

kinto-changes shows the list of collection timestamps, allowing to poll changes on several collections with one HTTP request.

Install

pip install kinto-changes

Setup

In the Kinto settings:

kinto.includes = kinto_changes

# List of buckets/collections to show:
kinto.changes.resources = /buckets/settings
                          /buckets/blocklists/collections/certificates

Cache Control

Like cache control in Kinto collections, it is possible to configure Cache-Control headers via some settings:

kinto.monitor.changes.record_cache_expires_seconds = 60

If cache busting query parameters then responses can be cached more agressively. If the setting below is set then a different cache control expiration will be set:

kinto.monitor.changes.record_cache_maximum_expires_seconds = 3600

Advanced options

host

The changes entries will have a host attribute, that can be used to distinguish changes from several Kinto instances.

kinto.changes.http_host = website.domain.tld

By default, it will rely on the global setting kinto.http_host.

_since sanetizing

When reaching the monitor/changes collection, if the provided _since query parameter is too old, we redirect the clients to the full list of changes (ie. without _since).

Set this setting to control the maximum age allowed. Set to -1 to disable redirection.

kinto.changes.since_max_age_days = 21

Endpoints

  • GET /v1/buckets/monitor/collections/changes/records.

Returns the list of timestamps.

  • GET /v1/buckets/{bid}/collections/{cid}/changeset?_expected={timestamp}.

Returns the following response for the collection:

  • changes: list of records, optionnally filtered with ?_since="{timestamp}"

  • metadata: collection attributes

  • timestamp: records timestamp

Note: the _expected={} querystring parameter is mandatory but can contain any arbitrary value (used for cache busting).

Changelog

4.0.0 (2021-10-21)

Breaking Changes

  • No ResourceEvent is sent anymore for changes in this virtual monitor/changes collection.

3.2.0 (2020-11-20)

New features

  • Add filtering support in monitor/changes changeset endpoint

3.1.2 (2020-09-30)

Bug fixes

  • Fix crash when collection is unknown and backend running in readonly mode

3.1.1 (2020-09-28)

Bug fixes

  • Bypass storage when redirecting on old _since

3.1.0 (2020-09-22)

New features

  • Redirect clients whose ?_since value is too old (21 days by default)

  • Add support for monitor/changes in changeset endpoints (fixes #173)

Bug fixes

  • Fix validation rule for _since query parameter

3.0.2 (2020-06-02)

Bug fixes

  • Include tombstones in changeset endpoint (fixes #175)

3.0.1 (2020-05-26)

  • Sort changes explicitly by last_modified descending

3.0.0 (2020-04-20)

Breaking changes

  • Switch changeset timestamp from ETag to integer (#168)

2.2.0 (2020-03-26)

New features

  • Add changeset endpoint (#154)

Bug fixes

  • Fix crash with If-None-Match: * (fixes #158)

2.1.1 (2019-12-23)

Bug fixes

  • Use explicit resource timestamp from DB instead of event payload

2.1.0 (2019-02-20)

New feature

  • Send Cache-Control headers if cache busting query parameters or concurrency control request headers are sent (#66)

2.0.0 (2019-01-15)

Breaking changes

  • Requires Kinto >= 12

1.3.0 (2018-10-15)

New feature

  • Add ability to configure cache control headers (#47)

1.2.1 (2018-09-17)

Bug fixes

  • Don’t do anything during a migrate command (fixes #43).

1.2.0 (2018-09-06)

New feature

  • Events are now generated on the monitor/changes collection (#41).

1.1.1 (2018-04-17)

Internal changes

  • Get rid of six

1.1.0 (2017-11-16)

Breaking changes

  • Upgrade to Kinto 7

Bug fixes

  • Disable reify to always get the most accurate timestamp. (#36)

1.0.0 (2017-02-14)

Bug fixes

  • Accessing the monitoring collection when no changes occured don’t fail anymore (fixes #23)

  • The timestamps shown in the monitoring endpoint are now exactly equal (never superior anymore) to the timestamps of the monitored collections.

Breaking changes

  • The change endpoint location is now hard-coded (/buckets/monitor/collections/changes/records) and cannot be configured.

  • The permissions principals cannot be specified anymore. The change endpoint is now always public.

  • The monitor bucket and changes collection are not required anymore and are not created anymore.

  • POST and DELETE are not supported on the changes endpoint anymore.

  • Individual entries (eg. /buckets/monitor/collections/changes/records/{id}) cannot be accessed anymore.

  • The listener was dropped. Configuration must be changed:

Before:

kinto.event_listeners = changes
kinto.event_listeners.changes.use = kinto_changes.listener
kinto.event_listeners.changes.http_host = website.domain.tld
kinto.event_listeners.changes.collections = /buckets/settings
                                            /buckets/blocklists/collections/certificates

Now:

kinto.changes.http_host = website.domain.tld
kinto.changes.resources = /buckets/settings
                          /buckets/blocklists/collections/certificates

0.5.0 (2017-01-16)

  • Do not force the timestamp of monitored entries (#27)

0.4.0 (2016-11-07)

  • Add the plugin version in the capability (#20)

  • Add collections in the capability (#18)

  • Add a specific setting to override global http_host value (#24)

0.3.0 (2016-05-19)

  • Update to kinto.core for compatibility with Kinto 3.0. This release is no longer compatible with Kinto < 3.0, please upgrade!

0.2.0 (2016-04-25)

  • Addition of the changes capability

0.1.0 (2015-12-22)

  • Initial code.

  • Bucket and collection name configuration.

  • Changes read permissions configuration.

  • Selection of buckets and collections to follow configuration.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kinto-changes-4.0.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

kinto_changes-4.0.0-py2.py3-none-any.whl (9.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file kinto-changes-4.0.0.tar.gz.

File metadata

  • Download URL: kinto-changes-4.0.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.10

File hashes

Hashes for kinto-changes-4.0.0.tar.gz
Algorithm Hash digest
SHA256 43d68983d0dd4a72af1409e8ffa240282deb655ce5e1fb0b4baff72f19220648
MD5 3e427104315964eda33e5dbf23aa6275
BLAKE2b-256 bbaaaa7117caf5dbeaf060d4501455353ed21fff63606d5a5b826b4f8a9bfd6e

See more details on using hashes here.

Provenance

File details

Details for the file kinto_changes-4.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: kinto_changes-4.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.10

File hashes

Hashes for kinto_changes-4.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1dce3d7612442834939e710ce1f1b89a5b04a0861e6aef9767b73d8819107771
MD5 0198a9ad664d2842bf9a59bec5061d22
BLAKE2b-256 5a03f9ff3dfc9c3567f8045c0891bf150d0f539fb681d6c66d335c834dd3671f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page