Update documentation.
authorAntony Chazapis <chazapis@gmail.com>
Tue, 9 Aug 2011 12:05:10 +0000 (15:05 +0300)
committerAntony Chazapis <chazapis@gmail.com>
Tue, 9 Aug 2011 12:05:10 +0000 (15:05 +0300)
15 files changed:
README
docs/source/adminguide.rst
docs/source/backends.rst
docs/source/base_backend.rst [deleted file]
docs/source/client-lib.rst [deleted file]
docs/source/clientlib.rst [new file with mode: 0644]
docs/source/clients.rst [deleted file]
docs/source/index.rst
docs/source/simple_backend.rst [deleted file]
pithos/backends/base.py
pithos/backends/lib/hashfiler/__init__.py
pithos/backends/lib/hashfiler/blocker.py
pithos/backends/lib/hashfiler/mapper.py
pithos/backends/simple.py
tools/__init__.py [new file with mode: 0644]

diff --git a/README b/README
index 655bd24..8b127be 100644 (file)
--- a/README
+++ b/README
@@ -17,7 +17,9 @@ Then find the plain text version of the docs in docs/build/text.
 Running the server
 ------------------
 
-Enter the pithos dir and run:
+Enter the pithos dir, copy settings.py.dist to settings.py and change the SECRET_KEY inside.
+
+Then run:
     python manage.py syncdb
     python manage.py loaddata aai/fixtures/auth_test_data.json (to load sample users)
     python manage.py runserver
index 1e5b037..7140469 100644 (file)
@@ -16,7 +16,7 @@ Get the source::
   cd /
   git clone https://code.grnet.gr/git/pithos
 
-Setup the files (choose where to store data in ``settings.py``)::
+Setup the files (choose where to store data in ``settings.py`` and change ``SECRET_KEY``)::
 
   cd /pithos/pithos
   cp settings.py.dist settings.py
index ff3953d..b24fb32 100644 (file)
@@ -2,7 +2,57 @@ Backends
 ========
 
 .. toctree::
-   :maxdepth: 1
+   :maxdepth: 3
    
-   base_backend
-   simple_backend
+BaseBackend
+-----------
+
+.. autoclass:: pithos.backends.base.BaseBackend
+
+SimpleBackend
+-------------
+
+.. autoclass:: pithos.backends.simple.SimpleBackend
+   :show-inheritance:
+   :members:
+   :inherited-members:
+
+ModularBackend
+--------------
+
+.. autoclass:: pithos.backends.modular.ModularBackend
+   :show-inheritance:
+   :members:
+   :inherited-members:
+
+Node
+~~~~
+
+.. automodule:: pithos.backends.lib.node
+   :show-inheritance:
+   :members:
+   :undoc-members:
+
+Policy
+~~~~~~
+
+.. automodule:: pithos.backends.lib.policy
+   :show-inheritance:
+   :members:
+   :undoc-members:
+
+Permissions
+~~~~~~~~~~~
+
+.. automodule:: pithos.backends.lib.permissions
+   :show-inheritance:
+   :members:
+   :undoc-members:
+
+Hashfiler
+~~~~~~~~~
+
+.. automodule:: pithos.backends.lib.hashfiler
+   :show-inheritance:
+   :members:
+   :undoc-members:
diff --git a/docs/source/base_backend.rst b/docs/source/base_backend.rst
deleted file mode 100644 (file)
index 71fc0a7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-BaseBackend
-===========
-
-.. automodule:: pithos.backends.base
diff --git a/docs/source/client-lib.rst b/docs/source/client-lib.rst
deleted file mode 100644 (file)
index 812a74d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Client Library
-==============
-
-.. automodule:: pithos.lib.client
diff --git a/docs/source/clientlib.rst b/docs/source/clientlib.rst
new file mode 100644 (file)
index 0000000..c3bf16a
--- /dev/null
@@ -0,0 +1,7 @@
+Client Library
+==============
+
+.. automodule:: tools.lib.client
+   :show-inheritance:
+   :members:
+   :undoc-members:
diff --git a/docs/source/clients.rst b/docs/source/clients.rst
deleted file mode 100644 (file)
index 9f8eede..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-Clients
-========
-
-.. toctree::
-   :maxdepth: 1
-   
-   client-lib
\ No newline at end of file
index 6ac30fa..d114a5c 100644 (file)
@@ -4,12 +4,12 @@ Pithos Documentation
 Contents:
 
 .. toctree::
