nsq-cluster 0.1.1 → 0.1.2
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/.ruby-version +1 -1
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/nsq-cluster.rb +5 -4
- data/lib/nsq-cluster/nsqd.rb +4 -2
- data/lib/nsq-cluster/nsqlookupd.rb +4 -2
- data/nsq-cluster.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4e1c18926766a3b124a0e962e60b9395f0330e
|
4
|
+
data.tar.gz: 9fc20529ef3b4d5c58e82e43617bb679d52327f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0d65780e1ff49e975ebb9450ada77d62551dcd405d1c030970fe84c0446d75e920a545359c5f05a04f7809887de5f79fe6318f35bb6e92a93ba7c7ca87ef550
|
7
|
+
data.tar.gz: 3e979a9a31a934cfd093bf4fa8dbcf14dc90960659c2d9129e9957a07207ba70c042fde6fafec1db99165b3d0a543f56ae16f816d85f796acccfb68a7c179d1f
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.1.
|
1
|
+
ruby-2.1.2
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/nsq-cluster.rb
CHANGED
@@ -22,6 +22,7 @@ class NsqCluster
|
|
22
22
|
def initialize(opts = {})
|
23
23
|
opts = {
|
24
24
|
nsqlookupd_count: 0,
|
25
|
+
nsqdlookupd_options: {},
|
25
26
|
nsqd_count: 0,
|
26
27
|
nsqadmin: false,
|
27
28
|
nsqd_options: {},
|
@@ -30,7 +31,7 @@ class NsqCluster
|
|
30
31
|
|
31
32
|
@silent = opts[:silent]
|
32
33
|
|
33
|
-
@nsqlookupd = create_nsqlookupds(opts[:nsqlookupd_count])
|
34
|
+
@nsqlookupd = create_nsqlookupds(opts[:nsqlookupd_count], opts[:nsqdlookupd_options])
|
34
35
|
@nsqd = create_nsqds(opts[:nsqd_count], opts[:nsqd_options])
|
35
36
|
@nsqadmin = create_nsqadmin if opts[:nsqadmin]
|
36
37
|
|
@@ -39,13 +40,13 @@ class NsqCluster
|
|
39
40
|
end
|
40
41
|
|
41
42
|
|
42
|
-
def create_nsqlookupds(count)
|
43
|
+
def create_nsqlookupds(count, options)
|
43
44
|
(0...count).map do |idx|
|
44
|
-
Nsqlookupd.new(
|
45
|
+
Nsqlookupd.new(options.merge({
|
45
46
|
tcp_port: 4160 + idx * 2,
|
46
47
|
http_port: 4161 + idx * 2,
|
47
48
|
silent: @silent
|
48
|
-
)
|
49
|
+
}))
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
data/lib/nsq-cluster/nsqd.rb
CHANGED
@@ -10,11 +10,12 @@ class Nsqd < ProcessWrapper
|
|
10
10
|
|
11
11
|
|
12
12
|
def initialize(opts = {})
|
13
|
-
@host = '127.0.0.1'
|
13
|
+
@host = opts[:host] || '127.0.0.1'
|
14
14
|
@tcp_port = opts[:tcp_port] || 4150
|
15
15
|
@http_port = opts[:http_port] || 4151
|
16
16
|
@lookupd = opts[:nsqlookupd] || []
|
17
17
|
@msg_timeout = opts[:msg_timeout] || '60s'
|
18
|
+
@broadcast_address = opts[:broadcast_address] || @host
|
18
19
|
|
19
20
|
clear_data_directory
|
20
21
|
create_data_directory
|
@@ -40,7 +41,8 @@ class Nsqd < ProcessWrapper
|
|
40
41
|
%Q(--http-address=#{@host}:#{@http_port}),
|
41
42
|
%Q(--data-path=#{data_path}),
|
42
43
|
%Q(--worker-id=#{worker_id}),
|
43
|
-
%Q(--msg-timeout=#{@msg_timeout})
|
44
|
+
%Q(--msg-timeout=#{@msg_timeout}),
|
45
|
+
%Q(--broadcast-address=#{@broadcast_address})
|
44
46
|
]
|
45
47
|
|
46
48
|
lookupd_args = @lookupd.map do |ld|
|
@@ -7,9 +7,10 @@ class Nsqlookupd < ProcessWrapper
|
|
7
7
|
attr_reader :host, :tcp_port, :http_port
|
8
8
|
|
9
9
|
def initialize(opts = {})
|
10
|
-
@host = '127.0.0.1'
|
10
|
+
@host = opts[:host] || '127.0.0.1'
|
11
11
|
@tcp_port = opts[:tcp_port] || 4160
|
12
12
|
@http_port = opts[:http_port] || 4161
|
13
|
+
@broadcast_address = opts[:broadcast_address] || @host
|
13
14
|
|
14
15
|
super
|
15
16
|
end
|
@@ -23,7 +24,8 @@ class Nsqlookupd < ProcessWrapper
|
|
23
24
|
def args
|
24
25
|
[
|
25
26
|
%Q(--tcp-address=#{@host}:#{@tcp_port}),
|
26
|
-
%Q(--http-address=#{@host}:#{@http_port})
|
27
|
+
%Q(--http-address=#{@host}:#{@http_port}),
|
28
|
+
%Q(--broadcast-address=#{@broadcast_address})
|
27
29
|
]
|
28
30
|
end
|
29
31
|
|
data/nsq-cluster.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: nsq-cluster 0.1.
|
5
|
+
# stub: nsq-cluster 0.1.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nsq-cluster"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Brendan Schwartz"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-07-17"
|
15
15
|
s.description = "Setup nsqd, nsqlookupd, and nsqadmin in a jiffy. Great for testing!"
|
16
16
|
s.email = "brendan@wistia.com"
|
17
17
|
s.executables = ["nsq-cluster"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nsq-cluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendan Schwartz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nsq-cluster
|