comparison 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
comparison
equal deleted inserted replaced
118:7d83fe9bdb65 119:3e7a7426f518
5 msg = None 5 msg = None
6 6
7 class NodeNotFound(Error): 7 class NodeNotFound(Error):
8 pass 8 pass
9 9
10
11 class NodeExists(Error): 10 class NodeExists(Error):
12 pass 11 pass
13 12
13 class SubscriptionNotFound(Error):
14 pass
15
16 class SubscriptionExists(Error):
17 pass
14 18
15 class IStorage(Interface): 19 class IStorage(Interface):
16 """ Storage interface """ 20 """ Storage interface """
17 21
18 def get_node(self, node_id): 22 def get_node(self, node_id):
109 113
110 def set_configuration(self, options): 114 def set_configuration(self, options):
111 """ """ 115 """ """
112 116
113 def get_affiliation(self, entity): 117 def get_affiliation(self, entity):
114 """ """ 118 """ Get affiliation of entity with this node.
119
120 @param entity: JID of entity.
121 @type entity: L{jid.JID}
122 @return: deferred that returns C{'owner'}, C{'publisher'}, C{'outcast'}
123 or C{None}.
124 """
125
126 def get_subscription(self, subscriber):
127 """ Get subscription to this node of subscriber.
128
129 @param subscriber: JID of the new subscriptions' entity.
130 @type subscriber: L{jid.JID}
131 @return: deferred that returns the subscription state (C{'subscribed'},
132 C{'pending'} or C{None}).
133 """
115 134
116 def add_subscription(self, subscriber, state): 135 def add_subscription(self, subscriber, state):
117 """ """ 136 """ Add new subscription to this node with given state.
137
138 @param subscriber: JID of the new subscriptions' entity.
139 @type subscriber: L{jid.JID}
140 @param state: C{'subscribed'} or C{'pending'}
141 @type state: L{str}
142 @return: deferred that fires on subscription.
143 """
118 144
119 def remove_subscription(self, subscriber): 145 def remove_subscription(self, subscriber):
120 """ """ 146 """ Remove subscription to this node.
147
148 @param subscriber: JID of the subscriptions' entity.
149 @type subscriber: L{jid.JID}
150 @return: deferred that fires on removal.
151 """
121 152
122 def get_subscribers(self): 153 def get_subscribers(self):
123 """ """ 154 """ Get list of subscribers to this node.
155
156 Retrieves the list of entities that have a subscription to this
157 node. That is, having the state C{'subscribed'}.
158
159 @return: a deferred that returns a L{list} of L{jid.JID}s.
160 """
124 161
125 def is_subscribed(self, subscriber): 162 def is_subscribed(self, subscriber):
126 """ """ 163 """ Returns whether subscriber has a subscription to this node.
164
165 Only returns C{True} when the subscription state (if present) is
166 C{'subscribed'}.
127 167
168 @param subscriber: JID of the subscriptions' entity.
169 @type subscriber: L{jid.JID}
170 @return: deferred that returns a L{bool}.
171 """
128 172
129 class ILeafNode(Interface): 173 class ILeafNode(Interface):
130 """ """ 174 """ """
131 def store_items(self, items, publisher): 175 def store_items(self, items, publisher):
132 """ """ 176 """ """