Size: 308
Comment:
|
Size: 3064
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
-- 令狐虫 [DateTime] | -- 令狐虫 |
Line 9: | Line 9: |
= 工具使用(Using the utilities) = == 基础 == 1. 应用(Application) 1. 序列化(Serialization) 1. mktap和tapconvert(mktap and tapconvert) 1. twistd 1. tap2deb 1. tap2rpm |
= 工具的使用(Using the utilities) = == Application == Twisted程序通常和twisted.application.service.Application协作。这个类通常管理着一个运行中的服务器的所有持久化配置信息 —— 哪些端口需要绑定、哪些连接必须被保持或者被尝试、哪些动作需要周期性的去做,以及几乎所有的一切。它是服务树中的根对象,实现了IService接口。 Twisted programs usually work with twisted.application.service.Application. This class usually holds all persistent configuration of a running server -- ports to bind to, places where connections to must be kept or attempted, periodic actions to do and almost everything else. It is the root object in a tree of services implementing IService. 其他的HOWTO们描述了如何为一个应用编写客户代码,但是本节描述的是如何使用已经写好的代码(这些代码可能是Twisted的一部分,或者来自一个第三方的Twisted插件开发者)。Twisted的发布中包含了用户建立和维护应用所需的各种各样的工具。 Other HOWTOs describe how to write custom code for Applications, but this one describes how to use already written code (which can be part of Twisted or from a third-party Twisted plugin developer). The Twisted distribution comes with an assortment of tools to create and manipulate Applications. 应用只是一个Python对象,可以像其他对象一样被建立和维护。特别的一点是,他们可以被序列化到文件中。Twisted支持几种序列化格式。 Applications are just Python objects, which can be created and manipulated in the same ways as any other object. In particular, they can be serialized to files. Twisted supports several serialization formats. == 序列化(Serialization) == === TAP === Twisted Application Pickle。这种格式由本地的Python pickle包提供支持。这种格式虽然人类看不懂,但是存取是最快的。 A Twisted Application Pickle. This format is supported by the native Python pickle support. While not being human readable, this format is the fastest to load and save. === TAX === Twisted 包含 twisted.persisted.marmalade, 支持对遵循XML标准的一种格式进行序列化和解序列化的模块。这种格式是人类可读可编辑的。 Twisted contains twisted.persisted.marmalade, a module that supports serializing and deserializing from a format which follows the XML standard. This format is human readable and editable. === TAS === Twisted 包含 twisted.persisted.aot,一个支持序列化为Python代码的模块。它的好处在于使用了Python自身的语法分析器,并且以后可以手工将这段代码加入到文件中去。 Twisted contains twisted.persisted.aot, a module that supports serializing into Python source. This has the advantage of using Python's own parser and being able to later manually add Python code to the file. |
高阶Twisted (High-Level Twisted) -- 令狐虫
工具的使用(Using the utilities)
Application
Twisted程序通常和twisted.application.service.Application协作。这个类通常管理着一个运行中的服务器的所有持久化配置信息 —— 哪些端口需要绑定、哪些连接必须被保持或者被尝试、哪些动作需要周期性的去做,以及几乎所有的一切。它是服务树中的根对象,实现了IService接口。
Twisted programs usually work with twisted.application.service.Application. This class usually holds all persistent configuration of a running server -- ports to bind to, places where connections to must be kept or attempted, periodic actions to do and almost everything else. It is the root object in a tree of services implementing IService.
其他的HOWTO们描述了如何为一个应用编写客户代码,但是本节描述的是如何使用已经写好的代码(这些代码可能是Twisted的一部分,或者来自一个第三方的Twisted插件开发者)。Twisted的发布中包含了用户建立和维护应用所需的各种各样的工具。
Other HOWTOs describe how to write custom code for Applications, but this one describes how to use already written code (which can be part of Twisted or from a third-party Twisted plugin developer). The Twisted distribution comes with an assortment of tools to create and manipulate Applications.
应用只是一个Python对象,可以像其他对象一样被建立和维护。特别的一点是,他们可以被序列化到文件中。Twisted支持几种序列化格式。
Applications are just Python objects, which can be created and manipulated in the same ways as any other object. In particular, they can be serialized to files. Twisted supports several serialization formats.
序列化(Serialization)
TAP
Twisted Application Pickle。这种格式由本地的Python pickle包提供支持。这种格式虽然人类看不懂,但是存取是最快的。
A Twisted Application Pickle. This format is supported by the native Python pickle support. While not being human readable, this format is the fastest to load and save.
TAX
Twisted 包含 twisted.persisted.marmalade, 支持对遵循XML标准的一种格式进行序列化和解序列化的模块。这种格式是人类可读可编辑的。
Twisted contains twisted.persisted.marmalade, a module that supports serializing and deserializing from a format which follows the XML standard. This format is human readable and editable.
TAS
Twisted 包含 twisted.persisted.aot,一个支持序列化为Python代码的模块。它的好处在于使用了Python自身的语法分析器,并且以后可以手工将这段代码加入到文件中去。
Twisted contains twisted.persisted.aot, a module that supports serializing into Python source. This has the advantage of using Python's own parser and being able to later manually add Python code to the file.