Code

minor edit
[roundup.git] / roundup / hyperdb.py
index 3f6429f82b510adb18f6af68bc30ecf5d17dc11d..d413ae4c7aec1720579970b498b2d89367538e34 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: hyperdb.py,v 1.75 2002-07-14 02:05:53 richard Exp $
+# $Id: hyperdb.py,v 1.80 2002-08-16 04:28:13 richard Exp $
 
 __doc__ = """
 Hyperdatabase implementation, especially field types.
@@ -110,6 +110,17 @@ class Multilink:
         ' more useful for dumps '
         return '<%s to "%s">'%(self.__class__, self.classname)
 
+class Boolean:
+    """An object designating a boolean property"""
+    def __repr__(self):
+        'more useful for dumps'
+        return '<%s>' % self.__class__
+    
+class Number:
+    """An object designating a numeric property"""
+    def __repr__(self):
+        'more useful for dumps'
+        return '<%s>' % self.__class__
 #
 # Support for splitting designators
 #
@@ -160,7 +171,6 @@ concrete backend Class.
     # flag to set on retired entries
     RETIRED_FLAG = '__hyperdb_retired'
 
-    # XXX deviates from spec: storagelocator is obtained from the config
     def __init__(self, config, journaltag=None):
         """Open a hyperdatabase given a specifier to some storage.
 
@@ -362,7 +372,6 @@ class Class:
         """
         raise NotImplementedError
 
-    # XXX not in spec
     def getnode(self, nodeid, cache=1):
         ''' Return a convenience wrapper for the node.
 
@@ -407,6 +416,29 @@ class Class:
         """
         raise NotImplementedError
 
+    def is_retired(self, nodeid):
+        '''Return true if the node is rerired
+        '''
+        raise NotImplementedError
+
+    def destroy(self, nodeid):
+        """Destroy a node.
+        
+        WARNING: this method should never be used except in extremely rare
+                 situations where there could never be links to the node being
+                 deleted
+        WARNING: use retire() instead
+        WARNING: the properties of this node will not be available ever again
+        WARNING: really, use retire() instead
+
+        Well, I think that's enough warnings. This method exists mostly to
+        support the session storage of the cgi interface.
+
+        The node is completely removed from the hyperdb, including all journal
+        entries. It will no longer be available, and will generally break code
+        if there are any references to the node.
+        """
+
     def history(self, nodeid):
         """Retrieve the journal of edits on a particular node.
 
@@ -463,14 +495,13 @@ class Class:
         """
         raise NotImplementedError
 
-    # XXX: change from spec - allows multiple props to match
     def find(self, **propspec):
         """Get the ids of nodes in this class which link to the given nodes.
 
         'propspec' consists of keyword args propname={nodeid:1,}   
-          'propname' must be the name of a property in this class, or a
-            KeyError is raised.  That property must be a Link or Multilink
-            property, or a TypeError is raised.
+        'propname' must be the name of a property in this class, or a
+        KeyError is raised.  That property must be a Link or Multilink
+        property, or a TypeError is raised.
 
         Any node in this class whose 'propname' property links to any of the
         nodeids will be returned. Used by the full text indexing, which knows
@@ -481,7 +512,6 @@ class Class:
         """
         raise NotImplementedError
 
-    # XXX not in spec
     def filter(self, search_matches, filterspec, sort, group, 
             num_re = re.compile('^\d+$')):
         ''' Return a list of the ids of the active nodes in this class that
@@ -522,7 +552,6 @@ class Class:
         '''
         raise NotImplementedError
 
-# XXX not in spec
 class Node:
     ''' A convenience wrapper for the given node
     '''
@@ -580,6 +609,23 @@ def Choice(name, db, *options):
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.79  2002/07/29 23:30:14  richard
+# documentation reorg post-new-security
+#
+# Revision 1.78  2002/07/21 03:26:37  richard
+# Gordon, does this help?
+#
+# Revision 1.77  2002/07/18 11:27:47  richard
+# ws
+#
+# Revision 1.76  2002/07/18 11:17:30  gmcm
+# Add Number and Boolean types to hyperdb.
+# Add conversion cases to web, mail & admin interfaces.
+# Add storage/serialization cases to back_anydbm & back_metakit.
+#
+# Revision 1.75  2002/07/14 02:05:53  richard
+# . all storage-specific code (ie. backend) is now implemented by the backends
+#
 # Revision 1.74  2002/07/10 00:24:10  richard
 # braino
 #