[master 2/7] Add generic class for cache creation requests

vpodzime installerbot-noreply at redhat.com
Tue Aug 4 14:31:17 UTC 2015


From: Vratislav Podzimek <vpodzime at redhat.com>

Instead of passing cache parameters as separate numbers, strings, etc. we may
better put them into objects that hold them as a single logical unit.
---
 blivet/devices/cache.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/blivet/devices/cache.py b/blivet/devices/cache.py
index f036466..94b81dd 100644
--- a/blivet/devices/cache.py
+++ b/blivet/devices/cache.py
@@ -114,3 +114,24 @@ def hits(self):
     def misses(self):
         """number of misses"""
         pass
+
+ at add_metaclass(abc.ABCMeta)
+class CacheRequest(object):
+    """Abstract base class for cache requests specifying cache parameters for a
+    cached device
+
+    """
+    @abc.abstractproperty
+    def size(self):
+        """Requested size"""
+        pass
+
+    @abc.abstractproperty
+    def fast_devs(self):
+        """Devices (type-specific) to allocate/create the cache on"""
+        pass
+
+    @abc.abstractproperty
+    def mode(self):
+        """Mode the cache should use"""
+        pass


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/a9e0b7ff3944153d2f577fc1d7d549b35e1bbd14


More information about the anaconda-patches mailing list