Package ClusterShell :: Package Engine :: Module Engine :: Class Engine
[hide private]
[frames] | no frames]

Class Engine

source code


Base class for ClusterShell Engines.

Subclasses have to implement a runloop listening for client events. Subclasses that override other than "pure virtual methods" should call corresponding base class methods.

Instance Methods [hide private]
 
__init__(self, info)
Initialize base class.
source code
 
release(self)
Release engine-specific resources.
source code
 
clients(self)
Get a copy of clients set.
source code
 
ports(self)
Get a copy of ports set.
source code
 
_fd2client(self, fd) source code
 
_can_register(self, client) source code
 
_update_reg_stats(self, client, offset) source code
 
add(self, client)
Add a client to engine.
source code
 
_remove(self, client, abort, did_timeout=False)
Remove a client from engine (subroutine).
source code
 
remove(self, client, abort=False, did_timeout=False)
Remove a client from engine.
source code
 
remove_stream(self, client, stream)
Regular way to remove a client stream from engine, performing needed read flush as needed.
source code
 
clear(self, did_timeout=False, clear_ports=False)
Remove all clients.
source code
 
register(self, client)
Register an engine client.
source code
 
unregister_stream(self, client, stream)
Unregister a stream from a client.
source code
 
unregister(self, client)
Unregister a client
source code
 
modify(self, client, sname, setmask, clearmask)
Modify the next loop interest events bitset for a client stream.
source code
 
_register_specific(self, fd, event)
Engine-specific register fd for event method.
source code
 
_unregister_specific(self, fd, ev_is_set)
Engine-specific unregister fd method.
source code
 
_modify_specific(self, fd, event, setvalue)
Engine-specific modify fd for event method.
source code
 
set_events(self, client, stream)
Set the active interest events bitset for a client stream.
source code
 
set_reading(self, client, sname)
Set client reading state.
source code
 
set_writing(self, client, sname)
Set client writing state.
source code
 
add_timer(self, timer)
Add a timer instance to engine.
source code
 
remove_timer(self, timer)
Remove engine timer from engine.
source code
 
fire_timers(self)
Fire expired timers for processing.
source code
 
start_ports(self)
Start and register all port clients.
source code
 
start_clients(self)
Start and register regular engine clients in respect of fanout.
source code
 
run(self, timeout)
Run engine in calling thread.
source code
 
snoop_ports(self)
Peek in ports for possible early pending messages.
source code
 
runloop(self, timeout)
Engine specific run loop.
source code
 
abort(self, kill)
Abort runloop.
source code
 
exited(self)
Returns True if the engine has exited the runloop once.
source code
 
_debug(self, s)
library engine verbose debugging hook
source code
 
start_all(self)
Start and register all other possible clients, in respect of task fanout.
Class Variables [hide private]
  identifier = '(none)'
Method Details [hide private]

remove(self, client, abort=False, did_timeout=False)

source code 

Remove a client from engine. Does NOT aim to flush individual stream read buffers.

remove_stream(self, client, stream)

source code 

Regular way to remove a client stream from engine, performing needed read flush as needed. If no more retainable stream remains for this client, this method automatically removes the entire client from engine.

This function does nothing if the stream is not registered.

clear(self, did_timeout=False, clear_ports=False)

source code 

Remove all clients. Does not flush read buffers. Subclasses that override this method should call base class method.

register(self, client)

source code 

Register an engine client. Subclasses that override this method should call base class method.

snoop_ports(self)

source code 

Peek in ports for possible early pending messages. This method simply tries to read port pipes in non-blocking mode.

runloop(self, timeout)

source code 

Engine specific run loop. Derived classes must implement.