diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-09-13 21:06:46 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-09-13 21:06:46 +0000 |
commit | aa7a2c0cf20b91919bea77b2569da6999aa47525 (patch) | |
tree | cfdfe9100e0a04adb50728224e0b52830a4fc04c /pyeclib | |
parent | 0cdfbf6f6eaf2a4f67c83d4019614cde414ca2f9 (diff) | |
parent | f990e62dc05c46e323019ca0267e5564c3cf15a7 (diff) | |
download | pyeclib-aa7a2c0cf20b91919bea77b2569da6999aa47525.tar.gz |
Merge "Clean up ECDriver"
Diffstat (limited to 'pyeclib')
-rw-r--r-- | pyeclib/ec_iface.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/pyeclib/ec_iface.py b/pyeclib/ec_iface.py index ed7a7a6..43f0e61 100644 --- a/pyeclib/ec_iface.py +++ b/pyeclib/ec_iface.py @@ -142,8 +142,22 @@ class PyECLib_FRAGHDRCHKSUM_Types(PyECLibEnum): # Main ECDriver class class ECDriver(object): - - def __init__(self, *args, **kwargs): + '''A driver to encode, decode, and reconstruct erasure-coded data.''' + + def __init__(self, **kwargs): + ''' + :param ec_type: the erasure coding type to use for this driver. + :param k: number of data fragments to use. Required. + :param m: number of parity fragments to use. Required. + :param chksum_type: + :param validate: default: False + :param library_import_str: default: 'pyeclib.core.ECPyECLibDriver' + + You must provide either ``ec_type`` or ``library_import_str``; + typically you just want to use ``ec_type``. See ALL_EC_TYPES for the + list of all EC types supported by PyECLib, and VALID_EC_TYPES for the + list of all EC types currently available on this system. + ''' self.k = -1 self.m = -1 self.hd = -1 @@ -156,6 +170,11 @@ class ECDriver(object): raise ECDriverError( "Invalid Argument: %s is required" % required) + if 'ec_type' not in kwargs and 'library_import_str' not in kwargs: + raise ECDriverError( + "Invalid Argument: either ec_type or library_import_str " + "must be provided") + for (key, value) in kwargs.items(): if key == "k": try: |