ifuture 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d94fe9a05bad2bab88284f9fcb62f6ca82f9751
4
- data.tar.gz: 5b9a0058d57c9f0c93324e357e521b025dae674b
3
+ metadata.gz: 33f44747ddeacd0ac909dc4ab96d24e6d956598e
4
+ data.tar.gz: 0d3742c4bd00ef9ca653078d5095001bc1169df0
5
5
  SHA512:
6
- metadata.gz: c06dae9bd883b8d81b22fed1136e9892d22070c2a927015626b61e63eaedb70d3e3910cdba3bed4394b06c91dc0192ff86a5355f12dc96d643cacdcdadd8e6db
7
- data.tar.gz: fa6a6b01d10a6f319258e7880f91449f36d954f719948fc670f62b9f21dcf01013c48b2089fa40c58fa04f7c0ed733342bf5786dd80b8e672aac916bb7d16a1f
6
+ metadata.gz: f9db99df33f1ab23e405d91ea9bb3237749874d7af46fe4229164a6f9a86cd3b04364d04d0c33e827b2e1d7ef7dcb31d2ac8ca46bee46b5c92b91148fab50548
7
+ data.tar.gz: 13b45db1db131ed0fc439ffbf777021c9f89dc25b230ec1cfca6d5aa566c9111fa234b7729b72c29658fee82bf2bd1de3067b1db012dd881df4933d9f5952fdd
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- ���c�ȎUOWt�r�BC��WW2��</�6�qe-��>C͙5��b��)•���bcFN������MlQ(Ό8��G�`��W��U�@���8�F�;����*�a͌��m����)#��t�^0R����u-
1
+ 1s��g�;WۑP�؛b���-�}@�˳?<� ���� jـ�hex]ߥ���
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # ifuture
1
+ # iFuture
2
2
  [![Build Status](https://secure.travis-ci.org/Havenwood/ifuture.png?branch=master)](http://travis-ci.org/havenwood/ifuture)
3
3
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/Havenwood/ifuture)
4
4
 
5
- An implementation of Futures (see [Celluloid](https://github.com/celluloid/celluloid/wiki/futures)) for Ruby using process forks with [IChannel](https://github.com/robgleeson/ichannel).
5
+ Futures for Ruby implemented with [IChannel](https://github.com/robgleeson/ichannel) for interprocess communication via a UNIXSocket or Redis. Run some code in another process, locally or over the network, and get the result back later!
6
6
 
7
- The Future starts running right away, but isn't blocking because it runs in its own fork and uses IChannel to communicate with the parent Process. This allows multithreading without the GIL blocking as it would with Threads. If the value is asked for and it is ready, it will be returned right away. If the value is asked for early, the Future blocks until delivery.
7
+ The Future starts running right away, but isn't blocking because it runs in its own fork and uses IChannel to communicate with the parent Process. This allows multithreading without the GIL blocking as it would with Futures implemented on Threads. If the value is asked for and it is ready, it will be returned right away. If the value is asked for early, the Future blocks until delivery.
8
8
 
9
9
  ## Usage
10
10
 
@@ -35,6 +35,29 @@ future.ready?
35
35
  future.value
36
36
  #=> "Sekret!!"
37
37
  ```
38
+ ### Serializer
39
+
40
+ The default serialization format is Marshal, but you can use JSON, YAML or other formats that implement the methods #load and #dump.
41
+
42
+ ```ruby
43
+ require 'json'
44
+
45
+ future = IFuture.new JSON do
46
+ sleep 5
47
+ :human_readable
48
+ end
49
+ ```
50
+
51
+ ### Transport
52
+
53
+ By default iFuture uses iChannel with unix sockets for transferring serialized code. To run your fork on a process located remoted over the network, you can specify that you want to you iChannel with Redis on a host of your choosing.
54
+
55
+ ```ruby
56
+ future = IFuture.new(Marshal, :redis, {host: 'localhost', key: 'readme'}) do
57
+ sleep 5
58
+ :over_the_wire
59
+ end
60
+ ```
38
61
 
39
62
  ## Installation
40
63
 
data/ifuture.gemspec CHANGED
@@ -8,18 +8,18 @@ Gem::Specification.new do |gem|
8
8
  gem.version = IFuture::VERSION
9
9
  gem.authors = ['Shannon Skipper']
10
10
  gem.email = ['shannonskipper@gmail.com']
11
- gem.description = %q{Futures Implemented on Fork}
12
- gem.summary = %q{Futures implemented on top of IChannel for easy Forking.}
11
+ gem.description = %q{Concurrent Futures with Processes}
12
+ gem.summary = %q{Futures implemented on top of IChannel for interprocess communication.}
13
13
  gem.homepage = 'https://github.com/Havenwood'
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.require_paths = ['lib']
17
17
 
18
- gem.add_development_dependency 'ichannel', '~> 5.2.0'
18
+ gem.add_development_dependency 'ichannel', '~> 6.1.1'
19
19
  gem.add_development_dependency 'minitest'
20
20
  gem.add_development_dependency 'rake'
21
21
 
22
- gem.add_runtime_dependency 'ichannel', '~> 5.2.0'
22
+ gem.add_runtime_dependency 'ichannel', '~> 6.1.1'
23
23
 
24
24
  gem.signing_key = '/Users/shannonskipper/.gem/private/gem-private_key.pem'
25
25
  gem.cert_chain = ['/Users/shannonskipper/.gem/private/gem-public_cert.pem']
@@ -1,3 +1,3 @@
1
1
  class IFuture
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
data/lib/ifuture.rb CHANGED
@@ -2,8 +2,8 @@ require 'ichannel'
2
2
  require 'ifuture/version'
3
3
 
4
4
  class IFuture
5
- def initialize serializer = Marshal
6
- @channel = IChannel.new serializer
5
+ def initialize serializer = Marshal, transport = :unix, options = nil
6
+ @channel = IChannel.send transport, serializer, options
7
7
  @thread = Process.detach fork { @channel.put yield }
8
8
  end
9
9
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifuture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shannon Skipper
@@ -30,7 +30,7 @@ cert_chain:
30
30
  z22WQybM+fljAzMEpMjbGThWmw/gKqHWOMOQ2Z9S9jcGjEeEs+q3LRavRCzRBBzm
31
31
  uYIb0mkTph43yq9ZxOxwT3fbWtFJ+P004IvfqpRjjzX/EqSE5AR/xF1pa52F7w==
32
32
  -----END CERTIFICATE-----
33
- date: 2013-04-15 00:00:00.000000000 Z
33
+ date: 2013-05-18 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: ichannel
@@ -38,14 +38,14 @@ dependencies:
38
38
  requirements:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
- version: 5.2.0
41
+ version: 6.1.1
42
42
  type: :development
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: 5.2.0
48
+ version: 6.1.1
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: minitest
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -80,15 +80,15 @@ dependencies:
80
80
  requirements:
81
81
  - - ~>
82
82
  - !ruby/object:Gem::Version
83
- version: 5.2.0
83
+ version: 6.1.1
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: 5.2.0
91
- description: Futures Implemented on Fork
90
+ version: 6.1.1
91
+ description: Concurrent Futures with Processes
92
92
  email:
93
93
  - shannonskipper@gmail.com
94
94
  executables: []
@@ -128,6 +128,6 @@ rubyforge_project:
128
128
  rubygems_version: 2.0.3
129
129
  signing_key:
130
130
  specification_version: 4
131
- summary: Futures implemented on top of IChannel for easy Forking.
131
+ summary: Futures implemented on top of IChannel for interprocess communication.
132
132
  test_files: []
133
133
  has_rdoc:
metadata.gz.sig CHANGED
Binary file