annotate idavoll/backend.py @ 24:4f3bbefc6fad

Moved memory backend to its own file. Cleaned up exceptions, naming.
author Ralph Meijer <ralphm@ik.nu>
date Sun, 17 Oct 2004 13:51:34 +0000
parents 884268687229
children d4fc29bb5381
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
1 from twisted.python import components
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
2
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
3 class IService(components.Interface):
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
4 """ Interface to a backend service of a pubsub service """
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
5
2
9701df89c534 First take at notifications
Ralph Meijer <ralphm@ik.nu>
parents: 1
diff changeset
6 def do_publish(self, node, publisher, item):
9701df89c534 First take at notifications
Ralph Meijer <ralphm@ik.nu>
parents: 1
diff changeset
7 """ Returns a deferred that returns """
9701df89c534 First take at notifications
Ralph Meijer <ralphm@ik.nu>
parents: 1
diff changeset
8
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
9 class Error(Exception):
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
10 msg = ''
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
11
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
12 def __str__(self):
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
13 return self.msg
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
14
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
15 class NodeNotFound(Error):
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
16 msg = 'Node not found'
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
17
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
18 class NotAuthorized(Error):
20
eddea65d1032 Added two exceptions: NoInstantNodes and NodeExists.
Ralph Meijer <ralphm@ik.nu>
parents: 18
diff changeset
19 pass
eddea65d1032 Added two exceptions: NoInstantNodes and NodeExists.
Ralph Meijer <ralphm@ik.nu>
parents: 18
diff changeset
20
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
21 class PayloadExpected(Error):
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
22 msg = 'Payload expected'
15
46cd13c68ac0 Redone memory storage of nodes.
Ralph Meijer <ralphm@ik.nu>
parents: 5
diff changeset
23
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
24 class NoPayloadAllowed(Error):
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
25 msg = 'No payload allowed'
2
9701df89c534 First take at notifications
Ralph Meijer <ralphm@ik.nu>
parents: 1
diff changeset
26
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
27 class NoInstantNodes(Error):
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
28 pass
23
884268687229 Simplify call chain by mapping incoming requests directly to method
Ralph Meijer <ralphm@ik.nu>
parents: 20
diff changeset
29
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
30 class NodeExists(Error):
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
31 pass