expeditor 0.1.0 → 0.1.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: 28e3d0c9d21f60030c7e591f6fd79c849357b428
4
- data.tar.gz: e3fd9e317a4d5fcd3b27bb4f9d4b8c48a03dc436
3
+ metadata.gz: 9545876fd08d33f5578deccef8bfffd39564c014
4
+ data.tar.gz: 2b1b2e2e586ac117986965c832326c0398104cae
5
5
  SHA512:
6
- metadata.gz: 51d080f2f60dde13877de518bdf1ad4893cc98bfa970e3e8ee9891e754445f3564c517beadcec923b62900c44ef97bb0906dcead8dd78d4f7c92f823f186f6c9
7
- data.tar.gz: 95753cfcd208ebe0e29ed06a51c69bbf4589d3252e299748a83f13ed17aa326e3a1e68483bbf9b7211a50985309c30b8c8db9de4d7e79b351005495822351fb2
6
+ metadata.gz: 1ed11e18c6a4c20cf6c80b2beb36481680776b52a167789178b29dc5038368df370b9eb8f58c42fddeeb06f4870ffc0f64fbfb1659a4a1ae000b4365a4df87b5
7
+ data.tar.gz: ddda85a097bf8cebdb050870d6cdc9b76edd6d37158dbed2f5da6ef69abba40679894e6e13b60576c4f0949aebb529be7d8ba369a4497334ac659ed542d38c56
data/.travis.yml CHANGED
@@ -1,3 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.1
3
+ - 2.0.0
4
+ - 2.1
5
+ - 2.2
6
+ - ruby-head
7
+ matrix:
8
+ allow_failures:
9
+ - rvm: ruby-head
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## 0.1.1
2
+ - Avoid to use concurrent-ruby 0.9.x. #1
3
+
4
+ ## 0.1.0
5
+ - First release :tada:
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Cookpad Inc.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Expeditor
2
+ [![Gem Version](https://badge.fury.io/rb/expeditor.svg)](http://badge.fury.io/rb/expeditor)
3
+ [![Build Status](https://travis-ci.org/cookpad/expeditor.svg?branch=master)](https://travis-ci.org/cookpad/expeditor)
2
4
 
3
- Expeditor is a Ruby library inspired by Netflix/Hystrix.
5
+ Expeditor is a Ruby library that provides asynchronous execution and fault tolerance for microservices.
6
+
7
+ It is inspired by [Netflix/Hystrix](https://github.com/Netflix/Hystrix).
4
8
 
5
9
  ## Installation
6
10
 
@@ -20,7 +24,119 @@ Or install it yourself as:
20
24
 
21
25
  ## Usage
22
26
 
23
- TODO: Write usage instructions here
27
+ ### asynchronous execution
28
+
29
+ ```ruby
30
+ command1 = Expeditor::Command.new do
31
+ ...
32
+ end
33
+
34
+ command2 = Expeditor::Command.new do
35
+ ...
36
+ end
37
+
38
+ command1.start # non blocking
39
+ command2.start # non blocking
40
+
41
+ command1.get # wait until command1 execution is finished and get the result
42
+ command2.get # wait until command2 execution is finished and get the result
43
+ ```
44
+
45
+ ### asynchronous execution with dependencies
46
+
47
+ ```ruby
48
+ command1 = Expeditor::Command.new do
49
+ ...
50
+ end
51
+
52
+ command2 = Expeditor::Command.new do
53
+ ...
54
+ end
55
+
56
+ command3 = Expeditor::Command.new(dependencies: [command1, command2]) do |val1, val2|
57
+ ...
58
+ end
59
+
60
+ command3.start # command1 and command2 are started concurrently, execution of command3 is wait until command1 and command2 are finished.
61
+ ```
62
+
63
+ ### fallback
64
+
65
+ ```ruby
66
+ command = Expeditor::Command.new do
67
+ # something that may be failed
68
+ end
69
+
70
+ # use fallback value if command is failed
71
+ command_with_fallback = command.with_fallback do |e|
72
+ log(e)
73
+ default_value
74
+ end
75
+
76
+ command.start.get #=> error may be raised
77
+ command_with_fallback.start.get #=> default_value if command is failed
78
+ ```
79
+
80
+ ### timeout
81
+
82
+ ```ruby
83
+ command = Expeditor::Command.new(timeout: 1) do
84
+ ...
85
+ end
86
+
87
+ command.start
88
+ command.get #=> Timeout::Error is raised if execution is timed out
89
+ ```
90
+
91
+ ### retry
92
+
93
+ ```ruby
94
+ command = Expeditor::Command.new do
95
+ ...
96
+ end
97
+
98
+ # the option is completely same as retryable gem
99
+ command.start_with_retry(
100
+ tries: 3,
101
+ sleep: 1,
102
+ on: [StandardError],
103
+ )
104
+ ```
105
+
106
+ ### using thread pool
107
+
108
+ Expeditor use [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby/)'s executors as thread pool.
109
+
110
+ ```ruby
111
+ require 'concurrent'
112
+
113
+ service = Expeditor::Service.new(
114
+ executor: Concurrent::ThreadPoolExecutor.new(
115
+ min_threads: 0,
116
+ max_threads: 5,
117
+ max_queue: 100,
118
+ )
119
+ )
120
+
121
+ command = Expeditor::Command.new(service: service) do
122
+ ...
123
+ end
124
+ ```
125
+
126
+ ### circuit breaker
127
+
128
+ ```ruby
129
+ service = Expeditor::Service.new(
130
+ period: 10, # retention period of the service metrics (success, failure, timeout, ...)
131
+ sleep: 1, # if once the circuit is opened, the circuit is still open until sleep time is passed even though failure rate is less than threshold
132
+ threshold: 0.5, # if the failure rate is more than or equal to threshold, the circuit is opened
133
+ non_break_count: 100 # if the total count of metrics is not more than non_break_count, the circuit is not opened even though failure rate is more than threshold
134
+ )
135
+
136
+ command = Expeditor::Command.new(service: service) do
137
+ ...
138
+ end
139
+ ```
24
140
 
25
141
  ## Development
26
142
 
@@ -30,7 +146,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
30
146
 
31
147
  ## Contributing
32
148
 
33
- 1. Fork it ( https://github.com/[my-github-username]/expeditor/fork )
149
+ 1. Fork it ( https://github.com/cookpad/expeditor/fork )
34
150
  2. Create your feature branch (`git checkout -b my-new-feature`)
35
151
  3. Commit your changes (`git commit -am 'Add some feature'`)
36
152
  4. Push to the branch (`git push origin my-new-feature`)
data/expeditor.gemspec CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Expeditor::VERSION
9
9
  spec.authors = ["shohei-yasutake"]
10
10
  spec.email = ["shohei-yasutake@cookpad.com"]
11
+ spec.license = "MIT"
11
12
 
12
13
  spec.summary = "Expeditor provides asynchronous execution and fault tolerance for microservices"
13
14
  spec.description = "Expeditor provides asynchronous execution and fault tolerance for microservices"
@@ -18,15 +19,11 @@ Gem::Specification.new do |spec|
18
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
20
  spec.require_paths = ["lib"]
20
21
 
21
- if spec.respond_to?(:metadata)
22
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
23
- end
24
-
25
- spec.add_runtime_dependency "concurrent-ruby", "~> 0.8"
26
- spec.add_runtime_dependency "concurrent-ruby-ext", "~> 0.8"
22
+ spec.add_runtime_dependency "concurrent-ruby", "0.8.0"
23
+ spec.add_runtime_dependency "concurrent-ruby-ext", "0.8.0"
27
24
  spec.add_runtime_dependency "retryable", "> 1.0"
28
25
 
29
- spec.add_development_dependency "bundler", "~> 1.9"
30
- spec.add_development_dependency "rake", "~> 10.0"
31
- spec.add_development_dependency "rspec", "3.2.0"
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "rspec", ">= 3.0.0"
32
29
  end
@@ -1,3 +1,3 @@
1
1
  module Expeditor
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,99 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - shohei-yasutake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0.8'
19
+ version: 0.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '0.8'
26
+ version: 0.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: concurrent-ruby-ext
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0.8'
33
+ version: 0.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0.8'
40
+ version: 0.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: retryable
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>'
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>'
52
+ - - ">"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1.9'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '1.9'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 3.2.0
89
+ version: 3.0.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 3.2.0
96
+ version: 3.0.0
97
97
  description: Expeditor provides asynchronous execution and fault tolerance for microservices
98
98
  email:
99
99
  - shohei-yasutake@cookpad.com
@@ -101,10 +101,12 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rspec
106
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - CHANGELOG.md
107
108
  - Gemfile
109
+ - LICENSE.txt
108
110
  - README.md
109
111
  - Rakefile
110
112
  - bin/console
@@ -122,28 +124,28 @@ files:
122
124
  - lib/expeditor/status.rb
123
125
  - lib/expeditor/version.rb
124
126
  homepage: https://github.com/cookpad/expeditor
125
- licenses: []
126
- metadata:
127
- allowed_push_host: 'TODO: Set to ''http://mygemserver.com'' to prevent pushes to
128
- rubygems.org, or delete to allow pushes to any server.'
127
+ licenses:
128
+ - MIT
129
+ metadata: {}
129
130
  post_install_message:
130
131
  rdoc_options: []
131
132
  require_paths:
132
133
  - lib
133
134
  required_ruby_version: !ruby/object:Gem::Requirement
134
135
  requirements:
135
- - - '>='
136
+ - - ">="
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  requirements:
140
- - - '>='
141
+ - - ">="
141
142
  - !ruby/object:Gem::Version
142
143
  version: '0'
143
144
  requirements: []
144
145
  rubyforge_project:
145
- rubygems_version: 2.0.14
146
+ rubygems_version: 2.4.5
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: Expeditor provides asynchronous execution and fault tolerance for microservices
149
150
  test_files: []
151
+ has_rdoc: