![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/twisted/application/__pycache__/ |
o �b�- � @ s d Z ddlmZmZmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZ G dd � d e�Zee e�G d d� d��ZG dd � d e�Zee�G dd� d��ZG dd� de�Zee�G dd� de��ZG dd� de�Zee�G dd� d��Zddd�Zddd�Zg d�ZdS ) aa 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 � )� Attribute� Interface�implementer)�defer)�sob)�IPlugin)� components)�namedAnyc @ s0 e Zd ZdZed�Zed�Zed�Zdd� ZdS )� IServiceMakerz� 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. zA short string naming this Twisted plugin, for example 'web' or 'pencil'. This name will be used as the subcommand of 'twistd'.zLA brief summary of the features provided by this Twisted application plugin.zcA C{twisted.python.usage.Options} subclass defining the configuration options for this application.c C � dS )a 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� )�optionsr r �=/usr/lib/python3/dist-packages/twisted/application/service.py�makeService4 � zIServiceMaker.makeServiceN) �__name__� __module__�__qualname__�__doc__r �tapname�descriptionr r r r r r r s ���r c @ s0 e Zd ZdZdd� Zedd� �Zedd� �ZdS ) �ServiceMakerzO Utility class to simplify the definition of L{IServiceMaker} plugins. c C s || _ || _|| _|| _d S �N)�name�moduler r )�selfr r r r r r r �__init__E s zServiceMaker.__init__c C � t | j�jS r )r r �Options�r r r r r K � zServiceMaker.optionsc C r r )r r r r r r r r O r zServiceMaker.makeServiceN)r r r r r �propertyr r r r r r r ? s r c @ sX e Zd ZdZed�Zed�Zed�Zdd� Zdd� Z d d � Z dd� Zd d� Zdd� Z dS )�IServicezS A service. Run start-up and shut-down code at the appropriate times. z5A C{str} which is the name of the service or C{None}.z<A C{boolean} which indicates whether the service is running.z8An C{IServiceCollection} which is the parent or C{None}.c C r )z� Set the name of the service. @type name: C{str} @raise RuntimeError: Raised if the service already has a parent. Nr �r r r r �setNamea r zIService.setNamec C r )ax 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. Nr )�parentr r r �setServiceParenti r zIService.setServiceParentc C r )a� 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, L{None}). Nr r r r r �disownServiceParentt r zIService.disownServiceParentc C r )z$ Start the service. Nr r r r r �startService� r zIService.startServicec C r )a" 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, L{None}). Nr r r r r �stopService� r zIService.stopServicec C r )z� Do preparation work for starting the service. Here things which should be done before changing directory, root or shedding privileges are done. Nr r r r r �privilegedStartService� r zIService.privilegedStartServiceN)r r r r r r �runningr% r$ r&