annotate idavoll/memory_backend.py @ 81:995ba223a43b

Implemented ComponentServiceToItemRetrievalService. Redone error() of Service a bit, now prints a brief traceback of unexpected exceptions and doens't reraise the exception.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 09 Nov 2004 14:53:50 +0000
parents 0e642e5b4fb2
children bbebadd71d35
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
1 from twisted.application import service
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
2 from twisted.internet import defer
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
3 from twisted.protocols.jabber import jid
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
4 import backend
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
5
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
6 class Subscription:
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
7 def __init__(self, state):
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
8 self.state = state
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
9
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
10 class NodeConfiguration:
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
11 def __init__(self):
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
12 self.persist_items = False
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
13 self.deliver_payloads = False
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
14
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
15 class Node:
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
16 def __init__(self, id):
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
17 self.id = id
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
18 self.configuration = NodeConfiguration()
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
19 self.subscriptions = {}
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
20 self.affiliations = {}
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
21 self.items = {}
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
22
43
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
23 class Storage:
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
24 def __init__(self):
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
25 self.nodes = {}
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
26
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
27 node = Node("ralphm/mood/ralphm@ik.nu")
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
28 node.subscriptions["ralphm@doe.ik.nu"] = Subscription("subscribed")
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
29 node.subscriptions["notify@ik.nu/mood_monitor"] = Subscription("subscribed")
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
30 node.affiliations["ralphm@ik.nu"] = "owner"
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
31 node.affiliations["ralphm@doe.ik.nu"] = "publisher"
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
32 node.configuration.persist_items = True
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
33 node.configuration.deliver_payloads = True
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
34 self.nodes[node.id] = node
43
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
35
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
36 def get_node_configuration(self, node_id):
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
37 try:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
38 node = self.nodes[node_id]
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
39 except KeyError:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
40 raise backend.NodeNotFound
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
41 else:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
42 c = self.nodes[node_id].configuration
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
43 return defer.succeed({'persist_items': c.persist_items,
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
44 'deliver_payloads': c.deliver_payloads})
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
45
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
46 def get_affiliation(self, node_id, entity):
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
47 try:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
48 node = self.nodes[node_id]
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
49 except KeyError:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
50 raise backend.NodeNotFound
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
51 else:
59
0fa161c00ed9 Use jid.JIDs everywhere in the backend.
Ralph Meijer <ralphm@ik.nu>
parents: 54
diff changeset
52 return defer.succeed(node.affiliations.get(entity.full(), None))
43
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
53
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
54 def get_subscribers(self, node_id):
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
55 try:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
56 node = self.nodes[node_id]
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
57 except KeyError:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
58 raise backend.NodeNotFound
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
59 else:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
60 subscriptions = self.nodes[node_id].subscriptions
59
0fa161c00ed9 Use jid.JIDs everywhere in the backend.
Ralph Meijer <ralphm@ik.nu>
parents: 54
diff changeset
61 subscribers = [jid.JID(s) for s in subscriptions
43
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
62 if subscriptions[s].state == 'subscribed']
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
63 return defer.succeed(subscribers)
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
64
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
65 def store_items(self, node_id, items, publisher):
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
66 for item in items:
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
67 self.nodes[node_id].items[item["id"]] = (item, publisher)
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
68 return defer.succeed(None)
9685b7e291ef Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 40
diff changeset
69
50
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
70 def add_subscription(self, node_id, subscriber, state):
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
71 try:
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
72 node = self.nodes[node_id]
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
73 except KeyError:
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
74 raise backend.NodeNotFound
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
75
50
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
76 try:
59
0fa161c00ed9 Use jid.JIDs everywhere in the backend.
Ralph Meijer <ralphm@ik.nu>
parents: 54
diff changeset
77 subscription = node.subscriptions[subscriber.full()]
50
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
78 except:
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
79 subscription = Subscription(state)
59
0fa161c00ed9 Use jid.JIDs everywhere in the backend.
Ralph Meijer <ralphm@ik.nu>
parents: 54
diff changeset
80 node.subscriptions[subscriber.full()] = subscription
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
81
50
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
82 return defer.succeed({'node': node_id,
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
83 'jid': subscriber,
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
84 'subscription': subscription.state})
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
85
50
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
86 def remove_subscription(self, node_id, subscriber):
37
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
87 try:
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
88 node = self.nodes[node_id]
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
89 except KeyError:
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
90 raise backend.NodeNotFound
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
91
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
92 try:
59
0fa161c00ed9 Use jid.JIDs everywhere in the backend.
Ralph Meijer <ralphm@ik.nu>
parents: 54
diff changeset
93 del node.subscriptions[subscriber.full()]
37
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
94 except KeyError:
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
95 raise backend.NotSubscribed
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
96
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
97 return defer.succeed(None)
9aa20efac203 Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents: 30
diff changeset
98
54
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
99 def create_node(self, node_id, owner):
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
100 if node_id in self.nodes:
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
101 raise backend.NodeExists
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
102
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
103 node = Node(node_id)
59
0fa161c00ed9 Use jid.JIDs everywhere in the backend.
Ralph Meijer <ralphm@ik.nu>
parents: 54
diff changeset
104 node.affiliations[owner.full()] = 'owner'
54
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
105 self.nodes[node_id] = node
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
106
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
107 return defer.succeed(None)
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
108
74
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
109 def get_affiliations(self, entity):
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
110 affiliations = []
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
111 for node in self.nodes.itervalues():
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
112 if entity.full() in node.affiliations:
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
113 affiliations.append((node.id,
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
114 node.affiliations[entity.full()]))
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
115
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
116 return defer.succeed(affiliations)
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
117
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
118 def get_subscriptions(self, entity):
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
119 subscriptions = []
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
120 for node in self.nodes.itervalues():
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
121 for subscriber, subscription in node.subscriptions.iteritems():
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
122 subscriber_jid = jid.JID(subscriber)
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
123 if subscriber_jid.userhostJID() == entity:
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
124 subscriptions.append((node.id, subscriber_jid,
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
125 subscription.state))
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
126 return defer.succeed(subscriptions)
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
127
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
128 def get_node_type(self, node_id):
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
129 if node_id not in self.nodes:
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
130 raise backend.NodeNotFound
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
131
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
132 return defer.succeed('leaf')
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
133
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
134 def get_nodes(self):
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
135 return defer.succeed(self.nodes.keys())
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
136
50
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
137 class BackendService(backend.BackendService):
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
138 pass
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
139
54
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
140 class NodeCreationService(backend.NodeCreationService):
62fdb37234e5 Make NodeCreationService a subclass of backend.NodeCreationService.
Ralph Meijer <ralphm@ik.nu>
parents: 50
diff changeset
141 pass
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
142
46
979e53b54267 Redefined several classes as subclasses of the implementations in backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 43
diff changeset
143 class PublishService(backend.PublishService):
979e53b54267 Redefined several classes as subclasses of the implementations in backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 43
diff changeset
144 pass
27
e6d62c93cd0a Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
145
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
146 class NotificationService(backend.NotificationService):
46
979e53b54267 Redefined several classes as subclasses of the implementations in backend.py.
Ralph Meijer <ralphm@ik.nu>
parents: 43
diff changeset
147 pass
30
ff7c73b253bf Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents: 27
diff changeset
148
50
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
149 class SubscriptionService(backend.SubscriptionService):
64f0986d8b35 Implement add_subscription() and remove_subscription() for Storage, remove
Ralph Meijer <ralphm@ik.nu>
parents: 46
diff changeset
150 pass
74
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
151
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
152 class AffiliationsService(backend.AffiliationsService):
0e642e5b4fb2 Add get_affiliations(), get_subscriptions(), get_node_type() and get_nodes()
Ralph Meijer <ralphm@ik.nu>
parents: 59
diff changeset
153 pass