comparison idavoll/iidavoll.py @ 204:b4bf0a5ce50d

Implement storage facilities for the HTTP gateway. Author: ralphm. Fixes #12. One of the storage facilities is PostgreSQL based, providing persistence.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 16 Jul 2008 06:38:32 +0000
parents e404775b12df
children 274a45d2a5ab
comparison
equal deleted inserted replaced
203:2c46e6664680 204:b4bf0a5ce50d
464 """ 464 """
465 Purge node of all items in persistent storage. 465 Purge node of all items in persistent storage.
466 466
467 @return: deferred that fires when the node has been purged. 467 @return: deferred that fires when the node has been purged.
468 """ 468 """
469
470
471
472 class IGatewayStorage(Interface):
473
474 def addCallback(service, nodeIdentifier, callback):
475 """
476 Register a callback URI.
477
478 The registered HTTP callback URI will have an Atom Entry documented
479 POSTed to it upon receiving a notification for the given pubsub node.
480
481 @param service: The XMPP entity that holds the node.
482 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>}
483 @param nodeIdentifier: The identifier of the publish-subscribe node.
484 @type nodeIdentifier: C{unicode}.
485 @param callback: The callback URI to be registered.
486 @type callback: C{str}.
487 @rtype: L{Deferred<twisted.internet.defer.Deferred>}
488 """
489
490 def removeCallback(service, nodeIdentifier, callback):
491 """
492 Remove a registered callback URI.
493
494 The returned deferred will fire with a boolean that signals wether or
495 not this was the last callback unregistered for this node.
496
497 @param service: The XMPP entity that holds the node.
498 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>}
499 @param nodeIdentifier: The identifier of the publish-subscribe node.
500 @type nodeIdentifier: C{unicode}.
501 @param callback: The callback URI to be unregistered.
502 @type callback: C{str}.
503 @rtype: L{Deferred<twisted.internet.defer.Deferred>}
504 """
505
506 def getCallbacks(service, nodeIdentifier):
507 """
508 Get the callbacks registered for this node.
509
510 Returns a deferred that fires with the set of HTTP callback URIs
511 registered for this node.
512
513 @param service: The XMPP entity that holds the node.
514 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>}
515 @param nodeIdentifier: The identifier of the publish-subscribe node.
516 @type nodeIdentifier: C{unicode}.
517 @rtype: L{Deferred<twisted.internet.defer.Deferred>}
518 """
519
520
521 def hasCallbacks(service, nodeIdentifier):
522 """
523 Return wether there are callbacks registered for a node.
524
525 @param service: The XMPP entity that holds the node.
526 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>}
527 @param nodeIdentifier: The identifier of the publish-subscribe node.
528 @type nodeIdentifier: C{unicode}.
529 @returns: Deferred that fires with a boolean.
530 @rtype: L{Deferred<twisted.internet.defer.Deferred>}
531 """