Mercurial > libervia-pubsub
changeset 173:246911bcb699
Make node type part of node configuration.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Wed, 09 Apr 2008 11:43:16 +0000 |
parents | 9bfb00edd0cc |
children | 79d451d186b1 |
files | idavoll/iidavoll.py idavoll/memory_storage.py idavoll/pgsql_storage.py |
diffstat | 3 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/idavoll/iidavoll.py Tue Jan 15 14:00:07 2008 +0000 +++ b/idavoll/iidavoll.py Wed Apr 09 11:43:16 2008 +0000 @@ -139,6 +139,7 @@ """ Publish items to a pubsub node. @return: a deferred that fires when the items have been published. + @rtype: L{Deferred<twisted.internet.defer.Deferred>} """ def register_notifier(observerfn, *args, **kwargs): @@ -184,7 +185,7 @@ @return: deferred that returns a list of NodeIDs (L{str}). """ - def create_node(node_id, owner, config = None, type='leaf'): + def create_node(node_id, owner, config=None): """ Create new node. @@ -196,7 +197,6 @@ @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. """
--- a/idavoll/memory_storage.py Tue Jan 15 14:00:07 2008 +0000 +++ b/idavoll/memory_storage.py Wed Apr 09 11:43:16 2008 +0000 @@ -9,7 +9,8 @@ from idavoll import error, iidavoll default_config = {"pubsub#persist_items": True, - "pubsub#deliver_payloads": True} + "pubsub#deliver_payloads": True, + "pubsub#node_type": "leaf"} class Storage: @@ -29,14 +30,14 @@ def get_node_ids(self): return defer.succeed(self._nodes.keys()) - def create_node(self, node_id, owner, config = None, type='leaf'): + def create_node(self, node_id, owner, config=None): if node_id in self._nodes: return defer.fail(error.NodeExists()) if not config: config = copy.copy(default_config) - if type != 'leaf': + if config['pubsub#node_type'] != 'leaf': raise NotImplementedError node = LeafNode(node_id, owner, config)
--- a/idavoll/pgsql_storage.py Tue Jan 15 14:00:07 2008 +0000 +++ b/idavoll/pgsql_storage.py Wed Apr 09 11:43:16 2008 +0000 @@ -46,7 +46,7 @@ d.addCallback(lambda results: [r[0] for r in results]) return d - def create_node(self, node_id, owner, type='leaf'): + def create_node(self, node_id, owner, config=None): return self._dbpool.runInteraction(self._create_node, node_id, owner) def _create_node(self, cursor, node_id, owner):