Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgilland committed May 28, 2015
1 parent 6195a95 commit 50364d1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
13 changes: 9 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ HashFS

HashFS is a content-addressable file management system. What does that mean? Simply, that HashFS manages a directory where files are saved based on the file's hash.

Typical use cases for this kind of system are ones where files are written once and never change (e.g. image storage), having no duplicate files is desirable (e.g. user uploads), and/or file metadata is stored elsewhere (e.g. in a database).
Typical use cases for this kind of system are ones where:

- Files are written once and never change (e.g. image storage).
- It's desirable to have no duplicate files (e.g. user uploads).
- File metadata is stored elsewhere (e.g. in a database).


Links
Expand Down Expand Up @@ -54,7 +58,7 @@ Designate a root folder for ``HashFS``. If the folder doesn't already exist, it
# temp_hashfs/ab/cd/ef/ghijklmnopqrstuvwxyz
**NOTE:** The ``algorithm`` should be a valid string argument for ``hashlib.new()``.
**NOTE:** The ``algorithm`` value should be a valid string argument to ``hashlib.new()``.


Storing Content
Expand Down Expand Up @@ -113,7 +117,8 @@ Delete a file by address ID or path.
.. code-block:: python
fs.delete(address.id)
fs.delete(address.path)
fs.delete(address.abspath)
fs.delete(address.relpath)
**NOTE:** When a file is deleted, any parent directories above the file will also be deleted if they are empty directories.
Expand All @@ -129,7 +134,7 @@ The ``HashFS`` files may not always be in sync with it's ``depth``, ``length``,
repaired = fs.repair()
# Or if you want to drop extensions...
# Or if you want to drop file extensions...
repaired = fs.repair(extensions=False)
Expand Down
9 changes: 5 additions & 4 deletions hashfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
Simply, that HashFS manages a directory where files are saved based on the
file's hash.
Typical use cases for this kind of system are ones where files are written once
and never change (e.g. image storage), having no duplicate files is desirable
(e.g. user uploads), and/or file metadata is stored elsewhere (e.g. in a
database).
Typical use cases for this kind of system are ones where:
- Files are written once and never change (e.g. image storage).
- It's desirable to have no duplicate files (e.g. user uploads).
- File metadata is stored elsewhere (e.g. in a database).
"""

from .__meta__ import (
Expand Down
7 changes: 5 additions & 2 deletions hashfs/hashfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self,
self.makepath(self.root)

def put(self, file, extension=None):
"""Store contents of `obj` on disk using its content hash for the
"""Store contents of `file` on disk using its content hash for the
address.
Args:
Expand Down Expand Up @@ -264,7 +264,10 @@ def repair(self, extensions=True):
return repaired

def corrupted(self, extensions=True):
"""Return generator that yields corrupted files."""
"""Return generator that yields corrupted files as ``(path, address)``
where ``path`` is the path of the corrupted file and ``address`` is
the :class:`HashAddress` of the expected location.
"""
for path in self.files():
stream = Stream(path)

Expand Down

0 comments on commit 50364d1

Please sign in to comment.