Mercurial > libervia-pubsub
comparison idavoll/iidavoll.py @ 198:e404775b12df
Change naming and spacing conventions to match Twisted's.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Tue, 10 Jun 2008 11:31:49 +0000 |
parents | c61034369463 |
children | b4bf0a5ce50d |
comparison
equal
deleted
inserted
replaced
197:9da5a95d408d | 198:e404775b12df |
---|---|
3 | 3 |
4 """ | 4 """ |
5 Interfaces for idavoll. | 5 Interfaces for idavoll. |
6 """ | 6 """ |
7 | 7 |
8 from zope.interface import Interface | 8 from zope.interface import Attribute, Interface |
9 | 9 |
10 class IBackendService(Interface): | 10 class IBackendService(Interface): |
11 """ Interface to a backend service of a pubsub service. """ | 11 """ Interface to a backend service of a pubsub service. """ |
12 | 12 |
13 | |
13 def __init__(storage): | 14 def __init__(storage): |
14 """ | 15 """ |
15 @param storage: L{storage} object. | 16 @param storage: L{storage} object. |
16 """ | 17 """ |
17 | 18 |
18 def supports_publisher_affiliation(): | 19 |
20 def supportsPublisherAffiliation(): | |
19 """ Reports if the backend supports the publisher affiliation. | 21 """ Reports if the backend supports the publisher affiliation. |
20 | 22 |
21 @rtype: C{bool} | 23 @rtype: C{bool} |
22 """ | 24 """ |
23 | 25 |
24 def supports_outcast_affiliation(): | 26 |
27 def supportsOutcastAffiliation(): | |
25 """ Reports if the backend supports the publisher affiliation. | 28 """ Reports if the backend supports the publisher affiliation. |
26 | 29 |
27 @rtype: C{bool} | 30 @rtype: C{bool} |
28 """ | 31 """ |
29 | 32 |
30 def supports_persistent_items(): | 33 |
34 def supportsPersistentItems(): | |
31 """ Reports if the backend supports persistent items. | 35 """ Reports if the backend supports persistent items. |
32 | 36 |
33 @rtype: C{bool} | 37 @rtype: C{bool} |
34 """ | 38 """ |
35 | 39 |
36 def get_node_type(node_id): | 40 |
41 def getNodeType(nodeIdentifier): | |
37 """ Return type of a node. | 42 """ Return type of a node. |
38 | 43 |
39 @return: a deferred that returns either 'leaf' or 'collection' | 44 @return: a deferred that returns either 'leaf' or 'collection' |
40 """ | 45 """ |
41 | 46 |
42 def get_nodes(): | 47 |
48 def getNodes(): | |
43 """ Returns list of all nodes. | 49 """ Returns list of all nodes. |
44 | 50 |
45 @return: a deferred that returns a C{list} of node ids. | 51 @return: a deferred that returns a C{list} of node ids. |
46 """ | 52 """ |
47 | 53 |
48 def get_node_meta_data(node_id): | 54 |
55 def getNodeMetaData(nodeIdentifier): | |
49 """ Return meta data for a node. | 56 """ Return meta data for a node. |
50 | 57 |
51 @return: a deferred that returns a C{list} of C{dict}s with the | 58 @return: a deferred that returns a C{list} of C{dict}s with the |
52 metadata. | 59 metadata. |
53 """ | 60 """ |
54 | 61 |
55 def create_node(node_id, requestor): | 62 |
63 def createNode(nodeIdentifier, requestor): | |
56 """ Create a node. | 64 """ Create a node. |
57 | 65 |
58 @return: a deferred that fires when the node has been created. | 66 @return: a deferred that fires when the node has been created. |
59 """ | 67 """ |
60 | 68 |
61 def register_pre_delete(pre_delete_fn): | 69 |
70 def registerPreDelete(preDeleteFn): | |
62 """ Register a callback that is called just before a node deletion. | 71 """ Register a callback that is called just before a node deletion. |
63 | 72 |
64 The function C{pre_deleted_fn} is added to a list of functions | 73 The function C{preDeletedFn} is added to a list of functions to be |
65 to be called just before deletion of a node. The callback | 74 called just before deletion of a node. The callback C{preDeleteFn} is |
66 C{pre_delete_fn} is called with the C{node_id} that is about to be | 75 called with the C{nodeIdentifier} that is about to be deleted and |
67 deleted and should return a deferred that returns a list of deferreds | 76 should return a deferred that returns a list of deferreds that are to |
68 that are to be fired after deletion. The backend collects the lists | 77 be fired after deletion. The backend collects the lists from all these |
69 from all these callbacks before actually deleting the node in question. | 78 callbacks before actually deleting the node in question. After |
70 After deletion all collected deferreds are fired to do post-processing. | 79 deletion all collected deferreds are fired to do post-processing. |
71 | 80 |
72 The idea is that you want to be able to collect data from the | 81 The idea is that you want to be able to collect data from the node |
73 node before deleting it, for example to get a list of subscribers | 82 before deleting it, for example to get a list of subscribers that have |
74 that have to be notified after the node has been deleted. To do this, | 83 to be notified after the node has been deleted. To do this, |
75 C{pre_delete_fn} fetches the subscriber list and passes this | 84 C{preDeleteFn} fetches the subscriber list and passes this list to a |
76 list to a callback attached to a deferred that it sets up. This | 85 callback attached to a deferred that it sets up. This deferred is |
77 deferred is returned in the list of deferreds. | 86 returned in the list of deferreds. |
78 """ | 87 """ |
79 | 88 |
80 def delete_node(node_id, requestor): | 89 |
90 def deleteNode(nodeIdentifier, requestor): | |
81 """ Delete a node. | 91 """ Delete a node. |
82 | 92 |
83 @return: a deferred that fires when the node has been deleted. | 93 @return: a deferred that fires when the node has been deleted. |
84 """ | 94 """ |
85 | 95 |
86 def purge_node(node_id, requestor): | 96 |
97 def purgeNode(nodeIdentifier, requestor): | |
87 """ Removes all items in node from persistent storage """ | 98 """ Removes all items in node from persistent storage """ |
88 | 99 |
89 def subscribe(node_id, subscriber, requestor): | 100 |
101 def subscribe(nodeIdentifier, subscriber, requestor): | |
90 """ Request the subscription of an entity to a pubsub node. | 102 """ Request the subscription of an entity to a pubsub node. |
91 | 103 |
92 Depending on the node's configuration and possible business rules, the | 104 Depending on the node's configuration and possible business rules, the |
93 C{subscriber} is added to the list of subscriptions of the node with id | 105 C{subscriber} is added to the list of subscriptions of the node with id |
94 C{node_id}. The C{subscriber} might be different from the C{requestor}, | 106 C{nodeIdentifier}. The C{subscriber} might be different from the |
95 and if the C{requestor} is not allowed to subscribe this entity an | 107 C{requestor}, and if the C{requestor} is not allowed to subscribe this |
108 entity an exception should be raised. | |
109 | |
110 @return: a deferred that returns the subscription state | |
111 """ | |
112 | |
113 | |
114 def unsubscribe(nodeIdentifier, subscriber, requestor): | |
115 """ Cancel the subscription of an entity to a pubsub node. | |
116 | |
117 The subscription of C{subscriber} is removed from the list of | |
118 subscriptions of the node with id C{nodeIdentifier}. If the | |
119 C{requestor} is not allowed to unsubscribe C{subscriber}, an an | |
96 exception should be raised. | 120 exception should be raised. |
97 | 121 |
98 @return: a deferred that returns the subscription state | |
99 """ | |
100 | |
101 def unsubscribe(node_id, subscriber, requestor): | |
102 """ Cancel the subscription of an entity to a pubsub node. | |
103 | |
104 The subscription of C{subscriber} is removed from the list of | |
105 subscriptions of the node with id C{node_id}. If the C{requestor} | |
106 is not allowed to unsubscribe C{subscriber}, an an exception should | |
107 be raised. | |
108 | |
109 @return: a deferred that fires when unsubscription is complete. | 122 @return: a deferred that fires when unsubscription is complete. |
110 """ | 123 """ |
111 | 124 |
112 def get_subscribers(node_id): | 125 |
126 def getSubscribers(nodeIdentifier): | |
113 """ Get node subscriber list. | 127 """ Get node subscriber list. |
114 | 128 |
115 @return: a deferred that fires with the list of subscribers. | 129 @return: a deferred that fires with the list of subscribers. |
116 """ | 130 """ |
117 | 131 |
118 def get_subscriptions(entity): | 132 |
133 def getSubscriptions(entity): | |
119 """ Report the list of current subscriptions with this pubsub service. | 134 """ Report the list of current subscriptions with this pubsub service. |
120 | 135 |
121 Report the list of the current subscriptions with all nodes within this | 136 Report the list of the current subscriptions with all nodes within this |
122 pubsub service, for the C{entity}. | 137 pubsub service, for the C{entity}. |
123 | 138 |
124 @return: a deferred that returns the list of all current subscriptions | 139 @return: a deferred that returns the list of all current subscriptions |
125 as tuples C{(node_id, subscriber, subscription)}. | 140 as tuples C{(nodeIdentifier, subscriber, subscription)}. |
126 """ | 141 """ |
127 | 142 |
128 def get_affiliations(entity): | 143 |
144 def getAffiliations(entity): | |
129 """ Report the list of current affiliations with this pubsub service. | 145 """ Report the list of current affiliations with this pubsub service. |
130 | 146 |
131 Report the list of the current affiliations with all nodes within this | 147 Report the list of the current affiliations with all nodes within this |
132 pubsub service, for the C{entity}. | 148 pubsub service, for the C{entity}. |
133 | 149 |
134 @return: a deferred that returns the list of all current affiliations | 150 @return: a deferred that returns the list of all current affiliations |
135 as tuples C{(node_id, affiliation)}. | 151 as tuples C{(nodeIdentifier, affiliation)}. |
136 """ | 152 """ |
137 | 153 |
138 def publish(node_id, items, requestor): | 154 |
155 def publish(nodeIdentifier, items, requestor): | |
139 """ Publish items to a pubsub node. | 156 """ Publish items to a pubsub node. |
140 | 157 |
141 @return: a deferred that fires when the items have been published. | 158 @return: a deferred that fires when the items have been published. |
142 @rtype: L{Deferred<twisted.internet.defer.Deferred>} | 159 @rtype: L{Deferred<twisted.internet.defer.Deferred>} |
143 """ | 160 """ |
144 | 161 |
145 def register_notifier(observerfn, *args, **kwargs): | 162 |
163 def registerNotifier(observerfn, *args, **kwargs): | |
146 """ Register callback which is called for notification. """ | 164 """ Register callback which is called for notification. """ |
147 | 165 |
148 def get_notification_list(node_id, items): | 166 |
167 def getNotificationList(nodeIdentifier, items): | |
149 """ | 168 """ |
150 Get list of entities to notify. | 169 Get list of entities to notify. |
151 """ | 170 """ |
152 | 171 |
153 def get_items(node_id, requestor, max_items=None, item_ids=[]): | 172 |
173 def getItems(nodeIdentifier, requestor, maxItems=None, itemIdentifiers=[]): | |
154 """ Retrieve items from persistent storage | 174 """ Retrieve items from persistent storage |
155 | 175 |
156 If C{max_items} is given, return the C{max_items} last published | 176 If C{maxItems} is given, return the C{maxItems} last published |
157 items, else if C{item_ids} is not empty, return the items requested. | 177 items, else if C{itemIdentifiers} is not empty, return the items |
158 If neither is given, return all items. | 178 requested. If neither is given, return all items. |
159 | 179 |
160 @return: a deferred that returns the requested items | 180 @return: a deferred that returns the requested items |
161 """ | 181 """ |
162 | 182 |
163 def retract_item(node_id, item_id, requestor): | 183 |
184 def retractItem(nodeIdentifier, itemIdentifier, requestor): | |
164 """ Removes item in node from persistent storage """ | 185 """ Removes item in node from persistent storage """ |
165 | 186 |
166 | 187 |
188 | |
167 class IStorage(Interface): | 189 class IStorage(Interface): |
168 """ | 190 """ |
169 Storage interface. | 191 Storage interface. |
170 """ | 192 """ |
171 | 193 |
172 def get_node(node_id): | 194 |
195 def getNode(nodeIdentifier): | |
173 """ | 196 """ |
174 Get Node. | 197 Get Node. |
175 | 198 |
176 @param node_id: NodeID of the desired node. | 199 @param nodeIdentifier: NodeID of the desired node. |
177 @type node_id: L{str} | 200 @type nodeIdentifier: L{str} |
178 @return: deferred that returns a L{Node} object. | 201 @return: deferred that returns a L{Node} object. |
179 """ | 202 """ |
180 | 203 |
181 def get_node_ids(): | 204 |
205 def getNodeIds(): | |
182 """ | 206 """ |
183 Return all NodeIDs. | 207 Return all NodeIDs. |
184 | 208 |
185 @return: deferred that returns a list of NodeIDs (L{str}). | 209 @return: deferred that returns a list of NodeIDs (L{str}). |
186 """ | 210 """ |
187 | 211 |
188 def create_node(node_id, owner, config=None): | 212 |
213 def createNode(nodeIdentifier, owner, config=None): | |
189 """ | 214 """ |
190 Create new node. | 215 Create new node. |
191 | 216 |
192 The implementation should make sure, the passed owner JID is stripped | 217 The implementation should make sure, the passed owner JID is stripped |
193 of the resource (e.g. using C{owner.userhostJID()}). | 218 of the resource (e.g. using C{owner.userhostJID()}). |
194 | 219 |
195 @param node_id: NodeID of the new node. | 220 @param nodeIdentifier: NodeID of the new node. |
196 @type node_id: L{str} | 221 @type nodeIdentifier: L{str} |
197 @param owner: JID of the new nodes's owner. | 222 @param owner: JID of the new nodes's owner. |
198 @type owner: L{jid.JID} | 223 @type owner: L{jid.JID} |
199 @param config: Configuration | 224 @param config: Configuration |
200 @return: deferred that fires on creation. | 225 @return: deferred that fires on creation. |
201 """ | 226 """ |
202 | 227 |
203 def delete_node(node_id): | 228 |
229 def deleteNode(nodeIdentifier): | |
204 """ | 230 """ |
205 Delete a node. | 231 Delete a node. |
206 | 232 |
207 @param node_id: NodeID of the new node. | 233 @param nodeIdentifier: NodeID of the new node. |
208 @type node_id: L{str} | 234 @type nodeIdentifier: L{str} |
209 @return: deferred that fires on deletion. | 235 @return: deferred that fires on deletion. |
210 """ | 236 """ |
211 | 237 |
212 def get_affiliations(entity): | 238 |
239 def getAffiliations(entity): | |
213 """ | 240 """ |
214 Get all affiliations for entity. | 241 Get all affiliations for entity. |
215 | 242 |
216 The implementation should make sure, the passed owner JID is stripped | 243 The implementation should make sure, the passed owner JID is stripped |
217 of the resource (e.g. using C{owner.userhostJID()}). | 244 of the resource (e.g. using C{owner.userhostJID()}). |
218 | 245 |
219 @param entity: JID of the entity. | 246 @param entity: JID of the entity. |
220 @type entity: L{jid.JID} | 247 @type entity: L{jid.JID} |
221 @return: deferred that returns a L{list} of tuples of the form | 248 @return: deferred that returns a L{list} of tuples of the form |
222 C{(node_id, affiliation)}, where C{node_id} is of the type | 249 C{(nodeIdentifier, affiliation)}, where C{nodeIdentifier} is |
223 L{str} and C{affiliation} is one of C{'owner'}, C{'publisher'} | 250 of the type L{str} and C{affiliation} is one of C{'owner'}, |
224 and C{'outcast'}. | 251 C{'publisher'} and C{'outcast'}. |
225 """ | 252 """ |
226 | 253 |
227 def get_subscriptions(entity): | 254 |
255 def getSubscriptions(entity): | |
228 """ | 256 """ |
229 Get all subscriptions for an entity. | 257 Get all subscriptions for an entity. |
230 | 258 |
231 The implementation should make sure, the passed owner JID is stripped | 259 The implementation should make sure, the passed owner JID is stripped |
232 of the resource (e.g. using C{owner.userhostJID()}). | 260 of the resource (e.g. using C{owner.userhostJID()}). |
233 | 261 |
234 @param entity: JID of the entity. | 262 @param entity: JID of the entity. |
235 @type entity: L{jid.JID} | 263 @type entity: L{jid.JID} |
236 @return: deferred that returns a L{list} of tuples of the form | 264 @return: deferred that returns a L{list} of tuples of the form |
237 C{(node_id, subscriber, state)}, where C{node_id} is of the | 265 C{(nodeIdentifier, subscriber, state)}, where |
238 type L{str}, C{subscriber} of the type {jid.JID}, and | 266 C{nodeIdentifier} is of the type L{str}, C{subscriber} of the |
239 C{state} is C{'subscribed'} or C{'pending'}. | 267 type {jid.JID}, and C{state} is C{'subscribed'} or |
240 """ | 268 C{'pending'}. |
269 """ | |
270 | |
241 | 271 |
242 | 272 |
243 class INode(Interface): | 273 class INode(Interface): |
244 """ | 274 """ |
245 Interface to the class of objects that represent nodes. | 275 Interface to the class of objects that represent nodes. |
246 """ | 276 """ |
247 | 277 |
248 def get_type(): | 278 nodeType = Attribute("""The type of this node. One of {'leaf'}, |
279 {'collection'}.""") | |
280 nodeIdentifier = Attribute("""The node identifer of this node""") | |
281 | |
282 | |
283 def getType(): | |
249 """ | 284 """ |
250 Get node's type. | 285 Get node's type. |
251 | 286 |
252 @return: C{'leaf'} or C{'collection'}. | 287 @return: C{'leaf'} or C{'collection'}. |
253 """ | 288 """ |
254 | 289 |
255 def get_configuration(): | 290 |
291 def getConfiguration(): | |
256 """ | 292 """ |
257 Get node's configuration. | 293 Get node's configuration. |
258 | 294 |
259 The configuration must at least have two options: | 295 The configuration must at least have two options: |
260 C{pubsub#persist_items}, and C{pubsub#deliver_payloads}. | 296 C{pubsub#persist_items}, and C{pubsub#deliver_payloads}. |
261 | 297 |
262 @return: L{dict} of configuration options. | 298 @return: L{dict} of configuration options. |
263 """ | 299 """ |
264 | 300 |
265 def get_meta_data(): | 301 |
302 def getMetaData(): | |
266 """ | 303 """ |
267 Get node's meta data. | 304 Get node's meta data. |
268 | 305 |
269 The meta data must be a superset of the configuration options, and | 306 The meta data must be a superset of the configuration options, and |
270 also at least should have a C{pubsub#node_type} entry. | 307 also at least should have a C{pubsub#node_type} entry. |
271 | 308 |
272 @return: L{dict} of meta data. | 309 @return: L{dict} of meta data. |
273 """ | 310 """ |
274 | 311 |
275 def set_configuration(options): | 312 |
313 def setConfiguration(options): | |
276 """ | 314 """ |
277 Set node's configuration. | 315 Set node's configuration. |
278 | 316 |
279 The elements of {options} will set the new values for those | 317 The elements of {options} will set the new values for those |
280 configuration items. This means that only changing items have to | 318 configuration items. This means that only changing items have to |
282 | 320 |
283 @param options: a dictionary of configuration options. | 321 @param options: a dictionary of configuration options. |
284 @returns: a deferred that fires upon success. | 322 @returns: a deferred that fires upon success. |
285 """ | 323 """ |
286 | 324 |
287 def get_affiliation(entity): | 325 |
326 def getAffiliation(entity): | |
288 """ | 327 """ |
289 Get affiliation of entity with this node. | 328 Get affiliation of entity with this node. |
290 | 329 |
291 @param entity: JID of entity. | 330 @param entity: JID of entity. |
292 @type entity: L{jid.JID} | 331 @type entity: L{jid.JID} |
293 @return: deferred that returns C{'owner'}, C{'publisher'}, C{'outcast'} | 332 @return: deferred that returns C{'owner'}, C{'publisher'}, C{'outcast'} |
294 or C{None}. | 333 or C{None}. |
295 """ | 334 """ |
296 | 335 |
297 def get_subscription(subscriber): | 336 |
337 def getSubscription(subscriber): | |
298 """ | 338 """ |
299 Get subscription to this node of subscriber. | 339 Get subscription to this node of subscriber. |
300 | 340 |
301 @param subscriber: JID of the new subscriptions' entity. | 341 @param subscriber: JID of the new subscriptions' entity. |
302 @type subscriber: L{jid.JID} | 342 @type subscriber: L{jid.JID} |
303 @return: deferred that returns the subscription state (C{'subscribed'}, | 343 @return: deferred that returns the subscription state (C{'subscribed'}, |
304 C{'pending'} or C{None}). | 344 C{'pending'} or C{None}). |
305 """ | 345 """ |
306 | 346 |
307 def add_subscription(subscriber, state): | 347 |
348 def addSubscription(subscriber, state): | |
308 """ | 349 """ |
309 Add new subscription to this node with given state. | 350 Add new subscription to this node with given state. |
310 | 351 |
311 @param subscriber: JID of the new subscriptions' entity. | 352 @param subscriber: JID of the new subscriptions' entity. |
312 @type subscriber: L{jid.JID} | 353 @type subscriber: L{jid.JID} |
313 @param state: C{'subscribed'} or C{'pending'} | 354 @param state: C{'subscribed'} or C{'pending'} |
314 @type state: L{str} | 355 @type state: L{str} |
315 @return: deferred that fires on subscription. | 356 @return: deferred that fires on subscription. |
316 """ | 357 """ |
317 | 358 |
318 def remove_subscription(subscriber): | 359 |
360 def removeSubscription(subscriber): | |
319 """ | 361 """ |
320 Remove subscription to this node. | 362 Remove subscription to this node. |
321 | 363 |
322 @param subscriber: JID of the subscriptions' entity. | 364 @param subscriber: JID of the subscriptions' entity. |
323 @type subscriber: L{jid.JID} | 365 @type subscriber: L{jid.JID} |
324 @return: deferred that fires on removal. | 366 @return: deferred that fires on removal. |
325 """ | 367 """ |
326 | 368 |
327 def get_subscribers(): | 369 |
370 def getSubscribers(): | |
328 """ | 371 """ |
329 Get list of subscribers to this node. | 372 Get list of subscribers to this node. |
330 | 373 |
331 Retrieves the list of entities that have a subscription to this | 374 Retrieves the list of entities that have a subscription to this |
332 node. That is, having the state C{'subscribed'}. | 375 node. That is, having the state C{'subscribed'}. |
333 | 376 |
334 @return: a deferred that returns a L{list} of L{jid.JID}s. | 377 @return: a deferred that returns a L{list} of L{jid.JID}s. |
335 """ | 378 """ |
336 | 379 |
337 def is_subscribed(entity): | 380 |
381 def isSubscribed(entity): | |
338 """ | 382 """ |
339 Returns whether entity has any subscription to this node. | 383 Returns whether entity has any subscription to this node. |
340 | 384 |
341 Only returns C{True} when the subscription state (if present) is | 385 Only returns C{True} when the subscription state (if present) is |
342 C{'subscribed'} for any subscription that matches the bare JID. | 386 C{'subscribed'} for any subscription that matches the bare JID. |
344 @param subscriber: bare JID of the subscriptions' entity. | 388 @param subscriber: bare JID of the subscriptions' entity. |
345 @type subscriber: L{jid.JID} | 389 @type subscriber: L{jid.JID} |
346 @return: deferred that returns a L{bool}. | 390 @return: deferred that returns a L{bool}. |
347 """ | 391 """ |
348 | 392 |
349 def get_affiliations(): | 393 |
394 def getAffiliations(): | |
350 """ | 395 """ |
351 Get affiliations of entities with this node. | 396 Get affiliations of entities with this node. |
352 | 397 |
353 @return: deferred that returns a L{list} of tuples (jid, affiliation), | 398 @return: deferred that returns a L{list} of tuples (jid, affiliation), |
354 where jid is a L(jid.JID) and affiliation is one of C{'owner'}, | 399 where jid is a L(jid.JID) and affiliation is one of C{'owner'}, |
355 C{'publisher'}, C{'outcast'}. | 400 C{'publisher'}, C{'outcast'}. |
356 """ | 401 """ |
357 | 402 |
403 | |
404 | |
358 class ILeafNode(Interface): | 405 class ILeafNode(Interface): |
359 """ | 406 """ |
360 Interface to the class of objects that represent leaf nodes. | 407 Interface to the class of objects that represent leaf nodes. |
361 """ | 408 """ |
362 | 409 |
363 def store_items(items, publisher): | 410 def storeItems(items, publisher): |
364 """ | 411 """ |
365 Store items in persistent storage for later retrieval. | 412 Store items in persistent storage for later retrieval. |
366 | 413 |
367 @param items: The list of items to be stored. Each item is the | 414 @param items: The list of items to be stored. Each item is the |
368 L{domish} representation of the XML fragment as defined | 415 L{domish} representation of the XML fragment as defined |
372 @param publisher: JID of the publishing entity. | 419 @param publisher: JID of the publishing entity. |
373 @type publisher: L{jid.JID} | 420 @type publisher: L{jid.JID} |
374 @return: deferred that fires upon success. | 421 @return: deferred that fires upon success. |
375 """ | 422 """ |
376 | 423 |
377 def remove_items(item_ids): | 424 |
425 def removeItems(itemIdentifiers): | |
378 """ | 426 """ |
379 Remove items by id. | 427 Remove items by id. |
380 | 428 |
381 @param item_ids: L{list} of item ids. | 429 @param itemIdentifiers: L{list} of item ids. |
382 @return: deferred that fires with a L{list} of ids of the items that | 430 @return: deferred that fires with a L{list} of ids of the items that |
383 were deleted | 431 were deleted |
384 """ | 432 """ |
385 | 433 |
386 def get_items(max_items=None): | 434 |
435 def getItems(maxItems=None): | |
387 """ | 436 """ |
388 Get items. | 437 Get items. |
389 | 438 |
390 If C{max_items} is not given, all items in the node are returned, | 439 If C{maxItems} is not given, all items in the node are returned, |
391 just like C{get_items_by_id}. Otherwise, C{max_items} limits | 440 just like C{getItemsById}. Otherwise, C{maxItems} limits |
392 the returned items to a maximum of that number of most recently | 441 the returned items to a maximum of that number of most recently |
393 published items. | 442 published items. |
394 | 443 |
395 @param max_items: if given, a natural number (>0) that limits the | 444 @param maxItems: if given, a natural number (>0) that limits the |
396 returned number of items. | 445 returned number of items. |
397 @return: deferred that fires with a L{list} of found items. | 446 @return: deferred that fires with a L{list} of found items. |
398 """ | 447 """ |
399 | 448 |
400 def get_items_by_id(item_ids): | 449 |
450 def getItemsById(itemIdentifiers): | |
401 """ | 451 """ |
402 Get items by item id. | 452 Get items by item id. |
403 | 453 |
404 Each item in the returned list is a unicode string that | 454 Each item in the returned list is a unicode string that |
405 represent the XML of the item as it was published, including the | 455 represent the XML of the item as it was published, including the |
406 item wrapper with item id. | 456 item wrapper with item id. |
407 | 457 |
408 @param item_ids: L{list} of item ids. | 458 @param itemIdentifiers: L{list} of item ids. |
409 @return: deferred that fires with a L{list} of found items. | 459 @return: deferred that fires with a L{list} of found items. |
410 """ | 460 """ |
411 | 461 |
462 | |
412 def purge(): | 463 def purge(): |
413 """ | 464 """ |
414 Purge node of all items in persistent storage. | 465 Purge node of all items in persistent storage. |
415 | 466 |
416 @return: deferred that fires when the node has been purged. | 467 @return: deferred that fires when the node has been purged. |