ntl-actor 1.1.4 → 1.2.1

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: 11c0041bf9d54ac15c489478ad5bb1e5dc888875
4
- data.tar.gz: 710e332981d825dd1c871065a0bf4dc72fc6ac06
3
+ metadata.gz: a0eb90ff1326259da5859f3d9c5554d953f4a300
4
+ data.tar.gz: a95d5e65f84f0d285bfc2877ac180e0122636b91
5
5
  SHA512:
6
- metadata.gz: ae9c8b853235e278e30ad17f32318892392d59e684a790904a5975a141124fab6574734923964342274e277b9d7d661686b37ad2865e35aebe0a8a2d522578c8
7
- data.tar.gz: 92a8e0b9f438a314e00b074c96374ec9bd2aa9cb79bd05ea3b097e8865bab4c2950372b69753cecc89ba21a5bdcaadf725805d9fc23412b068a2b12dd10e8d32
6
+ metadata.gz: 47f864cd3c19ebf1016ee5a39f96734542df7f736da58cb46d8c25d67e1f53a61b7459dd2063d7a909681e47e15b40b8c623fb7388ea77da646d66cfc3577039
7
+ data.tar.gz: 253b782b66bb020c92d5256445326fcaf07ca005e5d61c1bb6165275804e2979641f1e5dce743dcc9056fe5399e997e081cb3b97fe595dfb47d7a7df14f6e9b9
@@ -14,11 +14,11 @@ module Actor
14
14
  queue.num_waiting
15
15
  end
16
16
 
17
- def queue_size
17
+ def queue_depth
18
18
  queue.size
19
19
  end
20
20
 
21
- def queue_max_size
21
+ def queue_limit
22
22
  queue.max
23
23
  end
24
24
  end
@@ -5,7 +5,7 @@ module Actor
5
5
  attr_writer :address
6
6
 
7
7
  def address
8
- @address ||= Address::Substitute.build
8
+ @address ||= Address::None.build
9
9
  end
10
10
  end
11
11
  end
@@ -1,9 +1,19 @@
1
1
  module Actor
2
2
  module Messaging
3
3
  class Address
4
- module Substitute
4
+ class Substitute < None
5
5
  def self.build
6
- None.build
6
+ instance = super
7
+ instance.extend Controls
8
+ instance
9
+ end
10
+
11
+ def queue_depth
12
+ @queue_depth ||= super
13
+ end
14
+
15
+ module Controls
16
+ attr_writer :queue_depth
7
17
  end
8
18
  end
9
19
  end
@@ -21,7 +21,7 @@ module Actor
21
21
  end
22
22
 
23
23
  def call message, wait: nil
24
- wait = true if wait.nil?
24
+ wait = false if wait.nil?
25
25
 
26
26
  record = Record.new message, wait
27
27
 
@@ -31,6 +31,14 @@ module Actor
31
31
  record
32
32
  end
33
33
 
34
+ def max
35
+ Float::INFINITY
36
+ end
37
+
38
+ def size
39
+ 0
40
+ end
41
+
34
42
  WouldBlockError = Class.new StandardError
35
43
 
36
44
  Record = Struct.new :message, :non_block
@@ -2,7 +2,7 @@ module Actor
2
2
  module Messaging
3
3
  class Send
4
4
  def call message, address, wait: nil
5
- non_block = wait == false
5
+ non_block = !wait
6
6
 
7
7
  queue = address.queue
8
8
 
@@ -13,11 +13,11 @@ module Actor
13
13
  begin
14
14
  queue.enq message, non_block
15
15
  rescue ThreadError
16
- raise WouldBlockError
16
+ raise QueueFullError
17
17
  end
18
18
  end
19
19
 
20
- WouldBlockError = Class.new StandardError
20
+ QueueFullError = Class.new StandardError
21
21
 
22
22
  def self.call *arguments
23
23
  instance = new
@@ -9,7 +9,7 @@ module Actor
9
9
  end
10
10
 
11
11
  def call message, address, wait: nil
12
- wait = true if wait.nil?
12
+ wait = false if wait.nil?
13
13
 
14
14
  record = Record.new message, address, wait
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ntl-actor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Ladd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Implementation of actor pattern for ruby
14
14
  email: nathanladd+github@gmail.com