- 浏览: 335232 次
- 性别:
- 来自: 北京
文章分类
最新评论
博客编辑器又失灵了。。只好在回复里搞。
DRB实现具体细节:
额,,原来drb是通过method_missing来调用远程方法的。。
评论
8 楼
Hooopo
2009-08-26
7 楼
Hooopo
2009-08-26
类似Google构架的开源项目Hadoop近获社区关注
http://www.infoq.com/cn/news/2007/08/hadoop-momentum
http://www.infoq.com/cn/news/2007/08/hadoop-momentum
6 楼
Hooopo
2009-08-26
infoq的BackgrounDrb介绍:
http://www.infoq.com/cn/articles/BackgrounDRb
http://www.infoq.com/cn/articles/BackgrounDRb
5 楼
Hooopo
2009-08-26
DRB实现具体细节:
# == dRuby internals # # dRuby is implemented using three main components: a remote method # call marshaller/unmarshaller; a transport protocol; and an # ID-to-object mapper. The latter two can be directly, and the first # indirectly, replaced, in order to provide different behaviour and # capabilities. # # Marshalling and unmarshalling of remote method calls is performed by # a DRb::DRbMessage instance. This uses the Marshal module to dump # the method call before sending it over the transport layer, then # reconstitute it at the other end. There is normally no need to # replace this component, and no direct way is provided to do so. # However, it is possible to implement an alternative marshalling # scheme as part of an implementation of the transport layer. # # The transport layer is responsible for opening client and server # network connections and forwarding dRuby request across them. # Normally, it uses DRb::DRbMessage internally to manage marshalling # and unmarshalling. The transport layer is managed by # DRb::DRbProtocol. Multiple protocols can be installed in # DRbProtocol at the one time; selection between them is determined by # the scheme of a dRuby URI. The default transport protocol is # selected by the scheme 'druby:', and implemented by # DRb::DRbTCPSocket. This uses plain TCP/IP sockets for # communication. An alternative protocol, using UNIX domain sockets, # is implemented by DRb::DRbUNIXSocket in the file drb/unix.rb, and # selected by the scheme 'drbunix:'. A sample implementation over # HTTP can be found in the samples accompanying the main dRuby # distribution. # # The ID-to-object mapping component maps dRuby object ids to the # objects they refer to, and vice versa. The implementation to use # can be specified as part of a DRb::DRbServer's configuration. The # default implementation is provided by DRb::DRbIdConv. It uses an # object's ObjectSpace id as its dRuby id. This means that the dRuby # reference to that object only remains meaningful for the lifetime of # the object's process and the lifetime of the object within that # process. A modified implementation is provided by DRb::TimerIdConv # in the file drb/timeridconv.rb. This implementation retains a local # reference to all objects exported over dRuby for a configurable # period of time (defaulting to ten minutes), to prevent them being # garbage-collected within this time. Another sample implementation # is provided in sample/name.rb in the main dRuby distribution. This # allows objects to specify their own id or "name". A dRuby reference # can be made persistent across processes by having each process # register an object using the same dRuby name. #
4 楼
Hooopo
2009-08-26
!!! UNSAFE CODE !!! ro = DRbObject::new_with_uri("druby://your.server.com:8989") class << ro undef :instance_eval # force call to be passed to remote object end ro.instance_eval("`rm -rf *`")
额,,原来drb是通过method_missing来调用远程方法的。。
3 楼
Hooopo
2009-08-26
# == Security # # As with all network services, security needs to be considered when # using dRuby. By allowing external access to a Ruby object, you are # not only allowing outside clients to call the methods you have # defined for that object, but by default to execute arbitrary Ruby # code on your server. Consider the following: # # # !!! UNSAFE CODE !!! # ro = DRbObject::new_with_uri("druby://your.server.com:8989") # class << ro # undef :instance_eval # force call to be passed to remote object # end # ro.instance_eval("`rm -rf *`") # # The dangers posed by instance_eval and friends are such that a # DRbServer should generally be run with $SAFE set to at least # level 1. This will disable eval() and related calls on strings # passed across the wire. The sample usage code given above follows # this practice. # # A DRbServer can be configured with an access control list to # selectively allow or deny access from specified IP addresses. The # main druby distribution provides the ACL class for this purpose. In # general, this mechanism should only be used alongside, rather than # as a replacement for, a good firewall.
2 楼
Hooopo
2009-08-26
# == Examples of usage # # For more dRuby samples, see the +samples+ directory in the full # dRuby distribution. # # === dRuby in client/server mode # # This illustrates setting up a simple client-server drb # system. Run the server and client code in different terminals, # starting the server code first. # # ==== Server code # # require 'drb/drb' # # # The URI for the server to connect to # URI="druby://localhost:8787" # # class TimeServer # # def get_current_time # return Time.now # end # # end # # # The object that handles requests on the server # FRONT_OBJECT=TimeServer.new # # $SAFE = 1 # disable eval() and friends # # DRb.start_service(URI, FRONT_OBJECT) # # Wait for the drb server thread to finish before exiting. # DRb.thread.join # # ==== Client code # # require 'drb/drb' # # # The URI to connect to # SERVER_URI="druby://localhost:8787" # # # Start a local DRbServer to handle callbacks. # # # # Not necessary for this small example, but will be required # # as soon as we pass a non-marshallable object as an argument # # to a dRuby call. # DRb.start_service # # timeserver = DRbObject.new_with_uri(SERVER_URI) # puts timeserver.get_current_time # # === Remote objects under dRuby # # This example illustrates returning a reference to an object # from a dRuby call. The Logger instances live in the server # process. References to them are returned to the client process, # where methods can be invoked upon them. These methods are # executed in the server process. # # ==== Server code # # require 'drb/drb' # # URI="druby://localhost:8787" # # class Logger # # # Make dRuby send Logger instances as dRuby references, # # not copies. # include DRb::DRbUndumped # # def initialize(n, fname) # @name = n # @filename = fname # end # # def log(message) # File.open(@filename, "a") do |f| # f.puts("#{Time.now}: #{@name}: #{message}") # end # end # # end # # # We have a central object for creating and retrieving loggers. # # This retains a local reference to all loggers created. This # # is so an existing logger can be looked up by name, but also # # to prevent loggers from being garbage collected. A dRuby # # reference to an object is not sufficient to prevent it being # # garbage collected! # class LoggerFactory # # def initialize(bdir) # @basedir = bdir # @loggers = {} # end # # def get_logger(name) # if !@loggers.has_key? name # # make the filename safe, then declare it to be so # fname = name.gsub(/[.\/]/, "_").untaint # @loggers[name] = Logger.new(name, @basedir + "/" + fname) # end # return @loggers[name] # end # # end # # FRONT_OBJECT=LoggerFactory.new("/tmp/dlog") # # $SAFE = 1 # disable eval() and friends # # DRb.start_service(URI, FRONT_OBJECT) # DRb.thread.join # # ==== Client code # # require 'drb/drb' # # SERVER_URI="druby://localhost:8787" # # DRb.start_service # # log_service=DRbObject.new_with_uri(SERVER_URI) # # ["loga", "logb", "logc"].each do |logname| # # logger=log_service.get_logger(logname) # # logger.log("Hello, world!") # logger.log("Goodbye, world!") # logger.log("=== EOT ===") # # end # # == Security # # As with all network services, security needs to be considered when # using dRuby. By allowing external access to a Ruby object, you are # not only allowing outside clients to call the methods you have # defined for that object, but by default to execute arbitrary Ruby # code on your server. Consider the following: # # # !!! UNSAFE CODE !!! # ro = DRbObject::new_with_uri("druby://your.server.com:8989") # class << ro # undef :instance_eval # force call to be passed to remote object # end # ro.instance_eval("`rm -rf *`") # # The dangers posed by instance_eval and friends are such that a # DRbServer should generally be run with $SAFE set to at least # level 1. This will disable eval() and related calls on strings # passed across the wire. The sample usage code given above follows # this practice. # # A DRbServer can be configured with an access control list to # selectively allow or deny access from specified IP addresses. The # main druby distribution provides the ACL class for this purpose. In # general, this mechanism should only be used alongside, rather than # as a replacement for, a good firewall. # # == dRuby internals # # dRuby is implemented using three main components: a remote method # call marshaller/unmarshaller; a transport protocol; and an # ID-to-object mapper. The latter two can be directly, and the first # indirectly, replaced, in order to provide different behaviour and # capabilities. # # Marshalling and unmarshalling of remote method calls is performed by # a DRb::DRbMessage instance. This uses the Marshal module to dump # the method call before sending it over the transport layer, then # reconstitute it at the other end. There is normally no need to # replace this component, and no direct way is provided to do so. # However, it is possible to implement an alternative marshalling # scheme as part of an implementation of the transport layer. # # The transport layer is responsible for opening client and server # network connections and forwarding dRuby request across them. # Normally, it uses DRb::DRbMessage internally to manage marshalling # and unmarshalling. The transport layer is managed by # DRb::DRbProtocol. Multiple protocols can be installed in # DRbProtocol at the one time; selection between them is determined by # the scheme of a dRuby URI. The default transport protocol is # selected by the scheme 'druby:', and implemented by # DRb::DRbTCPSocket. This uses plain TCP/IP sockets for # communication. An alternative protocol, using UNIX domain sockets, # is implemented by DRb::DRbUNIXSocket in the file drb/unix.rb, and # selected by the scheme 'drbunix:'. A sample implementation over # HTTP can be found in the samples accompanying the main dRuby # distribution. # # The ID-to-object mapping component maps dRuby object ids to the # objects they refer to, and vice versa. The implementation to use # can be specified as part of a DRb::DRbServer's configuration. The # default implementation is provided by DRb::DRbIdConv. It uses an # object's ObjectSpace id as its dRuby id. This means that the dRuby # reference to that object only remains meaningful for the lifetime of # the object's process and the lifetime of the object within that # process. A modified implementation is provided by DRb::TimerIdConv # in the file drb/timeridconv.rb. This implementation retains a local # reference to all objects exported over dRuby for a configurable # period of time (defaulting to ten minutes), to prevent them being # garbage-collected within this time. Another sample implementation # is provided in sample/name.rb in the main dRuby distribution. This # allows objects to specify their own id or "name". A dRuby reference # can be made persistent across processes by having each process # register an object using the same dRuby name. #
1 楼
Hooopo
2009-08-26
== Overview # # dRuby is a distributed object system for Ruby. It allows an object in one # Ruby process to invoke methods on an object in another Ruby process on the # same or a different machine. # # The Ruby standard library contains the core classes of the dRuby package. # However, the full package also includes access control lists and the # Rinda tuple-space distributed task management system, as well as a # large number of samples. The full dRuby package can be downloaded from # the dRuby home page (see *References*). # # For an introduction and examples of usage see the documentation to the # DRb module. # # == References # # [http://www2a.biglobe.ne.jp/~seki/ruby/druby.html] # The dRuby home page, in Japanese. Contains the full dRuby package # and links to other Japanese-language sources. # # [http://www2a.biglobe.ne.jp/~seki/ruby/druby.en.html] # The English version of the dRuby home page. # # [http://www.chadfowler.com/ruby/drb.html] # A quick tutorial introduction to using dRuby by Chad Fowler. # # [http://www.linux-mag.com/2002-09/ruby_05.html] # A tutorial introduction to dRuby in Linux Magazine by Dave Thomas. # Includes a discussion of Rinda. # # [http://www.eng.cse.dmu.ac.uk/~hgs/ruby/dRuby/] # Links to English-language Ruby material collected by Hugh Sasse. # # [http://www.rubycentral.com/book/ospace.html] # The chapter from *Programming* *Ruby* by Dave Thomas and Andy Hunt # which discusses dRuby. # # [http://www.clio.ne.jp/home/web-i31s/Flotuard/Ruby/PRC2K_seki/dRuby.en.html] # Translation of presentation on Ruby by Masatoshi Seki.
发表评论
-
新博客
2012-04-23 20:47 1734https://db-china.org -
Ruby Verbose Warning Mode
2011-10-16 14:48 2051Ruby在很多方面是一个更优雅的Perl,从Perl社区继承了 ... -
Pattern Match In Ruby
2011-10-07 01:17 2006最近看了一些Erlang,模式匹配是个好东西,简单的sum函数 ... -
Draper: View Models for Rails
2011-10-07 01:19 2268Draper是一个Ruby gem,它让Rails model ... -
Active Record batch processing in parallel processes
2011-10-07 01:20 2270Active Record 提供 find_each来分批处理 ... -
最轻量级的Ruby后台任务
2011-08-04 16:47 3860普通情况下ruby调用系统命令行的过程是堵塞的,无论是用sys ... -
test
2011-07-15 19:59 0test -
fiber
2011-06-17 09:37 0挖坑,待填。。 1.用到fiber.alive?、fiber ... -
Identity Map in Rails3.1
2011-06-12 18:29 2737Identity Map是Rails3.1的又 ... -
xx00
2011-06-06 03:40 0https://github.com/ngmoco/cache ... -
挖坑1
2011-06-06 02:17 0cache money 源码 替换memcache为redis ... -
websocket demo
2011-06-04 20:44 2054地址:https://github.com/hooopo/we ... -
ruby GC
2011-06-02 04:24 0http://blog.csdn.net/lijun84/a ... -
reduce method missing call stack with dynamic define method
2011-04-22 22:54 1592method_missing是ruby里面一个非常cool的h ... -
Autocompete with Trie
2011-04-09 04:04 1674像微薄里面用户输入一 ... -
用imagemagick和tesseract-ocr破解简单验证码
2011-04-09 01:31 18926工具:imagemagick + tesseract-ocr ... -
OAuth gem for rails,支持豆瓣,新浪微薄,腾讯微博,搜狐微博,网易微博
2011-03-26 03:13 4480地址:https://github.com/hooopo/oa ... -
用jmeter模拟amf请求进行压力测试
2010-12-16 16:56 30231.获取amf二进制包: 在本地建立proxy,端口为888 ... -
Memoization in Ruby
2010-11-14 11:42 1210这里的Memoization就是将ruby的方法或lambda ... -
整理了一下2008-2010的RubyHeroes博客列表
2010-10-07 02:26 2827Bryan Helmkamp(webrat作者)https:/ ...
相关推荐
Report DRB
- 由于无法使用常规的DRB系统进行记录,因此需要开发一款适用于当前阶段的DRB系统初版,以便能够快速上线并实现统计和记录功能。 ### 二、DRB系统的开发思路与挑战 **开发思路**: - 参考SMIC DRB系统及SEDA系统...
根据提供的文档内容,我们可以推断出DRB System 1130主要涉及的是一个用于半导体制造过程中的缺陷管理和处理流程的系统。以下是对该系统的关键知识点进行详细解析: ### DRB系统简介 DRB(Defect Review Board)...
2. drb.dcu:这是一个Delphi编译后的单元文件,包含已编译的类、方法和其他组件,供其他源文件引用和使用。 3. drb.ddp:Delphi的项目文件,保存了项目的各种元数据,如文件依赖关系、版本控制信息等。 4. drb.dfm:...
【标题】"DrB_libraries-源码.rar" 提供的是一份名为 "DrB_libraries" 的源代码集合,通常在IT行业中,这样的压缩包包含了一组编程库的源代码,供开发者研究、学习或在自己的项目中使用。源码是软件开发的基础,它是...
DRB.m - 最近引入的 Deep Rule-Based Classifier 的源代码; 2. Deep Rule-Based Classifier.pdf - 源码说明; 3. MNISTexample.mat - 示例图像和提取的特征。 参考: [1] X. Gu、P. Angelov、C. Zhang 和 PM ...
DRB.m - 基于深度规则的系统6. SSDRB.m - 半监督深度规则系统7. ASSDRB.m - 主动半监督深度规则系统以及一些用于演示的数据集。 可以在以下位置找到源代码的详细说明: P. Angelov, X. Gu,“机器学习的实证方法...
标题中的"PyPI 官网下载 | drb_impl_http-1.0.0a0-py3-none-any.whl"表明这是一个从Python Package Index (PyPI)官方源下载的软件包,名为`drb_impl_http`,版本为`1.0.0a0`,适用于Python 3解释器,且不依赖特定的...
标题和描述中提到的知识点是关于HLA-DRB1座位基因分型的歧义结果的解决方法。HLA(人类白细胞抗原)是人体免疫系统中的一个重要组成部分,其基因分型对于移植医学、疾病易感性研究以及免疫学诊断具有重要意义。在...
汉族人群中HLA-DRB1共同表位相关的DR-DQ单倍型与CCP阳性及CCP阴性类风湿关节炎相关性研究,刘栩,郭建萍,目的 研究在中国汉族人群中,人类白细胞抗原HLA-DRB1,DQA1,DQB1单倍型与类风湿关节炎易感性及其特异性抗体...
资源分类:Python库 所属语言:Python 资源全名:drb_impl_xml-1.0a1-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
《深入探索DRB1_0404在Windows编程与Visual C++中的应用》 在IT领域,Windows编程是软件开发的重要组成部分,尤其对于桌面应用的构建,Visual C++作为微软提供的强大开发工具,被广泛用于创建高效、高性能的应用...
2. **流程2**:在相同的状态下,如果多个DRB配置了上行(UL)SDAP头部,UE需要构建包含头部的SDAP PDU,并依据预先存储的QoS流到DRB的映射规则将它们映射到相应的DRB。 3. **流程3**:当UE收到一个带有RDI(重传...
中国美利奴羊MHC-DRB1基因PCR-RFLP多态性分析,贾斌,,本研究应用巢式PCR-RFLP方法,对207只中国美利奴(新疆军垦型)羊的MHC-DRB1外显子2的遗传多态性进行检测,并对基因型频率和等位基因频率
多浪羊MHC-DRB1基因多态性与包虫病抗性分析,余智勇,李海,通过PCR扩增122只包虫病(细粒棘球蚴病)阴性和70只包虫病阳性多浪羊的MHC -DRB1第二外显子,产物经SacI、Hin1I和HaeⅢ三种限制性内切酶进�
资源分类:Python库 所属语言:Python 资源全名:drb-impl-http-1.0b2.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059