Package flumotion :: Package component :: Package misc :: Package porter :: Module porter :: Class Porter
[hide private]

Class Porter

source code

             object --+        
                      |        
common.common.InitMixin --+    
                          |    
extern.log.log.Loggable --+    
                          |    
    component.BaseComponent --+
                              |
    extern.log.log.Loggable --+
                              |
                             Porter

The porter optionally sits in front of a set of streamer components. The porter is what actually deals with incoming connections on a TCP socket. It decides which streamer to direct the connection to, then passes the FD (along with some amount of already-read data) to the appropriate streamer.

Nested Classes [hide private]
child class of BaseComponentMedium componentMediumClass
the medium class to use for this component
Instance Methods [hide private]
 
init(self)
A subclass should do as little as possible in its init method.
source code
 
registerPath(self, path, avatar)
Register a path as being served by a streamer represented by this avatar.
source code
 
deregisterPath(self, path, avatar)
Attempt to deregister the given path.
source code
 
registerPrefix(self, prefix, avatar)
Register a destination for all requests directed to anything beginning with a specified prefix.
source code
 
deregisterPrefix(self, prefix, avatar)
Attempt to deregister a default destination for all requests not directed to a specifically-mapped path.
source code
 
findPrefixMatch(self, path) source code
 
findDestination(self, path)
Find a destination Avatar for this path.
source code
 
generateSocketPath(self)
Generate a socket pathname in an appropriate location
source code
 
generateRandomString(self, numchars)
Generate a random US-ASCII string of length numchars
source code
 
have_properties(self) source code
 
do_stop(self)
BaseComponent vmethod for stopping.
source code
 
do_setup(self)
Subclasses can implement me to set up the component before it is started.
source code

Inherited from component.BaseComponent: __init__, addMessage, adminCallRemote, check_properties, do_check, fixRenamedProperties, getMood, getName, getWorkerName, setMedium, setMood, setShutdownHook, setWorkerName, setup, setup_completed, stop, waitForHappy

Inherited from component.BaseComponent (private): _pollCPU, _pollMemory

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Inherited from extern.log.log.Loggable: __providedBy__, debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]

Inherited from component.BaseComponent: logCategory

Inherited from extern.log.log.Loggable: __implemented__, __provides__

Instance Variables [hide private]

Inherited from component.BaseComponent: medium, name, uiState

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

init(self)

source code 

A subclass should do as little as possible in its init method. In particular, it should not try to access resources.

Failures during init are marshalled back to the manager through the worker's remote_create method, since there is no component state proxied to the manager yet at the time of init.

Overrides: component.BaseComponent.init
(inherited documentation)

registerPath(self, path, avatar)

source code 

Register a path as being served by a streamer represented by this avatar. Will remove any previous registration at this path.

Parameters:
  • path (str) - The path to register
  • avatar (PorterAvatar) - The avatar representing the streamer to direct this path to

deregisterPath(self, path, avatar)

source code 

Attempt to deregister the given path. A deregistration will only be accepted if the mapping is to the avatar passed.

Parameters:
  • path (str) - The path to deregister
  • avatar (PorterAvatar) - The avatar representing the streamer being deregistered

registerPrefix(self, prefix, avatar)

source code 

Register a destination for all requests directed to anything beginning with a specified prefix. Where there are multiple matching prefixes, the longest is selected.

Parameters:

deregisterPrefix(self, prefix, avatar)

source code 

Attempt to deregister a default destination for all requests not directed to a specifically-mapped path. This will only succeed if the default is currently equal to this avatar.

Parameters:

findDestination(self, path)

source code 

Find a destination Avatar for this path.

Returns:
The Avatar for this mapping, or None.

do_stop(self)

source code 

BaseComponent vmethod for stopping. The component should do any cleanup it needs, but must not set the component's mood to sleeping.

Returns:
twisted.internet.defer.Deferred
Overrides: component.BaseComponent.do_stop
(inherited documentation)

do_setup(self)

source code 

Subclasses can implement me to set up the component before it is started. It should set up the component, possibly opening files and resources. Non-programming errors should not be raised, but returned as a failing deferred.

The return value may be a deferred.

Overrides: component.BaseComponent.do_setup
(inherited documentation)