# HG changeset patch # User Ralph Meijer # Date 1112977826 0 # Node ID 30c580286d279ac4f99c2548499907a5f6329577 # Parent 7043839982ba0199353ef10ece2344edef21a15d Add documentation. diff -r 7043839982ba -r 30c580286d27 idavoll/storage.py --- a/idavoll/storage.py Fri Apr 08 10:17:10 2005 +0000 +++ b/idavoll/storage.py Fri Apr 08 16:30:26 2005 +0000 @@ -1,4 +1,5 @@ from zope.interface import Interface +from twisted.words.protocols.jabber import jid class Error(Exception): msg = None @@ -12,25 +13,72 @@ class IStorage(Interface): - """ """ + """ Storage interface """ def get_node(self, node_id): - """ """ + """ Get Node. + + @param node_id: NodeID of the desired node. + @type node_id: L{str} + @return: deferred that returns a L{Node} object. + """ def get_node_ids(self): - """ """ + """ Return all NodeIDs. + + @return: deferred that returns a list of NodeIDs (L{str}). + """ def create_node(self, node_id, owner, config = None, type='leaf'): - """ """ + """ Create new node. + + The implementation should make sure, the passed owner JID is stripped + of the resource (e.g. using C{owner.userhostJID()}). + + @param node_id: NodeID of the new node. + @type node_id: L{str} + @param owner: JID of the new nodes's owner. + @type owner: L{jid.JID} + @param config: Configuration + @param type: Node type. Can be either C{'leaf'} or C{'collection'}. + @return: deferred that fires on creation. + """ def delete_node(self, node_id): - """ """ + """ Delete a node. + + @param node_id: NodeID of the new node. + @type node_id: L{str} + @return: deferred that fires on deletion. + """ def get_affiliations(self, entity): - """ """ + """ Get all affiliations for entity. + + The implementation should make sure, the passed owner JID is stripped + of the resource (e.g. using C{owner.userhostJID()}). + + @param entity: JID of the entity. + @type entity: L{jid.JID} + @return: deferred that returns a L{list} of tuples of the form + C{(node_id, affiliation)}, where C{node_id} is of the type + L{str} and C{affiliation} is one of C{'owner'}, C{'publisher'} + and C{'outcast'}. + """ def get_subscriptions(self, entity): - """ """ + """ Get all subscriptions for an entity. + + The implementation should make sure, the passed owner JID is stripped + of the resource (e.g. using C{owner.userhostJID()}). + + @param entity: JID of the entity. + @type entity: L{jid.JID} + @return: deferred that returns a L{list} of tuples of the form + C{(node_id, subscriber, state)}, where C{node_id} is of the + type L{str}, C{subscriber} of the type {jid.JID}, and + C{state} is C{'subscribed'} or C{'pending'}. + """ class INode(Interface):