-   :maxdepth: 2
+   :maxdepth: 3
    
    devguide
    adminguide
    backends
-   clients
+   clientlib
 
 Indices and tables
 ==================
diff --git a/docs/source/simple_backend.rst b/docs/source/simple_backend.rst
deleted file mode 100644 (file)
index c882e47..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-SimpleBackend
-=============
-
-.. automodule:: pithos.backends.simple
index 48c705d..2ed3d05 100644 (file)
@@ -46,6 +46,7 @@ class BaseBackend(object):
     
     The following variables should be available:
         'hash_algorithm': Suggested is 'sha256'
+        
         'block_size': Suggested is 4MB
     """
     
@@ -54,6 +55,7 @@ class BaseBackend(object):
         
         Parameters:
             'marker': Start list from the next item after 'marker'
+            
             'limit': Number of containers to return
         """
         return []
@@ -63,9 +65,13 @@ class BaseBackend(object):
         
         The keys returned are all user-defined, except:
             'name': The account name
+            
             'count': The number of containers (or 0)
+            
             'bytes': The total data size (or 0)
+            
             'modified': Last modification timestamp (overall)
+            
             'until_timestamp': Last modification until the timestamp provided
         
         Raises:
@@ -78,6 +84,7 @@ class BaseBackend(object):
         
         Parameters:
             'meta': Dictionary with metadata to update
+            
             'replace': Replace instead of update
         
         Raises:
@@ -98,6 +105,7 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             ValueError: Invalid data in groups
         """
         return
@@ -115,6 +123,7 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             IndexError: Account is not empty
         """
         return
@@ -124,8 +133,11 @@ class BaseBackend(object):
         
         Parameters:
             'marker': Start list from the next item after 'marker'
+            
             'limit': Number of containers to return
+            
             'shared': Only list containers with permissions set
+            
         
         Raises:
             NotAllowedError: Operation not permitted
@@ -137,13 +149,18 @@ class BaseBackend(object):
         
         The keys returned are all user-defined, except:
             'name': The container name
+            
             'count': The number of objects
+            
             'bytes': The total data size
+            
             'modified': Last modification timestamp (overall)
+            
             'until_timestamp': Last modification until the timestamp provided
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
         """
         return {}
@@ -153,10 +170,12 @@ class BaseBackend(object):
         
         Parameters:
             'meta': Dictionary with metadata to update
+            
             'replace': Replace instead of update
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
         """
         return
@@ -166,10 +185,12 @@ class BaseBackend(object):
         
         The keys returned are:
             'quota': The maximum bytes allowed (default is 0 - unlimited)
+            
             'versioning': Can be 'auto', 'manual' or 'none' (default is 'manual')
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
         """
         return {}
@@ -179,7 +200,9 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
+            
             ValueError: Invalid policy defined
         """
         return
@@ -189,7 +212,9 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container already exists
+            
             ValueError: Invalid policy defined
         """
         return
@@ -199,7 +224,9 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
+            
             IndexError: Container is not empty
         """
         return
@@ -209,19 +236,26 @@ class BaseBackend(object):
         
         Parameters:
             'prefix': List objects starting with 'prefix'
+            
             'delimiter': Return unique names before 'delimiter' and after 'prefix'
+            
             'marker': Start list from the next item after 'marker'
+            
             'limit': Number of objects to return
