which is a mature and optimized implementation of erasure coding. The pyfec
package makes several changes from the original "fec" package, including
addition of the Python API, refactoring of the C API to support zero-copy
-operation, and a few clean-ups and micro-optimizations of the core code
-itself.
+operation, a few clean-ups and micro-optimizations of the core code itself,
+and the addition of a command-line tool named "fec".
* Community
input to the encoding step.
+ * Command-Line Tool
+
+The bin/ directory contains two Unix-style, command-line tools "fec" and
+"unfec". Execute "fec --help" or "unfec --help" for usage instructions.
+
+Note: a Unix-style tool like "fec" does only one thing -- in this case erasure
+coding -- and leaves other tasks to other tools. Other Unix-style tools that
+go well with "fec" include "GNU tar" for packaging up multiple files and
+directories into one bundle, "rzip" for compression, and "GNU Privacy Guard"
+for encryption. It is best to do things in that order: first package, then
+compress, then encrypt, then erasure code.
+
+
* API
Each block is associated with "blocknum". The blocknum of each primary block is
which is the first few bytes of the file, the 1'st block is the next primary
block, which is the next few bytes of the file, and so on. The last primary
block has blocknum k-1. The blocknum of each secondary block is an arbitrary
-integer between k and 256 inclusive. (When using the Python API, if you don't
+integer between k and 255 inclusive. (When using the Python API, if you don't
specify which blocknums you want for your secondary blocks when invoking
encode(), then it will by default provide the blocks with ids from k to m-1
inclusive.)
The filefec.py module which has a utility function for efficiently reading a
file and encoding it piece by piece.
-The bin/ directory contains two Unix-style, command-line tools "fec" and
-"unfec". See their usage strings for details.
-
* Dependencies
import sys
+import fec
from fec.util import argparse
-
from fec import filefec
-
+from fec.util.version import Version
+__version__ = Version("1.0.0a1-0-STABLE")
+
+if '-V' in sys.argv or '--version' in sys.argv:
+ print "pyfec library version: ", fec.__version__
+ print "fec command-line tool version: ", __version__
+ sys.exit(0)
+
parser = argparse.ArgumentParser(description="Encode a file into a set of share files, a subset of which can later be used to recover the original file.")
parser.add_argument('inputfile', help='file to encode or "-" for stdin', type=argparse.FileType('rb'), metavar='INF')
parser.add_argument('-m', '--totalshares', help='the total number of share files created', default=16, metavar='M')
parser.add_argument('-k', '--requiredshares', help='the number of share files required to reconstruct', default=4, metavar='K')
parser.add_argument('-v', '--verbose', help='print out messages about progress', action='store_true')
+parser.add_argument('-V', '--version', help='print out version number and exit', action='store_true')
args = parser.parse_args()
if args.prefix is None:
from fec.util import argparse
+import fec
from fec import filefec
-
+from fec.util.version import Version
+__version__ = Version("1.0.0a1-0-STABLE")
+
+if '-V' in sys.argv or '--version' in sys.argv:
+ print "pyfec library version: ", fec.__version__
+ print "fec command-line tool version: ", __version__
+ sys.exit(0)
+
parser = argparse.ArgumentParser(description="Decode data from share files.")
parser.add_argument('outputfile', help='file to write the resulting data to, or "-" for stdout', type=argparse.FileType('wb'), metavar='OUTF')
parser.add_argument('sharefiles', nargs='+', help='shares file to read the encoded data from', type=argparse.FileType('rb'), metavar='SHAREFILE')
parser.add_argument('-v', '--verbose', help='print out messages about progress', action='store_true')
+parser.add_argument('-V', '--version', help='print out version number and exit', action='store_true')
args = parser.parse_args()
if len(args.sharefiles) < 2:
# For an explanation of what the parts of the version string mean,
# please see pyutil.version.
-__version__ = Version("0.9.9-0-STABLE")
+__version__ = Version("1.0.0a1-0-STABLE")
# Please put a URL or other note here which shows where to get the branch of
# development from which this version grew.
]
setup(name='pyfec',
- version='0.99',
+ version='1.0.0a1',
summary='Provides a fast C implementation of Reed-Solomon erasure coding with a Python interface.',
- description='Erasure coding is the generation of extra redundant packets of information such that if some packets are lost ("erased") then the original data can be recovered from the remaining packets. This package contains an optimized implementation along with a Python interface.',
+ description='Erasure coding is the generation of redundant blocks of information such that if some blocks are lost ("erased") then the original data can be recovered from the remaining blocks. This package contains an optimized implementation along with a Python interface.',
author='Zooko O\'Whielacronx',
author_email='zooko@zooko.com',
- url='http://zooko.com/repos/pyfec',
+ url='http://www.allmydata.com/source/pyfec',
license='GNU GPL',
platform='Any',
packages=['fec', 'fec.util', 'fec.test'],