drb 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/drb.gemspec +2 -1
- data/lib/drb/drb.rb +64 -14
- data/lib/drb/ssl.rb +1 -1
- data/lib/drb/version.rb +1 -1
- data/lib/drb/weakidconv.rb +17 -45
- metadata +4 -4
- data/lib/drb/invokemethod.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 311c2093dbdf20afb0f21ded3968959afb5111e14c48b7db097a2bcde44ac583
|
4
|
+
data.tar.gz: 0cd370bd8dda8a2d78b1d1e64eba4a442f8fac7cec1a9a7f3a5f4fda43498e0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 720fdef98e8f0f3af1ec4adeb527abe11bdd75fde43c917cb36af1e0d2c68eec49b68e4ca57170acc31e355cb4f212b5f8e5bc486df1cefed500fd7adef2e0d5
|
7
|
+
data.tar.gz: 88f330b7d45fcfbbe84ae0ea895863d685813d8ef9878123c126fd6828952b281c6bffac89d98e124dd73757151ec6b6188e3ee31eb63c1781ee038b28b1600d
|
data/drb.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
20
|
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
+
spec.metadata["changelog_uri"] =
|
22
|
+
"#{spec.homepage}/releases/tag/v#{spec.version}"
|
21
23
|
|
22
24
|
spec.files = %w[
|
23
25
|
LICENSE.txt
|
@@ -29,7 +31,6 @@ Gem::Specification.new do |spec|
|
|
29
31
|
lib/drb/extserv.rb
|
30
32
|
lib/drb/extservm.rb
|
31
33
|
lib/drb/gw.rb
|
32
|
-
lib/drb/invokemethod.rb
|
33
34
|
lib/drb/observer.rb
|
34
35
|
lib/drb/ssl.rb
|
35
36
|
lib/drb/timeridconv.rb
|
data/lib/drb/drb.rb
CHANGED
@@ -35,11 +35,11 @@
|
|
35
35
|
# [http://www2a.biglobe.ne.jp/~seki/ruby/druby.en.html]
|
36
36
|
# The English version of the dRuby home page.
|
37
37
|
#
|
38
|
-
# [
|
38
|
+
# [https://web.archive.org/web/20160611151955/https://pragprog.com/book/sidruby/the-druby-book]
|
39
39
|
# The dRuby Book: Distributed and Parallel Computing with Ruby
|
40
40
|
# by Masatoshi Seki and Makoto Inoue
|
41
41
|
#
|
42
|
-
# [http://
|
42
|
+
# [http://ruby-doc.com/docs/ProgrammingRuby/html/ospace.html]
|
43
43
|
# The chapter from *Programming* *Ruby* by Dave Thomas and Andy Hunt
|
44
44
|
# which discusses dRuby.
|
45
45
|
#
|
@@ -348,6 +348,39 @@ module DRb
|
|
348
348
|
# protocol.
|
349
349
|
class DRbConnError < DRbError; end
|
350
350
|
|
351
|
+
class DRbObjectSpace # :nodoc:
|
352
|
+
# This is an internal class for DRbIdConv. This must not be used
|
353
|
+
# by users.
|
354
|
+
|
355
|
+
include MonitorMixin
|
356
|
+
|
357
|
+
def initialize
|
358
|
+
super()
|
359
|
+
@map = ObjectSpace::WeakMap.new
|
360
|
+
end
|
361
|
+
|
362
|
+
def to_id(obj)
|
363
|
+
synchronize do
|
364
|
+
@map[obj.__id__] = obj
|
365
|
+
obj.__id__
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
def to_obj(ref)
|
370
|
+
synchronize do
|
371
|
+
obj = @map[ref]
|
372
|
+
raise RangeError.new("invalid reference") unless obj.__id__ == ref
|
373
|
+
obj
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
# :nodoc:
|
379
|
+
#
|
380
|
+
# This is an internal singleton instance. This must not be used
|
381
|
+
# by users.
|
382
|
+
DRB_OBJECT_SPACE = DRbObjectSpace.new
|
383
|
+
|
351
384
|
# Class responsible for converting between an object and its id.
|
352
385
|
#
|
353
386
|
# This, the default implementation, uses an object's local ObjectSpace
|
@@ -364,7 +397,7 @@ module DRb
|
|
364
397
|
# This implementation looks up the reference id in the local object
|
365
398
|
# space and returns the object it refers to.
|
366
399
|
def to_obj(ref)
|
367
|
-
|
400
|
+
DRB_OBJECT_SPACE.to_obj(ref)
|
368
401
|
end
|
369
402
|
|
370
403
|
# Convert an object into a reference id.
|
@@ -372,12 +405,7 @@ module DRb
|
|
372
405
|
# This implementation returns the object's __id__ in the local
|
373
406
|
# object space.
|
374
407
|
def to_id(obj)
|
375
|
-
|
376
|
-
when Object
|
377
|
-
obj.nil? ? nil : obj.__id__
|
378
|
-
when BasicObject
|
379
|
-
obj.__id__
|
380
|
-
end
|
408
|
+
(nil == obj) ? nil : DRB_OBJECT_SPACE.to_id(obj)
|
381
409
|
end
|
382
410
|
end
|
383
411
|
|
@@ -1673,6 +1701,33 @@ module DRb
|
|
1673
1701
|
check_insecure_method
|
1674
1702
|
end
|
1675
1703
|
|
1704
|
+
def block_yield(x)
|
1705
|
+
if x.size == 1 && x[0].class == Array
|
1706
|
+
x[0] = DRbArray.new(x[0])
|
1707
|
+
end
|
1708
|
+
@block.call(*x)
|
1709
|
+
end
|
1710
|
+
|
1711
|
+
def perform_with_block
|
1712
|
+
@obj.__send__(@msg_id, *@argv) do |*x|
|
1713
|
+
jump_error = nil
|
1714
|
+
begin
|
1715
|
+
block_value = block_yield(x)
|
1716
|
+
rescue LocalJumpError
|
1717
|
+
jump_error = $!
|
1718
|
+
end
|
1719
|
+
if jump_error
|
1720
|
+
case jump_error.reason
|
1721
|
+
when :break
|
1722
|
+
break(jump_error.exit_value)
|
1723
|
+
else
|
1724
|
+
raise jump_error
|
1725
|
+
end
|
1726
|
+
end
|
1727
|
+
block_value
|
1728
|
+
end
|
1729
|
+
end
|
1730
|
+
|
1676
1731
|
def perform_without_block
|
1677
1732
|
if Proc === @obj && @msg_id == :__drb_yield
|
1678
1733
|
if @argv.size == 1
|
@@ -1688,11 +1743,6 @@ module DRb
|
|
1688
1743
|
|
1689
1744
|
end
|
1690
1745
|
|
1691
|
-
require_relative 'invokemethod'
|
1692
|
-
class InvokeMethod
|
1693
|
-
include InvokeMethod18Mixin
|
1694
|
-
end
|
1695
|
-
|
1696
1746
|
def error_print(exception)
|
1697
1747
|
exception.backtrace.inject(true) do |first, x|
|
1698
1748
|
if first
|
data/lib/drb/ssl.rb
CHANGED
data/lib/drb/version.rb
CHANGED
data/lib/drb/weakidconv.rb
CHANGED
@@ -1,57 +1,29 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
require_relative 'drb'
|
3
|
-
require 'monitor'
|
4
3
|
|
5
4
|
module DRb
|
6
5
|
|
6
|
+
# DRb::WeakIdConv is deprecated since 2.2.1. You don't need to use
|
7
|
+
# DRb::WeakIdConv instead of DRb::DRbIdConv. It's the same class.
|
8
|
+
#
|
9
|
+
# This file still exists for backward compatibility.
|
10
|
+
#
|
7
11
|
# To use WeakIdConv:
|
8
12
|
#
|
9
13
|
# DRb.start_service(nil, nil, {:idconv => DRb::WeakIdConv.new})
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@map[obj] = self
|
24
|
-
rescue ArgumentError
|
25
|
-
@immutable[obj.__id__] = obj
|
26
|
-
end
|
27
|
-
return obj.__id__
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def fetch(ref)
|
32
|
-
synchronize do
|
33
|
-
@immutable.fetch(ref) {
|
34
|
-
@map.each { |key, _|
|
35
|
-
return key if key.__id__ == ref
|
36
|
-
}
|
37
|
-
raise RangeError.new("invalid reference")
|
38
|
-
}
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def initialize()
|
44
|
-
super()
|
45
|
-
@weak_set = WeakSet.new
|
46
|
-
end
|
47
|
-
|
48
|
-
def to_obj(ref) # :nodoc:
|
49
|
-
return super if ref.nil?
|
50
|
-
@weak_set.fetch(ref)
|
51
|
-
end
|
52
|
-
|
53
|
-
def to_id(obj) # :nodoc:
|
54
|
-
return @weak_set.add(obj)
|
15
|
+
def self.const_missing(name) # :nodoc:
|
16
|
+
case name
|
17
|
+
when :WeakIdConv
|
18
|
+
warn("DRb::WeakIdConv is deprecated. " +
|
19
|
+
"You can use the DRb::DRbIdConv. " +
|
20
|
+
"You don't need to use this.",
|
21
|
+
uplevel: 1)
|
22
|
+
const_set(:WeakIdConv, DRbIdConv)
|
23
|
+
singleton_class.remove_method(:const_missing)
|
24
|
+
DRbIdConv
|
25
|
+
else
|
26
|
+
super
|
55
27
|
end
|
56
28
|
end
|
57
29
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masatoshi SEKI
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Distributed object system for Ruby
|
13
13
|
email:
|
@@ -25,7 +25,6 @@ files:
|
|
25
25
|
- lib/drb/extserv.rb
|
26
26
|
- lib/drb/extservm.rb
|
27
27
|
- lib/drb/gw.rb
|
28
|
-
- lib/drb/invokemethod.rb
|
29
28
|
- lib/drb/observer.rb
|
30
29
|
- lib/drb/ssl.rb
|
31
30
|
- lib/drb/timeridconv.rb
|
@@ -39,6 +38,7 @@ licenses:
|
|
39
38
|
metadata:
|
40
39
|
homepage_uri: https://github.com/ruby/drb
|
41
40
|
source_code_uri: https://github.com/ruby/drb
|
41
|
+
changelog_uri: https://github.com/ruby/drb/releases/tag/v2.2.3
|
42
42
|
rdoc_options: []
|
43
43
|
require_paths:
|
44
44
|
- lib
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
|
-
rubygems_version: 3.6.
|
56
|
+
rubygems_version: 3.6.7
|
57
57
|
specification_version: 4
|
58
58
|
summary: Distributed object system for Ruby
|
59
59
|
test_files: []
|
data/lib/drb/invokemethod.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: false
|
2
|
-
# for ruby-1.8.0
|
3
|
-
|
4
|
-
module DRb # :nodoc: all
|
5
|
-
class DRbServer
|
6
|
-
module InvokeMethod18Mixin
|
7
|
-
def block_yield(x)
|
8
|
-
if x.size == 1 && x[0].class == Array
|
9
|
-
x[0] = DRbArray.new(x[0])
|
10
|
-
end
|
11
|
-
@block.call(*x)
|
12
|
-
end
|
13
|
-
|
14
|
-
def perform_with_block
|
15
|
-
@obj.__send__(@msg_id, *@argv) do |*x|
|
16
|
-
jump_error = nil
|
17
|
-
begin
|
18
|
-
block_value = block_yield(x)
|
19
|
-
rescue LocalJumpError
|
20
|
-
jump_error = $!
|
21
|
-
end
|
22
|
-
if jump_error
|
23
|
-
case jump_error.reason
|
24
|
-
when :break
|
25
|
-
break(jump_error.exit_value)
|
26
|
-
else
|
27
|
-
raise jump_error
|
28
|
-
end
|
29
|
-
end
|
30
|
-
block_value
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|