barrage 0.0.3 → 0.1.1
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 +5 -5
- data/.travis.yml +8 -1
- data/CHANGELOG.md +14 -0
- data/Gemfile +14 -0
- data/Guardfile +11 -0
- data/README.md +14 -5
- data/barrage.gemspec +5 -1
- data/lib/barrage/generators/base.rb +15 -0
- data/lib/barrage/generators/msec.rb +2 -0
- data/lib/barrage/generators/redis_worker_id.rb +36 -18
- data/lib/barrage/version.rb +1 -1
- data/lib/barrage.rb +2 -0
- data/spec/barrage/generators/msec_spec.rb +43 -0
- data/spec/barrage/generators/redis_worker_id_spec.rb +66 -0
- data/spec/barrage/generators/sequence_spec.rb +58 -0
- data/spec/barrage_spec.rb +41 -0
- data/spec/spec_helper.rb +9 -1
- metadata +73 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1f1e0b5da1bcf39c6afcd692da7a90d3784bd791a83d2553c62b23c522de5e71
|
4
|
+
data.tar.gz: 97c3f16796ab212ad5421d758fdf2773f040befde8170cf5682fa1607b84c84f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c0189dfdd3286230938d122dee87d56d7d41fdf2526115ba87f34c1bbe3ed276e37efe485e8cb8f18dad253bc0b9452f0997db08e5400c5ad690a42da267fe8
|
7
|
+
data.tar.gz: 2dff301124982ccec6670d36b53e1e2c48e9108c37eb80a559f85e6a371eccf89a682fcd5ff22485d23fbde51e9529914491f10cc5cf05b20244ecdb042c8e7f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.1.1
|
4
|
+
|
5
|
+
* Fix redis client disconnect
|
6
|
+
|
7
|
+
## 0.1.0
|
8
|
+
|
9
|
+
* Fix RedisWorkerId's worker_id handling
|
10
|
+
* Release old worker_id only if it is before ttl
|
11
|
+
* Add required_options to generators
|
12
|
+
|
13
|
+
## 0.0.4
|
14
|
+
|
15
|
+
* [redis_worker_id generator] Release current worker_id before reaching real ttl
|
16
|
+
|
3
17
|
## 0.0.3
|
4
18
|
|
5
19
|
* Fix critical bug on redis_worker_id generator
|
data/Gemfile
CHANGED
@@ -2,3 +2,17 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in barrage.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
|
7
|
+
gem "activesupport", "< 5.0.0"
|
8
|
+
end
|
9
|
+
|
10
|
+
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.3")
|
11
|
+
gem "listen", "< 3.1.0"
|
12
|
+
end
|
13
|
+
|
14
|
+
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.5")
|
15
|
+
gem "ruby_dep", "< 1.4.0"
|
16
|
+
end
|
17
|
+
|
18
|
+
gem "redis", ">= 4.0.0"
|
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec,
|
5
|
+
cmd: "bundle exec rspec",
|
6
|
+
all_after_pass: true,
|
7
|
+
all_on_start: true do
|
8
|
+
watch(%r{^spec/.+_spec\.rb$})
|
9
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
10
|
+
watch('spec/spec_helper.rb') { "spec" }
|
11
|
+
end
|
data/README.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Barrage
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/barrage)
|
4
|
+
[](https://gemnasium.com/drecom/barrage)
|
5
|
+
[](https://coveralls.io/r/drecom/barrage)
|
6
|
+
[](https://travis-ci.org/drecom/barrage)
|
7
|
+
[](https://codeclimate.com/github/drecom/barrage)
|
8
|
+
|
3
9
|
Distributed ID generator(like twitter/snowflake)
|
4
10
|
|
5
11
|
## Installation
|
@@ -34,13 +40,15 @@ barrage = Barrage.new(
|
|
34
40
|
]
|
35
41
|
)
|
36
42
|
barrage.next
|
37
|
-
# => Generated ID
|
43
|
+
# => Generated 64bit ID
|
38
44
|
```
|
39
45
|
|
40
46
|
### Generators
|
41
47
|
|
42
48
|
#### msec
|
43
49
|
#### redis_worker_id
|
50
|
+
requirement: redis 2.6+
|
51
|
+
|
44
52
|
#### sequence
|
45
53
|
|
46
54
|
### Creating your own generator
|
@@ -48,13 +56,14 @@ barrage.next
|
|
48
56
|
```ruby
|
49
57
|
module Barrage::Generators
|
50
58
|
class YourOwnGenerator < Base
|
59
|
+
self.required_options += %w(your_option_value)
|
51
60
|
def generate
|
52
|
-
|
53
|
-
|
61
|
+
# generated code
|
62
|
+
end
|
54
63
|
|
55
64
|
def your_option_value
|
56
|
-
|
57
|
-
|
65
|
+
options["your_option_value"]
|
66
|
+
end
|
58
67
|
end
|
59
68
|
end
|
60
69
|
|
data/barrage.gemspec
CHANGED
@@ -22,8 +22,12 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.6"
|
24
24
|
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "rspec", "3.
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.5.0"
|
26
|
+
spec.add_development_dependency "rspec-its"
|
26
27
|
spec.add_development_dependency "pry"
|
27
28
|
spec.add_development_dependency "guard-rspec"
|
28
29
|
spec.add_development_dependency "redis"
|
30
|
+
spec.add_development_dependency "fakeredis"
|
31
|
+
spec.add_development_dependency "delorean"
|
32
|
+
spec.add_development_dependency "coveralls"
|
29
33
|
end
|
@@ -1,9 +1,18 @@
|
|
1
|
+
require 'barrage/generators'
|
2
|
+
require 'active_support/core_ext/class/attribute'
|
3
|
+
|
1
4
|
class Barrage
|
2
5
|
module Generators
|
3
6
|
class Base
|
4
7
|
attr_reader :options
|
8
|
+
class_attribute :required_options, :available_options
|
9
|
+
self.required_options = %w(length)
|
10
|
+
self.available_options = []
|
5
11
|
|
6
12
|
def initialize(options = {})
|
13
|
+
if (missing = missing_required_options(options)) && !missing.empty?
|
14
|
+
raise ArgumentError, "Missing Required options: #{missing.join(', ')}"
|
15
|
+
end
|
7
16
|
@options = options
|
8
17
|
end
|
9
18
|
|
@@ -18,6 +27,12 @@ class Barrage
|
|
18
27
|
def current
|
19
28
|
raise NotImplemented, "Please Override"
|
20
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def missing_required_options(given_options)
|
34
|
+
required_options.reject { |k| given_options.has_key?(k) }
|
35
|
+
end
|
21
36
|
end
|
22
37
|
end
|
23
38
|
end
|
@@ -5,10 +5,12 @@ class Barrage
|
|
5
5
|
module Generators
|
6
6
|
class RedisWorkerId < Base
|
7
7
|
RACE_CONDITION_TTL = 30
|
8
|
+
self.required_options += %w(ttl)
|
8
9
|
|
9
10
|
def initialize(options = {})
|
10
11
|
@worker_id = nil
|
11
12
|
@worker_ttl = 0
|
13
|
+
@real_ttl = 0
|
12
14
|
super
|
13
15
|
@data = []
|
14
16
|
@finalizer_proc = Finalizer.new(@data)
|
@@ -19,21 +21,23 @@ class Barrage
|
|
19
21
|
now = Time.now.to_i
|
20
22
|
if @worker_ttl - now <= 0
|
21
23
|
@data[1] = @worker_id = renew_worker_id
|
22
|
-
# check redis
|
24
|
+
# check redis after half of real ttl
|
23
25
|
@worker_ttl = now + ttl / 2
|
26
|
+
@real_ttl = now + ttl
|
27
|
+
@data[2] = @real_ttl
|
24
28
|
end
|
25
29
|
@worker_id
|
26
30
|
end
|
27
31
|
alias_method :current, :generate
|
28
32
|
|
29
|
-
def redis
|
30
|
-
@redis ||= @data[0] = Redis.new(options["redis"] || {})
|
31
|
-
end
|
32
|
-
|
33
33
|
def ttl
|
34
34
|
options["ttl"]
|
35
35
|
end
|
36
36
|
|
37
|
+
def redis
|
38
|
+
@redis ||= @data[0] = Redis.new(options["redis"] || {})
|
39
|
+
end
|
40
|
+
|
37
41
|
class Finalizer
|
38
42
|
def initialize(data)
|
39
43
|
@pid = $$
|
@@ -42,11 +46,11 @@ class Barrage
|
|
42
46
|
|
43
47
|
def call(*args)
|
44
48
|
return if @pid != $$
|
45
|
-
redis, worker_id = *@data
|
49
|
+
redis, worker_id, real_ttl = *@data
|
46
50
|
|
47
51
|
if redis.is_a?(Redis) and redis.connected?
|
48
|
-
redis.del("barrage:worker:#{worker_id}")
|
49
|
-
redis.
|
52
|
+
redis.del("barrage:worker:#{worker_id}") if real_ttl > Time.now.to_i
|
53
|
+
redis._client.disconnect
|
50
54
|
end
|
51
55
|
end
|
52
56
|
end
|
@@ -54,33 +58,47 @@ class Barrage
|
|
54
58
|
private
|
55
59
|
|
56
60
|
def renew_worker_id
|
61
|
+
if @real_ttl - Time.now.to_i - RACE_CONDITION_TTL <= 0
|
62
|
+
@worker_id = nil
|
63
|
+
end
|
57
64
|
new_worker_id = redis.evalsha(
|
58
65
|
script_sha,
|
59
66
|
argv: [2 ** length, rand(2 ** length), @worker_id, ttl, RACE_CONDITION_TTL]
|
60
|
-
)
|
61
|
-
new_worker_id
|
67
|
+
)
|
68
|
+
new_worker_id or raise StandardError, "Renew redis worker id failed"
|
69
|
+
return new_worker_id.to_i
|
62
70
|
end
|
63
71
|
|
64
72
|
def script_sha
|
65
73
|
@script_sha ||=
|
66
74
|
redis.script(:load, <<-EOF.gsub(/^ {12}/, ''))
|
67
|
-
local max_value = ARGV[1]
|
75
|
+
local max_value = tonumber(ARGV[1])
|
68
76
|
local new_worker_id = ARGV[2]
|
69
77
|
local old_worker_id = ARGV[3]
|
70
|
-
local ttl = ARGV[4]
|
71
|
-
local race_condition_ttl = ARGV[5]
|
78
|
+
local ttl = tonumber(ARGV[4])
|
79
|
+
local race_condition_ttl = tonumber(ARGV[5])
|
80
|
+
local loop_cnt = 0
|
81
|
+
|
82
|
+
local worker_id = nil
|
83
|
+
local candidate_worker_id = tonumber(new_worker_id)
|
72
84
|
|
73
85
|
if type(old_worker_id) == "string" and string.len(old_worker_id) > 0 and redis.call('EXISTS', "barrage:worker:" .. old_worker_id) == 1 then
|
74
86
|
redis.call("EXPIRE", "barrage:worker:" .. old_worker_id, ttl + race_condition_ttl)
|
75
|
-
|
87
|
+
worker_id = old_worker_id
|
76
88
|
else
|
77
|
-
while redis.call("SETNX", "barrage:worker:" ..
|
89
|
+
while redis.call("SETNX", "barrage:worker:" .. candidate_worker_id, 1) == 0 and loop_cnt < max_value
|
78
90
|
do
|
79
|
-
|
91
|
+
candidate_worker_id = (candidate_worker_id + 1) % max_value
|
92
|
+
loop_cnt = loop_cnt + 1
|
93
|
+
end
|
94
|
+
if loop_cnt >= max_value then
|
95
|
+
return nil
|
96
|
+
else
|
97
|
+
worker_id = candidate_worker_id
|
80
98
|
end
|
81
|
-
redis.call("EXPIRE", "barrage:worker:" ..
|
99
|
+
redis.call("EXPIRE", "barrage:worker:" .. worker_id, ttl + race_condition_ttl)
|
82
100
|
end
|
83
|
-
return
|
101
|
+
return worker_id
|
84
102
|
EOF
|
85
103
|
end
|
86
104
|
end
|
data/lib/barrage/version.rb
CHANGED
data/lib/barrage.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'barrage/generators/msec'
|
3
|
+
|
4
|
+
describe Barrage::Generators::Msec do
|
5
|
+
context "When initialized" do
|
6
|
+
subject { described_class.new(options) }
|
7
|
+
|
8
|
+
context "with empty hash" do
|
9
|
+
let(:options) { {} }
|
10
|
+
|
11
|
+
it { expect { subject }.to raise_error(ArgumentError) }
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with required options" do
|
15
|
+
let(:options) { {"length" => 16, "start_at" => (Time.now.to_f * 1000).round } }
|
16
|
+
|
17
|
+
it { is_expected.to be_instance_of(Barrage::Generators::Msec) }
|
18
|
+
its(:length) { is_expected.to eq(options["length"]) }
|
19
|
+
its(:start_at) { is_expected.to eq(options["start_at"]) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#generate" do
|
24
|
+
subject { described_class.new(options).generate }
|
25
|
+
let(:length) { 39 }
|
26
|
+
let(:start_at) { (Time.parse("2014-01-01 00:00:00").to_f*1000).round }
|
27
|
+
let(:options) { {"length" => length, "start_at" => start_at} }
|
28
|
+
|
29
|
+
it { is_expected.to be_instance_of(Fixnum) }
|
30
|
+
it { is_expected.to be < 2 ** length }
|
31
|
+
|
32
|
+
context "generate two numbers between 10 millisecond " do
|
33
|
+
subject { described_class.new(options) }
|
34
|
+
|
35
|
+
it "numbers difference that generated in interval 10 millisecond should exactly 10" do
|
36
|
+
t = Time.parse("2014-01-01 00:00:00")
|
37
|
+
first = time_travel_to(t) { subject.generate }
|
38
|
+
second = time_travel_to(Time.at(t.to_i, 10000)) { subject.generate }
|
39
|
+
expect(second - first).to eq(10)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'barrage/generators/redis_worker_id'
|
3
|
+
|
4
|
+
describe Barrage::Generators::RedisWorkerId do
|
5
|
+
context "When initialized" do
|
6
|
+
subject { described_class.new(options) }
|
7
|
+
|
8
|
+
context "with empty hash" do
|
9
|
+
let(:options) { {} }
|
10
|
+
|
11
|
+
it { expect { subject }.to raise_error(ArgumentError) }
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with required options" do
|
15
|
+
let(:options) { {"length" => 16, "ttl" => 300} }
|
16
|
+
|
17
|
+
it { is_expected.to be_instance_of(Barrage::Generators::RedisWorkerId) }
|
18
|
+
its(:length) { is_expected.to eq(options["length"]) }
|
19
|
+
its(:ttl) { is_expected.to eq(options["ttl"]) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#generate" do
|
24
|
+
subject { described_class.new(options).generate }
|
25
|
+
let(:length) { 8 }
|
26
|
+
let(:ttl) { 300 }
|
27
|
+
let(:options) { {"length" => length, "ttl" => ttl} }
|
28
|
+
|
29
|
+
it { is_expected.to be_instance_of(Fixnum) }
|
30
|
+
it { is_expected.to be < 2 ** length }
|
31
|
+
|
32
|
+
context "on many instances" do
|
33
|
+
subject { 64.times.map { described_class.new(options) } }
|
34
|
+
let(:length) { 8 }
|
35
|
+
|
36
|
+
it "should generate unique numbers" do
|
37
|
+
numbers = subject.map(&:generate)
|
38
|
+
expect(numbers.size).to eq(numbers.uniq.size)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "generates numbers should less than length" do
|
42
|
+
expect(subject.all? { |s| s.generate < (2 ** length) }).to be true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#Finalizer" do
|
48
|
+
subject { described_class::Finalizer.new(data).call(*args) }
|
49
|
+
|
50
|
+
before do
|
51
|
+
redis._client.connect
|
52
|
+
end
|
53
|
+
let(:now) { Time.now.to_i }
|
54
|
+
let(:ttl) { 300 }
|
55
|
+
let(:redis) { Redis.new }
|
56
|
+
let(:worker_ttl) { now + ttl / 2 }
|
57
|
+
let(:real_ttl) { now + ttl }
|
58
|
+
let(:data) { [redis, worker_ttl, real_ttl] }
|
59
|
+
let(:args) { {} }
|
60
|
+
|
61
|
+
it "redis client disconnect" do
|
62
|
+
subject
|
63
|
+
expect(redis.connected?).to eq false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'barrage/generators/sequence'
|
3
|
+
|
4
|
+
describe Barrage::Generators::Sequence do
|
5
|
+
context "When initialized" do
|
6
|
+
subject { described_class.new(options) }
|
7
|
+
|
8
|
+
context "with empty hash" do
|
9
|
+
let(:options) { {} }
|
10
|
+
|
11
|
+
it { expect { subject }.to raise_error(ArgumentError) }
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with required options" do
|
15
|
+
let(:options) { {"length" => 16 } }
|
16
|
+
|
17
|
+
it { is_expected.to be_instance_of(Barrage::Generators::Sequence) }
|
18
|
+
its(:length) { is_expected.to eq(options["length"]) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#generate" do
|
23
|
+
subject { described_class.new(options).generate }
|
24
|
+
let(:length) { 9 }
|
25
|
+
let(:options) { {"length" => length } }
|
26
|
+
|
27
|
+
it { is_expected.to be_instance_of(Fixnum) }
|
28
|
+
it { is_expected.to be < 2 ** length }
|
29
|
+
|
30
|
+
context "When sequence is 0" do
|
31
|
+
before do
|
32
|
+
subject.instance_variable_set(:@sequence, 0)
|
33
|
+
end
|
34
|
+
subject { described_class.new(options) }
|
35
|
+
|
36
|
+
it "should generates '1'" do
|
37
|
+
expect(subject.generate).to eq(1)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "if generate twice in a row, generated numbers should be in succession" do
|
41
|
+
first = subject.generate
|
42
|
+
second = subject.generate
|
43
|
+
expect(first.succ).to eq(second)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "When sequence is max" do
|
48
|
+
before do
|
49
|
+
subject.instance_variable_set(:@sequence, (2 ** length) - 1)
|
50
|
+
end
|
51
|
+
subject { described_class.new(options) }
|
52
|
+
|
53
|
+
it "should generates zero" do
|
54
|
+
expect(subject.generate).to be_zero
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/spec/barrage_spec.rb
CHANGED
@@ -4,4 +4,45 @@ describe Barrage do
|
|
4
4
|
it 'has a version number' do
|
5
5
|
expect(Barrage::VERSION).not_to be nil
|
6
6
|
end
|
7
|
+
|
8
|
+
context "when initialized" do
|
9
|
+
subject { Barrage.new(options) }
|
10
|
+
|
11
|
+
context "with empty generators" do
|
12
|
+
let(:options) { {"generators" => []} }
|
13
|
+
its(:generators) { is_expected.to be_empty }
|
14
|
+
end
|
15
|
+
|
16
|
+
context "with generators" do
|
17
|
+
let(:options) {
|
18
|
+
{
|
19
|
+
"generators" => [
|
20
|
+
{"name" => "msec", "length" => 39, "start_at" => 1396278000000},
|
21
|
+
{"name" => "redis_worker_id", "length" => 16, "ttl" => 300},
|
22
|
+
{"name" => "sequence", "length" => 9}
|
23
|
+
]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
it { expect(subject.generators.size).to eq(options["generators"].size) }
|
27
|
+
its(:generators) {
|
28
|
+
is_expected.to contain_exactly(
|
29
|
+
be_kind_of(Barrage::Generators::Msec),
|
30
|
+
be_kind_of(Barrage::Generators::RedisWorkerId),
|
31
|
+
be_kind_of(Barrage::Generators::Sequence)
|
32
|
+
)
|
33
|
+
}
|
34
|
+
|
35
|
+
describe "#generate" do
|
36
|
+
let(:barrage) { described_class.new(options) }
|
37
|
+
subject { barrage.generate }
|
38
|
+
it { is_expected.to be_kind_of(Integer) }
|
39
|
+
it { is_expected.to be < 2 ** barrage.length }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#length" do
|
43
|
+
subject { described_class.new(options).length }
|
44
|
+
it { is_expected.to eq(options["generators"].map { |h| h["length"]}.inject(:+)) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
7
48
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'rspec/its'
|
4
|
+
require 'delorean'
|
5
|
+
|
6
|
+
require 'coveralls'
|
7
|
+
Coveralls.wear!
|
8
|
+
|
2
9
|
require 'barrage'
|
3
10
|
|
4
11
|
RSpec.configure do |config|
|
12
|
+
include Delorean
|
5
13
|
config.filter_run focus: true
|
6
|
-
config.run_all_when_everything_filtered
|
14
|
+
config.run_all_when_everything_filtered = true
|
7
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barrage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gussan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -56,16 +56,30 @@ dependencies:
|
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
61
|
+
version: 3.5.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: 3.
|
68
|
+
version: 3.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-its
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: pry
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,48 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fakeredis
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: delorean
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: coveralls
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
111
167
|
description: Distributed id generator
|
112
168
|
email:
|
113
169
|
- egussan@gmail.com
|
@@ -120,6 +176,7 @@ files:
|
|
120
176
|
- ".travis.yml"
|
121
177
|
- CHANGELOG.md
|
122
178
|
- Gemfile
|
179
|
+
- Guardfile
|
123
180
|
- LICENSE.txt
|
124
181
|
- README.md
|
125
182
|
- Rakefile
|
@@ -133,13 +190,16 @@ files:
|
|
133
190
|
- lib/barrage/generators/sequence.rb
|
134
191
|
- lib/barrage/generators/timestamp.rb
|
135
192
|
- lib/barrage/version.rb
|
193
|
+
- spec/barrage/generators/msec_spec.rb
|
194
|
+
- spec/barrage/generators/redis_worker_id_spec.rb
|
195
|
+
- spec/barrage/generators/sequence_spec.rb
|
136
196
|
- spec/barrage_spec.rb
|
137
197
|
- spec/spec_helper.rb
|
138
198
|
homepage: http://github.com/drecom/barrage
|
139
199
|
licenses:
|
140
200
|
- MIT
|
141
201
|
metadata: {}
|
142
|
-
post_install_message:
|
202
|
+
post_install_message:
|
143
203
|
rdoc_options: []
|
144
204
|
require_paths:
|
145
205
|
- lib
|
@@ -154,11 +214,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
214
|
- !ruby/object:Gem::Version
|
155
215
|
version: '0'
|
156
216
|
requirements: []
|
157
|
-
|
158
|
-
|
159
|
-
signing_key:
|
217
|
+
rubygems_version: 3.0.3
|
218
|
+
signing_key:
|
160
219
|
specification_version: 4
|
161
220
|
summary: Distributed id generator
|
162
221
|
test_files:
|
222
|
+
- spec/barrage/generators/msec_spec.rb
|
223
|
+
- spec/barrage/generators/redis_worker_id_spec.rb
|
224
|
+
- spec/barrage/generators/sequence_spec.rb
|
163
225
|
- spec/barrage_spec.rb
|
164
226
|
- spec/spec_helper.rb
|