Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interface: Require invalidations to be called with full set of objects and not to skip transactions #319

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions src/ZODB/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) Zope Corporation and Contributors.
Expand Down Expand Up @@ -280,9 +281,9 @@ class IStorageWrapper(Interface):
- Out-of-band invalidation support

A storage can notify it's wrapper of object invalidations that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/it's/its/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'm not changing this line at all and the "it's" come from old text. There are other usage of "it's" in ZODB/interfaces.py where I would put "its" by myself. I thought it is kind of US style or something similar and not delved into changing what is semantically not covered by the patch subject. If we are to change "it's" -> "its" I think it is better to do in a separate patch and for the whole file or whole codebase.

Thanks for the approval.

don't occur due to direct operations on the storage. Currently
this is only used by ZEO client storages to pass invalidation
messages sent from a server.
don't occur due to direct operations on the storage. This is used
by the client part of non-IMVCCStorage storages like ZEO and NEO
to pass invalidation messages sent from a storage server.

- Record-reference extraction

Expand Down Expand Up @@ -318,6 +319,15 @@ def invalidate(transaction_id, oids):

The oids argument is an iterable of object identifiers.

Unless the cache needs to be completely cleared via
invalidateCache event, the wrapped storage calls invalidate for
all transactions in the order as they are committed. For every
transaction the full set of its objects - both modified and just
created - is reported.

invalidate(tid) is always called before the storage starts to
report its lastTransaction() ≥ tid.

The version argument is provided for backward
compatibility. If passed, it must be an empty string.

Expand Down Expand Up @@ -1209,13 +1219,18 @@ def release():
def poll_invalidations():
"""Poll the storage for external changes.

Returns either a sequence of OIDs that have changed, or None. When a
sequence is returned, the corresponding objects should be removed
from the ZODB in-memory cache. When None is returned, the storage is
indicating that so much time has elapsed since the last poll that it
is no longer possible to enumerate all of the changed OIDs, since the
previous transaction seen by the connection has already been packed.
In that case, the ZODB in-memory cache should be cleared.
Returns either None, or a sequence of OIDs with the full set of
objects that have been created or changed since the previous
call to poll_invalidations.

When a sequence is returned, the corresponding objects should be
removed from the ZODB in-memory cache.

When None is returned, the storage is indicating that so much time has
elapsed since the last poll that it is no longer possible to enumerate
all of the changed OIDs, since the previous transaction seen by the
connection has already been packed. In that case, the ZODB in-memory
cache should be cleared.
"""

def sync(force=True):
Expand Down