您的位置:首页 > 编程语言 > PHP开发

[Erlang危机](1.4)OTP发布及习题

2014-11-06 19:59 309 查看
[b]原创文章,转载请注明出处:服务器非业余研究http://blog.csdn.net/erlib 作者Sunface[/b]

OTP Releases

OTP releases are not a lot harder to understand than most OTP applications you’ll encounter in the wild. A release is a set of OTP applications packaged in a production-ready manner so it boots and shuts down without needing to manually call application:start/2 for any app.
OTP release(发布)理解起来并不比其他OTP applications难多少。一个release就是使用生产方式打包的一组OTP applications,因此它的启动和关闭都不需要手动去调用application:start/2.

Of course there’s a bit more to releases than that, but generally, the same discovery process used for individual OTP applications will be applicable here. You’ll usually have a file similar to the configuration files used by systools or reltool, which will state all applications part of the release and a few 8 options regarding their packaging.
 当然,OTP release 还要做得更多一点,但通常来讲, OTP applications中的机制同样适用于release。 通常会有一个配置文件,供systools或reltool使用(记录所有applications关于release的部分和一些选项8)。

 

To understand them, I recommend reading existing documentation on them. If you’re lucky, the project may be using relx 9, an easier tool that was officially released in early 2014.
 如果想要理解它们,我推荐看看官方已有的文档。如果你幸运的话,项目可以使用relx,官方在2014年上半年推出的一个非常简单的工具。

 

[注8]:很多
[注9]:https://github.com/erlware/relx/wiki

Excerises

Review Questions

[1]. How do you know if a code base is an application? A release?
[2]. What differentiates an application from a library application?
[3]. What can be said of processes under a one_for_all scheme for supervision?
[4]. Why would someone use a gen_fsm behaviour over a gen_server?

[1]. 如何判断代码是一个application,还是release?
[2]. application和library application有什么区别?
[3]. 什么场景会使用one_for_all监控模式?
[4]. 什么场景应该使用gen_fsm替换gen_server?

 

Hands-On

Download the code at https://github.com/ferd/recon_demo. This will be used as a test bed for exercises throughout the book. Given you are not familiar with the code base yet, let’s see if you can use the tips and tricks mentioned in this chapter to get an understanding of it.
[1]. Is this application meant to be used as a library? A standalone system?
[2]. What does it do?
[3]. Does it have any dependencies? What are they?
[4]. The app’s README mentions being non-deterministic. Can you prove if this is true? How?
[5]. Can you express the dependency chain of applications in there? Generate a diagram of them?
[6]. Can you add more processes to the main application than those described in the README?

下载代码:https://github.com/ferd/recon_demo. 这个是本书练习的实践代码,现在给你的是不熟悉的代码,实践下本章中提到的知识吧!
[1]. 这个applicaiton是一个library?还是一个独立的系统(standalone system)?
[2]. 它是用来做什么的?
[3]. 他有依赖的application么?如果有,请列出来?
[4]. README中提到的不确定的点,请验证是不是真的?
[5]. 请描述一下applications的依赖关系链?生成一个图表?
[6]. 请增加更多的进程(在README中提到的)到主applicaiton里面。


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  erlang