Package cobra :: Module devent :: Class CobraEventCore
[hide private]
[frames] | no frames]

Class CobraEventCore

source code

Instance Methods [hide private]
 
__init__(self) source code
 
initEventChannel(self, qmax=0)
Create a new channel id and allocate an event Queue.
source code
 
finiEventChannel(self, chanid)
Close the specified event channel by adding a (None,None) event and removing the channel's Queue object.
source code
 
finiEventChannels(self)
Close down all event channels by adding a (None,None) event and removing the event Q from the datastructs.
source code
 
getNextEventForChan(self, chanid, timeout=None)
Get the next event for a previously initialized event channel.
source code
 
fireEvent(self, event, einfo)
Fire an even into the event distribution system.
source code
 
addEventCallback(self, callback, qmax=0, firethread=True)
Create a new event channel and fire a thread which listens for events and hands them off to the function "callback"
source code
 
setEventCast(self, mcast='224.56.56.56', port=45654, bind='0.0.0.0')
Tie this CobraEventCore to any others which share the same multicast ip and port.
source code
 
_runSocketListener(self) source code
Method Details [hide private]

getNextEventForChan(self, chanid, timeout=None)

source code 

Get the next event for a previously initialized event channel. If "timeout" is specified, the call will return None after the timeout interval. Each returned event is a tuple of ( eventname, eventinfo ).

When the channel returns (None, None) it has closed.

addEventCallback(self, callback, qmax=0, firethread=True)

source code 

Create a new event channel and fire a thread which
listens for events and hands them off to the function
"callback"

def mycallback(event, einfo):
    dostuff()

evt = CobraEventCore()
evt.addEventCallback( mycallback )

NOTE: This API is *not* cobra proxy call safe.

setEventCast(self, mcast='224.56.56.56', port=45654, bind='0.0.0.0')

source code 

Tie this CobraEventCore to any others which share the same multicast ip and port. This basically creates a ( udp "unreliable" ) "bus" on which events are serialized using json.