Mini Shell
3
{)c� � @ sj d Z ddlmZ ddlZeej�G dd� de��Zeej�G dd� de��Zeej�G dd � d e��ZdS )
z�Module providing common helper classes, functions and other things related to
cached devices (like bcache, LVM cache and whatever appears in the future).
� )�
add_metaclassNc @ sx e Zd ZdZeejdd� ��Zeejdd� ��Zeejdd� ��Z eejdd � ��Z
eejd
d� ��Zejdd
� �ZdS )�Cacheay Abstract base class for cache objects providing the cache-related
functionality on cached devices. Instances of this class are not expected to
be devices (both in what they represent as well as not instances of the
:class:`~.devices.Device` class) since they just provide the cache-related
functionality of cached devices and are not devices on their own.
c C s dS )zSize of the cacheN� )�selfr r �/usr/lib/python3.6/cache.py�size* s z
Cache.sizec C s dS )z(Whether the cache (device) exists or notNr )r r r r �exists/ s zCache.existsc C s dS )zEStatistics for the cache
:rtype: :class:`CacheStats`
Nr )r r r r �stats4 s zCache.statsc C s dS )z;Name of the backing (big/slow) device of the cache (if any)Nr )r r r r �backing_device_name; s zCache.backing_device_namec C s dS )z;Name of the cache (small/fast) device of the cache (if any)Nr )r r r r �cache_device_name@ s zCache.cache_device_namec C s dS )zzDetach the cache
:returns: identifier of the detached cache that can be later used for attaching it back
Nr )r r r r �detachE s zCache.detachN)
�__name__�
__module__�__qualname__�__doc__�property�abc�abstractmethodr r r r
r r r r r r r s r c @ sj e Zd ZdZeejdd� ��Zeejdd� ��Zeejdd� ��Z eejdd � ��Z
eejd
d� ��ZdS )
�
CacheStatsz�Abstract base class for common statistics of caches (cached
devices). Inheriting classes are expected to add (cache-)type-specific
attributes on top of the common set.
c C s dS )zblock size of the cacheNr )r r r r �
block_sizeV s zCacheStats.block_sizec C s dS )zsize of the cacheNr )r r r r r [ s zCacheStats.sizec C s dS )zhow much of the cache is usedNr )r r r r �used` s zCacheStats.usedc C s dS )znumber of hitsNr )r r r r �hitse s zCacheStats.hitsc C s dS )znumber of missesNr )r r r r �missesj s zCacheStats.missesN)r
r r r r r r r r r r r r r r r r M s r c @ sF e Zd ZdZeejdd� ��Zeejdd� ��Zeejdd� ��Z dS ) �CacheRequestz`Abstract base class for cache requests specifying cache parameters for a
cached device
c C s dS )zRequested sizeNr )r r r r r w s zCacheRequest.sizec C s dS )z7Devices (type-specific) to allocate/create the cache onNr )r r r r � fast_devs| s zCacheRequest.fast_devsc C s dS )zMode the cache should useNr )r r r r �mode� s zCacheRequest.modeN)
r
r r r r r r r r r r r r r r p s r ) r Zsixr r �ABCMeta�objectr r r r r r r �<module> s -"