Vitor de Lima has posted comments on this change.
Change subject: cache: Add caching decorator with invalidation
......................................................................
Patch Set 5:
(3 comments)
http://gerrit.ovirt.org/#/c/34709/5/lib/vdsm/cache.py
File lib/vdsm/cache.py:
Line 115: """
Line 116: A memoized validator returning True when the contents of a small file have
Line 117: changed since the last validation. Used, for example, to monitor files in
Line 118: /sys which do not properly expose status like regular files.
Line 119: """
I assume that by reading the contents of a small file, you save
expensive c
Sure, it will be used in the physical CPU hotplug for monitoring the
/sys/devices/system/cpu/online for changes in the number of online CPUs.
Line 120:
Line 121: def __init__(self, path):
Line 122: self.path = path
Line 123: self.contents = None
http://gerrit.ovirt.org/#/c/34709/5/tests/cacheTests.py
File tests/cacheTests.py:
Line 219: def test_update_when_file_content_changed(self):
Line 220: self._update_file_content_and_verify(file_content_changed)
Line 221:
Line 222:
Line 223: @tools.nottest
I don't follow, what does this do on a class?
This test is
a reusable "abstract" test case, it you don't flag it as "nottest"
it will run and fail, since there is not a validator_class set.
Line 224: class FilePresenceTests(VdsmTestCase):
Line 225:
Line 226: validator_class = None
Line 227:
Line 275: # No change in stats
Line 276: self.assertFalse(validator())
Line 277:
Line 278:
Line 279: @tools.istest
I don't follow, what does this do on a class?
This
overrides the "nottest" of the base class to mark these two classes as tests
that should be executed.
Line 280: class FileModifiedTests(FilePresenceTests):
Line 281:
Line 282: validator_class = file_modified
Line 283:
--
To view, visit
http://gerrit.ovirt.org/34709
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I6dd8fb29d94286e3e3a3e29b8218501cbdc5c018
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Vitor de Lima <vdelima(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes