Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

This library provides a simple Python interface for implementing erasure codes. To obtain the best possible performance, the underlying erasure code algorithms are written in C.

Project description

This is v0.2 of PyECLib. This library provides a simple Python interface for implementing erasure codes. To obtain the best possible performance, the underlying erasure code algorithms are written in C. Please let me know if you have any other issues building/installing (email:

This library makes use of Jerasure for Reed-Solomon and provides its own flat XOR-based erasure code encoder and decoder. Currently, it implements a specific class of HD Combination Codes (see “Flat XOR-based erasure codes in storage systems: Constructions, efficient recovery, and tradeoffs” in IEEE MSST 2010). These codes are well-suited to archival use-cases, have a simple construction and require a minimum number of participating disks during single-disk reconstruction (think XOR-based LRC code).

The XOR-based codes make use of 128-bit registers using the Intel SIMD extensions. We are currently working on incorporating GF-Complete into Jerasure. Version 1.0 of this library will link to a new version of Jerasure that uses the Intel SIMD instruction set for Vandermonde Reed-Solomon encoding (see GF-Complete 1.0: and “Screaming fast Galois Field arithmetic using Intel SIMD instructions” in USENIX FAST 2013).

Examples of using this library are provided in ./tools:

Command-line encoder:

Command-line decoder:

Utility to determine what is needed to reconstruct missing fragments:

The main Python interface only contains 6 functions:

Encode N bytes into k+m fragments (returns list of fragments):

def encode(self, bytes)

Decode between k and k+m fragments into a string (returns a string):

def decode(self, fragment_payloads)

Reconstruct “missing_fragment_indexes” using “available_fragment_payloads”:

def reconstruct(self, available_fragment_payloads, missing_fragment_indexes)

Return the indexes of fragments needed to reconstruct “missing_fragment_indexes”:

def fragments_needed(self, missing_fragment_indexes)

Return an opaque buffer known by the underlying library:

def get_metadata(self, fragment)

Use opaque buffers from get_metadata() to verify a the consistency of a stripe:

def verify_stripe_metadata(self, fragment_metadata_list)

Return a dict with the keys - segment_size, last_segment_size, fragment_size, last_fragment_size and num_segments:

def get_segment_info(self, data_len, segment_size)

Quick Start:

Standard stuff to install: Python 2.7 (including devel) and argparse.

This package includes c_eclib, which contains a few C libraries used by PyECLib. These will be built when running the PyECLib install (see below).

Install PyECLib:

sudo python install

Run the test suite:

cd test; python; ./; cd ..

If all of this works, then you should be good to go. If not, send me an email!

If the test suite fails because it cannot find any of the shared libraries, then you probably need to add /usr/local/lib to the path searched when loading libraries. The best way to do this (on Linux) is to add ‘/usr/local/lib’ to


and then run:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyeclib, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size PyECLib-0.2.2.tar.gz (7.0 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page