-            'virtual': If not set, the result will only include names starting\
-                       with 'prefix' and ending without a 'delimiter' or with\
-                       the first occurance of the 'delimiter' after 'prefix'.\
-                       If set, the result will include all names after 'prefix',\
+            
+            'virtual': If not set, the result will only include names starting
+                       with 'prefix' and ending without a 'delimiter' or with
+                       the first occurance of the 'delimiter' after 'prefix'.
+                       If set, the result will include all names after 'prefix',
                        up to and including the 'delimiter' if it is found
+            
             'keys': Include objects that have meta with the keys in the list
+            
             'shared': Only list objects with permissions set
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
         """
         return []
@@ -231,6 +265,7 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
         """
         return []
@@ -240,15 +275,22 @@ class BaseBackend(object):
         
         The keys returned are all user-defined, except:
             'name': The object name
+            
             'bytes': The total data size
+            
             'modified': Last modification timestamp (overall)
+            
             'modified_by': The user that committed the object (version requested)
+            
             'version': The version identifier
+            
             'version_timestamp': The version's modification timestamp
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
+            
             IndexError: Version does not exist
         """
         return {}
@@ -258,24 +300,28 @@ class BaseBackend(object):
         
         Parameters:
             'meta': Dictionary with metadata to update
+            
             'replace': Replace instead of update
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
         """
         return
     
     def get_object_permissions(self, user, account, container, name):
-        """Return the path from which this object gets its permissions from,\
+        """Return the path from which this object gets its permissions from,
         along with a dictionary containing the permissions.
         
         The keys are:
             'read': The object is readable by the users/groups in the list
+            
             'write': The object is writable by the users/groups in the list
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
         """
         return {}
@@ -288,11 +334,14 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
+            
             ValueError: Invalid users/groups in permissions
-            AttributeError: Can not set permissions, as this object\
-                is already shared/private by another object higher\
-                in the hierarchy, or setting permissions here will\
+            
+            AttributeError: Can not set permissions, as this object
+                is already shared/private by another object higher
+                in the hierarchy, or setting permissions here will
                 invalidate other permissions deeper in the hierarchy
         """
         return
@@ -302,6 +351,7 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
         """
         return None
@@ -314,6 +364,7 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
         """
         return
@@ -323,7 +374,9 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
+            
             IndexError: Version does not exist
         """
         return 0, []
@@ -333,13 +386,18 @@ class BaseBackend(object):
         
         Parameters:
             'dest_meta': Dictionary with metadata to change
+            
             'replace_meta': Replace metadata instead of update
+            
             'permissions': Updated object permissions
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container does not exist
+            
             ValueError: Invalid users/groups in permissions
+            
             AttributeError: Can not set permissions
         """
         return
@@ -349,15 +407,22 @@ class BaseBackend(object):
         
         Parameters:
             'dest_meta': Dictionary with metadata to change from source to destination
+            
             'replace_meta': Replace metadata instead of update
+            
             'permissions': New object permissions
+            
             'src_version': Copy from the version provided
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
+            
             IndexError: Version does not exist
+            
             ValueError: Invalid users/groups in permissions
+            
             AttributeError: Can not set permissions
         """
         return
@@ -367,13 +432,18 @@ class BaseBackend(object):
         
         Parameters:
             'dest_meta': Dictionary with metadata to change from source to destination
+            
             'replace_meta': Replace metadata instead of update
+            
             'permissions': New object permissions
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
+            
             ValueError: Invalid users/groups in permissions
+            
             AttributeError: Can not set permissions
         """
         return
@@ -383,6 +453,7 @@ class BaseBackend(object):
         
         Raises:
             NotAllowedError: Operation not permitted
