Package: acidfile
acidfile========`acidfile` module provides the ACIDFile object. This object can be used as aregular file object but instead of write one copy of the data, it will writeseveral copies to disk in an ACID manner.This algorithm was explained by `Elvis Pfützenreuter`_ in his blog post`Achieving ACID transactions with common files`_.Latest stable version can be found on `PyPI`_... image:: https://travis-ci.org/nilp0inter/acidfile.png?branch=develop:target: https://travis-ci.org/nilp0inter/acidfile.. image:: https://pypip.in/v/acidfile/badge.png:target: https://pypi.python.org/pypi/acidfile:alt: Latest PyPI version.. image:: https://pypip.in/d/acidfile/badge.png:target: https://pypi.python.org/pypi/acidfile:alt: Number of PyPI downloads`acidfile` is compatible with python 2.6, 2.7, 3.2, 3.3, 3.4 and pypyContribute:.. image:: http://api.flattr.com/button/flattr-badge-large.png:target: https://flattr.com/submit/auto?user_id=nilp0inter&url=https://github.com/nilp0inter/acidfile&title=acidfile&language=&tags=github&category=software:alt: Flattr this git repoInstallation------------Latest version can be installed via `pip`.. code-block:: bash$ pip install --upgrade acidfileRunning the tests-----------------Clone this repository and install the develop requirements... code-block:: bash$ git clone https://github.com/nilp0inter/acidfile.git$ cd acidfile$ pip install -r requirements/develop.txt$ python setup.py develop$ toxUsage examples--------------Basic usage+++++++++++.. code-block:: python>>> from acidfile import ACIDFile>>> myfile = ACIDFile('/tmp/myfile.txt', 'w')>>> myfile.write(b'Some important data.')>>> myfile.close()At the close invocation two copies will be written to disk: *myfile.txt.0* andbelow *myfile.txt.1*. Each one will have an creation timestamp and a HMACsignature... code-block:: python>>> myfile = ACIDFile('/tmp/myfile.txt', 'r')>>> print myfile.read()'Some important data.'>>> myfile.close()If any of the files is damaged due to turning off without proper shutdown ordisk failure, manipulation, etc. It will be detected by the internal HMAC andthe other's file data would be used instead... note:: If you want to read an `acidfile`, never pass the full path of thereal file, instead use the file name that you use in the creation step.| ✗ ACIDFile('/tmp/myfile.txt.0', 'r')| ✗ ACIDFile('/tmp/myfile.txt.1', 'r')| ✓ ACIDFile('/tmp/myfile.txt', 'r')Context manager+++++++++++++++ACIDFile can (and should) be used as a regular context manager:.. code-block:: python>>> with ACIDFile('/tmp/myfile.txt', 'w') as myfile:...     myfile.write(b'Some important data.')Number of copies++++++++++++++++The number of inner copies of the data can be configured through the **copies**parameter.Checksum Key++++++++++++The key used for compute and check the internal HMAC signature can be settedby the **key** parameter.It's recommended to change that key in order to protect against fraud, makingmore difficult for a tamperer to put a fake file in place of the legitimateone... _PyPI: https://pypi.python.org/pypi/acidfile.. _Elvis Pfützenreuter: epx@epx.com.br.. _Achieving ACID transactions with common files: http://epx.com.br/artigos/arqtrans_en.php.. This is your project NEWS file which will contain the release notes... Example: http://www.python.org/download/releases/2.6/NEWS.txt.. The content of this file, along with README.rst, will appear in your.. project's PyPI page.News====1.2.1-----* Using io.open in setup.py to read README and NEWS. This fix someproblems installing the package.+ Python 3.4 support.1.2.0-----+ Python 2.6 support.+ Added Python 3.2 and pypy to tox tests.+ Added flattr button :D* Fixed flake8 and pylint warnings.1.1.0-----+ Python 3 support.+ Changed testing framework to `behave` because python 3 support.+ Using `tox` for multiple python version testing.1.0.0-----* First stable release.+ Documentation.0.0.1-----* Initial development.