| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python2.7/dist-packages/twisted/application/ |
Upload File : |
ó
†Nc @ s\ d Z d d l m Z m Z m Z d d l m Z d d l m Z d d l m
Z
d d l m Z d d l
m Z d e f d „ ƒ YZ d
e f d „ ƒ YZ d e f d
„ ƒ YZ d d d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d d d „ ƒ YZ d d d „ Z d d „ Z d d d d d d d d d g Z d S( sa
Service architecture for Twisted.
Services are arranged in a hierarchy. At the leafs of the hierarchy,
the services which actually interact with the outside world are started.
Services can be named or anonymous -- usually, they will be named if
there is need to access them through the hierarchy (from a parent or
a sibling).
Maintainer: Moshe Zadka
iÿÿÿÿ( t
implementst Interfacet Attribute( t namedAny( t
components( t defer( t sob( t IPlugint
IServiceMakerc B s; e Z d Z e d ƒ Z e d ƒ Z e d ƒ Z d „ Z RS( sê
An object which can be used to construct services in a flexible
way.
This interface should most often be implemented along with
L{twisted.plugin.IPlugin}, and will most often be used by the
'twistd' command.
s A short string naming this Twisted plugin, for example 'web' or 'pencil'. This name will be used as the subcommand of 'twistd'.sL A brief summary of the features provided by this Twisted application plugin.sc A C{twisted.python.usage.Options} subclass defining the configuration options for this application.c C s d S( s
Create and return an object providing
L{twisted.application.service.IService}.
@param options: A mapping (typically a C{dict} or
L{twisted.python.usage.Options} instance) of configuration
options to desired configuration values.
N( ( t options( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt makeService/ s ( t __name__t
__module__t __doc__R t tapnamet descriptionR R
( ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR s t ServiceMakerc B sT e Z d Z e e e ƒ d „ Z d „ Z e e ƒ Œ Z d „ Z e e ƒ Œ Z RS( sO
Utility class to simplify the definition of L{IServiceMaker} plugins.
c C s( | | _ | | _ | | _ | | _ d S( N( t namet moduleR R ( t selfR R R R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt __init__A s c C s d „ } | f S( Nc S s t | j ƒ j S( N( R R t Options( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt getI s ( ( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR H s c C s d „ } | f S( Nc S s t | j ƒ j S( N( R R R
( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR P s ( ( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR
O s (
R R R
R R R R R t propertyR
( ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR ; s
t IServicec B sD e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( s
A service.
Run start-up and shut-down code at the appropriate times.
@type name: C{string}
@ivar name: The name of the service (or None)
@type running: C{boolean}
@ivar running: Whether the service is running.
c C s d S( s“
Set the name of the service.
@type name: C{str}
@raise RuntimeError: Raised if the service already has a parent.
N( ( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt setNamec s c C s d S( sx
Set the parent of the service. This method is responsible for setting
the C{parent} attribute on this service (the child service).
@type parent: L{IServiceCollection}
@raise RuntimeError: Raised if the service already has a parent
or if the service has a name and the parent already has a child
by that name.
N( ( t parent( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt setServiceParentk s c C s d S( s×
Use this API to remove an L{IService} from an L{IServiceCollection}.
This method is used symmetrically with L{setServiceParent} in that it
sets the C{parent} attribute on the child.
@rtype: L{Deferred<defer.Deferred>}
@return: a L{Deferred<defer.Deferred>} which is triggered when the
service has finished shutting down. If shutting down is immediate,
a value can be returned (usually, C{None}).
N( ( ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt disownServiceParentv s c C s d S( s$
Start the service.
N( ( ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt startServiceƒ s c C s d S( s"
Stop the service.
@rtype: L{Deferred<defer.Deferred>}
@return: a L{Deferred<defer.Deferred>} which is triggered when the
service has finished shutting down. If shutting down is immediate,
a value can be returned (usually, C{None}).
N( ( ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt stopServiceˆ s c C s d S( s²
Do preparation work for starting the service.
Here things which should be done before changing directory,
root or shedding privileges are done.
N( ( ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt privilegedStartService’ s ( R R R
R R R R R R ( ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR W s
t Servicec B si e Z d Z e e ƒ d Z d Z d Z d „ Z d „ Z
d „ Z d „ Z d „ Z
d „ Z d „ Z RS(
sÝ
Base class for services.
Most services should inherit from this class. It handles the
book-keeping reponsibilities of starting and stopping, as well
as not serializing this book-keeping information.
i c C s, | j j ƒ } | j d ƒ r( | d =n | S( Nt running( t __dict__t copyt has_key( R t dict( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyt __getstate__ª s
c C s+ | j d k r t d ƒ ‚ n | | _ d S( Ns% cannot change name when parent exists( R t Nonet RuntimeErrorR ( R R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR ° s c C sH | j d k r | j ƒ n t | | ƒ } | | _ | j j | ƒ d S( N( R R' R t IServiceCollectiont
addService( R R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR µ s
c C s | j j | ƒ } d | _ | S( N( R t
removeServiceR' ( R t d( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR ¼ s c C s d S( N( ( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR Á s c C s
d | _ d S( Ni ( R! ( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR Ä s c C s
d | _ d S( Ni ( R! ( R ( ( s? /usr/lib/python2.7/dist-packages/twisted/application/service.pyR Ç s N( R R R
R R R! R' R R R&