+            
             NameError: Container/object does not exist
         """
         return
index aa3b929..d3cae88 100644 (file)
@@ -34,3 +34,5 @@
 from blocker import Blocker
 from mapper import Mapper
 
+__all__ = ["Blocker", "Mapper"]
+
index 47293bc..59fd31f 100644 (file)
@@ -74,7 +74,7 @@ class Blocker(object):
         self.hashlen = len(emptyhash)
         self.emptyhash = emptyhash
 
-    def get_rear_block(self, blkhash, create=0):
+    def _get_rear_block(self, blkhash, create=0):
         filename = hexlify(blkhash)
         dir = join(self.blockpath, filename[0:2], filename[2:4], filename[4:6])
         if not exists(dir):
@@ -82,7 +82,7 @@ class Blocker(object):
         name = join(dir, filename)
         return ContextFile(name, create)
 
-    def check_rear_block(self, blkhash):
+    def _check_rear_block(self, blkhash):
         filename = hexlify(blkhash)
         dir = join(self.blockpath, filename[0:2], filename[2:4], filename[4:6])
         name = join(dir, filename)
@@ -101,7 +101,7 @@ class Blocker(object):
         missing = []
         append = missing.append
         for i, h in enumerate(hashes):
-            if not self.check_rear_block(h):
+            if not self._check_rear_block(h):
                 append(i)
         return missing
 
@@ -113,7 +113,7 @@ class Blocker(object):
         block = None
 
         for h in hashes:
-            with self.get_rear_block(h, 0) as rbl:
+            with self._get_rear_block(h, 0) as rbl:
                 if not rbl:
                     break
                 for block in rbl.sync_read_chunks(blocksize, 1, 0):
@@ -135,7 +135,7 @@ class Blocker(object):
         mf = None
         missing = self.block_ping(hashlist)
         for i in missing:
-            with self.get_rear_block(hashlist[i], 1) as rbl:
+            with self._get_rear_block(hashlist[i], 1) as rbl:
                  rbl.sync_write(blocklist[i]) #XXX: verify?
 
         return hashlist, missing
index 825bc9c..d9caaee 100644 (file)
@@ -57,11 +57,11 @@ class Mapper(object):
                 raise ValueError("Variable mappath '%s' is not a directory" % (mappath,))
         self.mappath = mappath
 
-    def get_rear_map(self, name, create=0):
+    def _get_rear_map(self, name, create=0):
         name = join(self.mappath, hex(int(name)))
         return ContextFile(name, create)
 
-    def delete_rear_map(self, name):
+    def _delete_rear_map(self, name):
         name = join(self.mappath, hex(int(name)))
         try:
             unlink(name)
@@ -79,7 +79,7 @@ class Mapper(object):
         namelen = self.namelen
         hashes = ()
 
-        with self.get_rear_map(name, 0) as rmap:
+        with self._get_rear_map(name, 0) as rmap:
             if rmap:
                 hashes = list(rmap.sync_read_chunks(namelen, nr, blkoff))
         return hashes
@@ -87,16 +87,16 @@ class Mapper(object):
     def map_stor(self, name, hashes=(), blkoff=0, create=1):
         """Store hashes in the given hashes map, replacing the old ones."""
         namelen = self.namelen
-        with self.get_rear_map(name, 1) as rmap:
+        with self._get_rear_map(name, 1) as rmap:
             rmap.sync_write_chunks(namelen, blkoff, hashes, None)
 
 #     def map_copy(self, src, dst):
 #         """Copy a hashes map to another one, replacing it."""
-#         with self.get_rear_map(src, 0) as rmap:
+#         with self._get_rear_map(src, 0) as rmap:
 #             if rmap:
 #                 rmap.copy_to(dst)
 
     def map_remv(self, name):
         """Remove a hashes map. Returns true if the map was found and removed."""
-        return self.delete_rear_map(name)
+        return self._delete_rear_map(name)
 
index ac470fd..0ca7d79 100644 (file)
@@ -609,7 +609,7 @@ class SimpleBackend(BaseBackend):
     
     @backend_method(autocommit=0)
     def put_block(self, data):
-        """Create a block and return the hash."""
+        """Store a block and return the hash."""
         
         logger.debug("put_block: %s", len(data))
         hashes, absent = self.blocker.block_stor((data,))
diff --git a/tools/__init__.py b/tools/__init__.py
new file mode 100644 (file)
index 0000000..e69de29