{ "info": { "author": "Joe McIntyre", "author_email": "j_h_mcintyre@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Software Development" ], "description": "=========\nSafe File\n=========\n\nPart of the\n`Using JSON Schema `_\nproject.\n\nRobust storage using text files is enhanced with support for automated recovery\nshould an update fail. \n\nThis library provides support for reading and writing files in a recoverable\nmode, allowing automated recovery when the program restarts. Normal file\nread / write is also supported, enabling a common interface for both files\nusing automated recovery capabilities and those not using them.\n\n.. image:: https://travis-ci.org/usingjsonschema/ujs-safefile-python.svg?branch=master\n :target: https://travis-ci.org/usingjsonschema/ujs-safefile-python\n\nAPI\n---\n\nreadFile\n--------\n\nRead a file synchronously from a file system.\n\n**readFile** (filename)\n\n| arguments:\n| filename *string* Name of file to read (path optional) \n|\n| raises *SafeFileError* \n| returns *string* Data read\n\n.. code:: python\n\n data = readFile (filename)\n\nwriteFile\n---------\n\nWrite a file synchronously to a file system.\n\n**writeFile** (filename, data)\n\n| arguments:\n| filename *string* Name of file to write (path optional) \n| data *string* Data to write to the file\n|\n| raises *SafeFileError*\n\n.. code:: python\n\n writeFile (filename, data)\n\nsafeReadFile\n------------\n\nRead a file synchronously from a file system, inspecting the file system state\nand performing recovery processing if needed.\n\n**safeReadFile** (filename)\n\n| Arguments:\n| filename *string* Name of file to read (path optional) \n|\n| raises *SafeFileError* \n| returns *string* Data read\n\n.. code:: python\n\n data = safeReadFile (filename)\n\nsafeWriteFile\n-------------\n\nWrite data to a file synchronously, using a recoverable set of steps. Should\nthe write processing fail to complete, auto-recovery can perform the steps\nrequired to bring the file content back to a stable state.\n\n**safeWriteFile** (filename, data)\n\n| Arguments:\n| filename *string* Name of file to write (path optional) \n| data *string* Data to write to the file \n|\n| raises *SafeFileError*\n\n.. code:: python\n\n safeWriteFile (filename, data)\n\nsafeGetState\n------------\n\nGet the current state of the set of files representing the current file\nsystem contents. Returns one of,\n\n- SAFE_NORMAL, normal state, base and backup files only present\n- SAFE_RECOVERABLE, partial write condition that is automatically recoverable\n the next time a read, write or recover function is called\n- SAFE_INTERVENE, last write failed before the data being written reached\n a recoverable state. Manual intervention is required if recovery of the last\n write is required, otherwise auto-recovery will recover to the prior stable\n state.\n\n**safeGetState** (filename)\n\n| Arguments:\n| filename *string* Name of file to check (path optional)\n|\n| returns *integer* State value (SAFE_NORMAL, SAFE_RECOVERABLE or \n SAFE_INTERVENE) or a file error (INVALID_NAME, DOES_NOT_EXIST or\n IS_NOT_A_FILE)\n\n.. code:: python\n\n state = safeGetState (filename)\n\nsafeRecover\n-----------\n\nInitiate the auto-recovery process. This follows the same steps as\n``safeReadFile`` follows, but can be called independently.\n\n**safeRecover** (filename)\n\n| Arguments:\n| filename *string* Name of file to recover (path optional)\n|\n| raises *SafeFileError*\n\n.. code:: python\n\n safeRecover (file)\n\nSafeFileError\n-------------\n\n**SafeFileError** (code, message)\n\n| Arguments:\n| code *integer* Error code (from list below)\n| message *string* Text message associated with code\n\nConstants for the error codes,\n\n- NO_ERROR\n- INVALID_NAME\n- DOES_NOT_EXIST\n- IS_NOT_A_FILE\n- READ_ERROR\n- WRITE_ERROR\n- SAFE_NORMAL\n- SAFE_RECOVERABLE\n- SAFE_INTERVENE\n\nInstallation\n------------\n\nThe program can be installed using ``pip``, with the command,\n\n.. code:: bash\n\n pip install ujs-safefile\n\nLicense\n-------\n\nMIT", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/usingjsonschema/ujs-safefile-python", "keywords": "bookujs file", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "ujs-safefile", "package_url": "https://pypi.org/project/ujs-safefile/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ujs-safefile/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/usingjsonschema/ujs-safefile-python" }, "release_url": "https://pypi.org/project/ujs-safefile/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Automated recovery file library", "version": "0.1.0" }, "last_serial": 1155776, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d0694e1b670a082b1e5a6b25d677ceee", "sha256": "d1c0fe68c0456bb5454d7df750121d8719f47c5e7871ccea755e11f6a414e0be" }, "downloads": -1, "filename": "ujs-safefile-0.1.0.zip", "has_sig": false, "md5_digest": "d0694e1b670a082b1e5a6b25d677ceee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11722, "upload_time": "2014-07-12T19:57:35", "url": "https://files.pythonhosted.org/packages/52/5f/f8c8a0d1db7a8af5fecdf2bcaeeb9c76146524f2e2b9e4a5841977c0ff84/ujs-safefile-0.1.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d0694e1b670a082b1e5a6b25d677ceee", "sha256": "d1c0fe68c0456bb5454d7df750121d8719f47c5e7871ccea755e11f6a414e0be" }, "downloads": -1, "filename": "ujs-safefile-0.1.0.zip", "has_sig": false, "md5_digest": "d0694e1b670a082b1e5a6b25d677ceee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11722, "upload_time": "2014-07-12T19:57:35", "url": "https://files.pythonhosted.org/packages/52/5f/f8c8a0d1db7a8af5fecdf2bcaeeb9c76146524f2e2b9e4a5841977c0ff84/ujs-safefile-0.1.0.zip" } ] }