Mini Shell
3
{)c�_ � @ s� d dl Z d dlmZ ddlmZ ddlmZ dd� Zee j�G dd � d e ��Z
ee j�G d
d� de
��ZG dd
� d
e �Ze� Z
G dd� de�ZG dd� de�Ze� Ze
je� e� Ze
je� G dd� de�Ze� Ze
je� G dd� de�Ze� Ze
je� G dd� de�Ze� Ze
je� G dd� de�Ze� Ze
je� G dd� de�Ze� Ze
je� G dd� de
�Ze� Ze
je� G dd� de
�ZG d d!� d!e�Ze� Ze
je� G d"d#� d#e�Ze� Ze
je� G d$d%� d%e
�Ze� Ze
je� d&d'� ZdS )(� N)�
add_metaclass� )� RaidError)�Sizec C s | |d | S )z�Rounds up integer division. For example, div_up(3, 2) is 2.
:param int a: the dividend
:param int b: the divisor
� � )�a�br r �/usr/lib/python3.6/raid.py�div_up s r c @ sf e Zd ZdZejdd�Zejdd�Zejdd�Zej dd� �Z
ejdd�Zd d
� Zdd� Z
d
d� ZdS )� RAIDLevelz�An abstract class which is the parent of all classes which represent
a RAID level.
It ensures that RAIDLevel objects will really be singleton objects
by overriding copy methods.
z!The canonical name for this level)�docz(List of recognized names for this level.zIThe minimum number of members required to make a fully functioning array.c C s
t � �dS )a Whether this RAID level incorporates inherent redundancy.
Note that for some RAID levels, the notion of redundancy is
meaningless.
:rtype: boolean
:returns: True if this RAID level has inherent redundancy
N)�NotImplementedError)�selfr r r
�has_redundancy7 s
zRAIDLevel.has_redundancyz9Whether data is uniformly distributed across all devices.c C s | j S )N)�name)r r r r
�__str__E s zRAIDLevel.__str__c C s | S )Nr )r r r r
�__copy__H s zRAIDLevel.__copy__c C s | S )Nr )r �memor r r
�__deepcopy__K s zRAIDLevel.__deepcopy__N)�__name__�
__module__�__qualname__�__doc__�abc�abstractpropertyr �names�min_members�abstractmethodr �
is_uniformr r r r r r r
r ) s r c @ s� e Zd ZdZejdd�Zejdd�Zedd� �Z edd� dd�Z
ed d� d
d�Zedd� dd�Zed
d� dd�Z
dd� Zejdd� �Zdd� Zejdd� �Zdd� Zejdd� �Zejdd� �Zejdd� �Zdd � Zejd!d"� �Zd(d$d%�Zd)d&d'�Zd#S )*�RAIDna An abstract class which is the parent of classes which represent a
numeric RAID level. A better word would be classification, since 'level'
implies an ordering, but level is the canonical word.
The abstract properties of the class are:
- level: A string containing the number that designates this level
- nick: A single nickname for this level, may be None
All methods in this class fall into these categories:
1) May not be overrridden in any subclass.
2) Are private abstract methods.
3) Are special Python methods, e.g., __str__
Note that each subclass in this file is instantiated immediately after
it is defined and using the same name, effectively yielding a
singleton object of the class.
zA code representing the level)r
zA nickname for this levelc C s dS )NTr )�sr r r
�<lambda>p s zRAIDn.<lambda>c C s
t | j�S )N)�int�level)r! r r r
r"