annotate idavoll/storage.py @ 119:3e7a7426f518

Added SubscriptionNotFound and SubscriptionExists errors. Added documentation to INode.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 12 Apr 2005 12:16:54 +0000
parents 06bab3d2490d
children 0d7b95fb2549
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
1 from zope.interface import Interface
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
2 from twisted.words.protocols.jabber import jid
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
3
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
4 class Error(Exception):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
5 msg = None
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
6
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
7 class NodeNotFound(Error):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
8 pass
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
9
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
10 class NodeExists(Error):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
11 pass
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
12
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
13 class SubscriptionNotFound(Error):
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
14 pass
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
15
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
16 class SubscriptionExists(Error):
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
17 pass
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
18
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
19 class IStorage(Interface):
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
20 """ Storage interface """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
21
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
22 def get_node(self, node_id):
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
23 """ Get Node.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
24
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
25 @param node_id: NodeID of the desired node.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
26 @type node_id: L{str}
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
27 @return: deferred that returns a L{Node} object.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
28 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
29
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
30 def get_node_ids(self):
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
31 """ Return all NodeIDs.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
32
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
33 @return: deferred that returns a list of NodeIDs (L{str}).
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
34 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
35
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
36 def create_node(self, node_id, owner, config = None, type='leaf'):
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
37 """ Create new node.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
38
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
39 The implementation should make sure, the passed owner JID is stripped
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
40 of the resource (e.g. using C{owner.userhostJID()}).
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
41
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
42 @param node_id: NodeID of the new node.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
43 @type node_id: L{str}
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
44 @param owner: JID of the new nodes's owner.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
45 @type owner: L{jid.JID}
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
46 @param config: Configuration
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
47 @param type: Node type. Can be either C{'leaf'} or C{'collection'}.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
48 @return: deferred that fires on creation.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
49 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
50
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
51 def delete_node(self, node_id):
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
52 """ Delete a node.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
53
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
54 @param node_id: NodeID of the new node.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
55 @type node_id: L{str}
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
56 @return: deferred that fires on deletion.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
57 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
58
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
59 def get_affiliations(self, entity):
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
60 """ Get all affiliations for entity.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
61
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
62 The implementation should make sure, the passed owner JID is stripped
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
63 of the resource (e.g. using C{owner.userhostJID()}).
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
64
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
65 @param entity: JID of the entity.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
66 @type entity: L{jid.JID}
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
67 @return: deferred that returns a L{list} of tuples of the form
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
68 C{(node_id, affiliation)}, where C{node_id} is of the type
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
69 L{str} and C{affiliation} is one of C{'owner'}, C{'publisher'}
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
70 and C{'outcast'}.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
71 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
72
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
73 def get_subscriptions(self, entity):
111
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
74 """ Get all subscriptions for an entity.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
75
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
76 The implementation should make sure, the passed owner JID is stripped
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
77 of the resource (e.g. using C{owner.userhostJID()}).
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
78
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
79 @param entity: JID of the entity.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
80 @type entity: L{jid.JID}
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
81 @return: deferred that returns a L{list} of tuples of the form
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
82 C{(node_id, subscriber, state)}, where C{node_id} is of the
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
83 type L{str}, C{subscriber} of the type {jid.JID}, and
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
84 C{state} is C{'subscribed'} or C{'pending'}.
30c580286d27 Add documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 107
diff changeset
85 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
86
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
87
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
88 class INode(Interface):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
89 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
90 def get_type(self):
116
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
91 """ Get node's type.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
92
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
93 @return: C{'leaf'} or C{'collection'}.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
94 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
95
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
96 def get_configuration(self):
116
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
97 """ Get node's configuration.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
98
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
99 The configuration must at least have two options:
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
100 C{pubsub#persist_items}, and C{pubsub#deliver_payloads}.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
101
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
102 @return: L{dict} of configuration options.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
103 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
104
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
105 def get_meta_data(self):
116
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
106 """ Get node's meta data.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
107
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
108 The meta data must be a superset of the configuration options, and
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
109 also at least should have a C{pubsub#node_type} entry.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
110
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
111 @return: L{dict} of meta data.
06bab3d2490d Added more documentation.
Ralph Meijer <ralphm@ik.nu>
parents: 111
diff changeset
112 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
113
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
114 def set_configuration(self, options):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
115 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
116
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
117 def get_affiliation(self, entity):
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
118 """ Get affiliation of entity with this node.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
120 @param entity: JID of entity.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
121 @type entity: L{jid.JID}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
122 @return: deferred that returns C{'owner'}, C{'publisher'}, C{'outcast'}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
123 or C{None}.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
124 """
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
125
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
126 def get_subscription(self, subscriber):
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
127 """ Get subscription to this node of subscriber.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
128
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
129 @param subscriber: JID of the new subscriptions' entity.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
130 @type subscriber: L{jid.JID}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
131 @return: deferred that returns the subscription state (C{'subscribed'},
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
132 C{'pending'} or C{None}).
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
133 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
134
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
135 def add_subscription(self, subscriber, state):
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
136 """ Add new subscription to this node with given state.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
137
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
138 @param subscriber: JID of the new subscriptions' entity.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
139 @type subscriber: L{jid.JID}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
140 @param state: C{'subscribed'} or C{'pending'}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
141 @type state: L{str}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
142 @return: deferred that fires on subscription.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
143 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
144
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
145 def remove_subscription(self, subscriber):
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
146 """ Remove subscription to this node.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
147
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
148 @param subscriber: JID of the subscriptions' entity.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
149 @type subscriber: L{jid.JID}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
150 @return: deferred that fires on removal.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
151 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
152
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
153 def get_subscribers(self):
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
154 """ Get list of subscribers to this node.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
155
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
156 Retrieves the list of entities that have a subscription to this
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
157 node. That is, having the state C{'subscribed'}.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
158
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
159 @return: a deferred that returns a L{list} of L{jid.JID}s.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
160 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
161
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
162 def is_subscribed(self, subscriber):
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
163 """ Returns whether subscriber has a subscription to this node.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
164
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
165 Only returns C{True} when the subscription state (if present) is
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
166 C{'subscribed'}.
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
167
119
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
168 @param subscriber: JID of the subscriptions' entity.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
169 @type subscriber: L{jid.JID}
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
170 @return: deferred that returns a L{bool}.
3e7a7426f518 Added SubscriptionNotFound and SubscriptionExists errors.
Ralph Meijer <ralphm@ik.nu>
parents: 116
diff changeset
171 """
107
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
172
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
173 class ILeafNode(Interface):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
174 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
175 def store_items(self, items, publisher):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
176 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
177
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
178 def remove_items(self, item_ids):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
179 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
180
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
181 def get_items(self, max_items=None):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
182 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
183
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
184 def get_items_by_id(self, item_ids):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
185 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
186
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
187 def purge(self):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
188 """ """
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
189
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
190
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
191 class ISubscription(Interface):
d252d793f0ed Initial revision.
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
192 """ """