Change in vdsm[master]: virt: add ExpiringDict

danken at redhat.com danken at redhat.com
Fri Jan 30 09:19:46 UTC 2015


Dan Kenigsberg has posted comments on this change.

Change subject: virt: add ExpiringDict
......................................................................


Patch Set 6: Code-Review-1

(2 comments)

http://gerrit.ovirt.org/#/c/36716/6/vdsm/virt/utils.py
File vdsm/virt/utils.py:

Line 53:     to access them, using get, __getitem__ or __contains__.
Line 54: 
Line 55:     Expired keys are considered absent, even though not yet
Line 56:     actually removed, for __len__.
Line 57:     This is done to not excessively slow down __len__.
I'm not convinced: if len() is called few times, we don't care about its speed. If it's called a lot - we don't want to iterate expired items several times.
Line 58:     """
Line 59:     def __init__(self, ttl, clock=monotonic_time):
Line 60:         self._ttl = ttl
Line 61:         self._clock = clock


Line 104:     # private
Line 105: 
Line 106:     def _get(self, key):
Line 107:         """
Line 108:         Return the None if invalid or expired key.
the None -> None
Line 109:         Automatically cleanup expired keys.
Line 110:         Caller must ensure proper locking.
Line 111:         """
Line 112:         if key not in self._items:


-- 
To view, visit http://gerrit.ovirt.org/36716
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I51e38cea6a23b7abe2375780e6ece0ff90831b6d
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list