ffwd 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ffwd/handler.rb CHANGED
@@ -18,6 +18,8 @@ require_relative 'connection'
18
18
  module FFWD
19
19
  # Handlers are used by output plugins based of the protocol stack.
20
20
  class Handler < FFWD::Connection
21
+ attr_accessor :parent
22
+
21
23
  def self.new signature, parent, *args
22
24
  instance = super(signature, *args)
23
25
 
@@ -36,6 +38,7 @@ module FFWD
36
38
  @parent.connection_completed
37
39
  end
38
40
 
41
+ def close; end
39
42
  def send_all events, metrics; end
40
43
  def send_event event; end
41
44
  def send_metric metric; end
@@ -20,6 +20,8 @@ module FFWD::UDP
20
20
  class Connect
21
21
  include FFWD::Reporter
22
22
 
23
+ RESOLVE_TIMEOUT = 10
24
+
23
25
  attr_reader :reporter_meta, :log
24
26
 
25
27
  setup_reporter :keys => [
@@ -38,20 +40,21 @@ module FFWD::UDP
38
40
  @c = nil
39
41
  @peer = "#{host}:#{port}"
40
42
  @reporter_meta = {
41
- :type => @handler.name, :peer => peer
43
+ :type => @handler.plugin_type, :peer => @peer
42
44
  }
43
45
 
44
46
  info = "udp://#{@peer}"
45
47
 
46
48
  subs = []
47
49
 
48
- r = FFWD.retry :timeout => resolve_timeout do |a|
50
+ r = FFWD.retry :timeout => RESOLVE_TIMEOUT do |a|
49
51
  unless @host_ip
50
52
  @host_ip = resolve_ip @host
51
53
  raise "Could not resolve: #{@host}" if @host_ip.nil?
52
54
  end
53
55
 
54
- @c = EM.open_datagram_socket(@bind_host, nil)
56
+ @c = EM.open_datagram_socket(@bind_host, nil, @handler, self)
57
+
55
58
  log.info "Setup of output to #{info} successful"
56
59
 
57
60
  subs << core.output.event_subscribe{|e| handle_event e}
@@ -74,6 +77,14 @@ module FFWD::UDP
74
77
  end
75
78
  end
76
79
 
80
+ def send_data data
81
+ return unless @c
82
+ @c.send_datagram data, @host_ip, @port
83
+ end
84
+
85
+ def unbind; end
86
+ def connection_completed; end
87
+
77
88
  private
78
89
 
79
90
  def handle_event event
@@ -82,8 +93,7 @@ module FFWD::UDP
82
93
  return
83
94
  end
84
95
 
85
- data = @handler.serialize_event event
86
- @c.send_datagram data, @host_ip, @port
96
+ @c.send_event event
87
97
  increment :sent_events, 1
88
98
  end
89
99
 
@@ -93,8 +103,7 @@ module FFWD::UDP
93
103
  return
94
104
  end
95
105
 
96
- data = @handler.serialize_metric metric
97
- @c.send_datagram data, @host_ip, @port
106
+ @c.send_metric metric
98
107
  increment :sent_metrics, 1
99
108
  end
100
109
 
data/lib/ffwd/version.rb CHANGED
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module FFWD
17
- VERSION = "0.1.6"
17
+ VERSION = "0.1.7"
18
18
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffwd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - John-John Tedro
@@ -9,62 +10,70 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-04-29 00:00:00.000000000 Z
13
+ date: 2014-05-30 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: eventmachine
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - '>='
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '0'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - '>='
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '0'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: rspec
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - '>='
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: '0'
35
39
  type: :development
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - '>='
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: '0'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: rspec-mocks
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - '>='
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: '0'
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - '>='
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: autoversion
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - '>='
68
+ - - ! '>='
61
69
  - !ruby/object:Gem::Version
62
70
  version: '0'
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
- - - '>='
76
+ - - ! '>='
68
77
  - !ruby/object:Gem::Version
69
78
  version: '0'
70
79
  description:
@@ -77,88 +86,89 @@ executables:
77
86
  extensions: []
78
87
  extra_rdoc_files: []
79
88
  files:
80
- - bin/fwc
81
89
  - bin/ffwd
82
- - lib/fwc.rb
83
- - lib/ffwd.rb
84
- - lib/ffwd/statistics.rb
85
- - lib/ffwd/processor.rb
90
+ - bin/fwc
86
91
  - lib/ffwd/producing_client.rb
87
- - lib/ffwd/tunnel.rb
88
- - lib/ffwd/protocol.rb
92
+ - lib/ffwd/tunnel/udp.rb
93
+ - lib/ffwd/tunnel/plugin.rb
94
+ - lib/ffwd/tunnel/tcp.rb
89
95
  - lib/ffwd/lifecycle.rb
90
- - lib/ffwd/debug/tcp.rb
91
- - lib/ffwd/debug/connection.rb
92
- - lib/ffwd/debug/monitor_session.rb
93
- - lib/ffwd/channel.rb
94
- - lib/ffwd/plugin/json.rb
95
- - lib/ffwd/plugin/log/writer.rb
96
- - lib/ffwd/plugin/log.rb
97
- - lib/ffwd/plugin/json/connection.rb
98
- - lib/ffwd/circular_buffer.rb
99
- - lib/ffwd/event.rb
100
- - lib/ffwd/statistics/system_statistics.rb
96
+ - lib/ffwd/logging.rb
97
+ - lib/ffwd/metric.rb
98
+ - lib/ffwd/schema.rb
99
+ - lib/ffwd/version.rb
101
100
  - lib/ffwd/statistics/collector.rb
102
- - lib/ffwd/connection.rb
101
+ - lib/ffwd/statistics/system_statistics.rb
103
102
  - lib/ffwd/utils.rb
104
- - lib/ffwd/protocol/tcp.rb
103
+ - lib/ffwd/protocol/udp.rb
105
104
  - lib/ffwd/protocol/tcp/bind.rb
106
- - lib/ffwd/protocol/tcp/plain_connect.rb
107
105
  - lib/ffwd/protocol/tcp/flushing_connect.rb
106
+ - lib/ffwd/protocol/tcp/plain_connect.rb
108
107
  - lib/ffwd/protocol/tcp/connection.rb
108
+ - lib/ffwd/protocol/tcp.rb
109
109
  - lib/ffwd/protocol/udp/bind.rb
110
110
  - lib/ffwd/protocol/udp/connect.rb
111
- - lib/ffwd/protocol/udp.rb
112
- - lib/ffwd/reporter.rb
113
- - lib/ffwd/plugin_loader.rb
114
- - lib/ffwd/schema/spotify100.rb
115
- - lib/ffwd/schema/default.rb
116
- - lib/ffwd/metric_emitter.rb
117
- - lib/ffwd/schema.rb
118
- - lib/ffwd/event_emitter.rb
119
- - lib/ffwd/core/processor.rb
111
+ - lib/ffwd/plugin/log/writer.rb
112
+ - lib/ffwd/plugin/log.rb
113
+ - lib/ffwd/plugin/json.rb
114
+ - lib/ffwd/plugin/json/connection.rb
115
+ - lib/ffwd/handler.rb
116
+ - lib/ffwd/protocol.rb
117
+ - lib/ffwd/plugin.rb
118
+ - lib/ffwd/debug.rb
119
+ - lib/ffwd/event.rb
120
+ - lib/ffwd/processor.rb
121
+ - lib/ffwd/debug/monitor_session.rb
122
+ - lib/ffwd/debug/tcp.rb
123
+ - lib/ffwd/debug/connection.rb
124
+ - lib/ffwd/channel.rb
125
+ - lib/ffwd/circular_buffer.rb
120
126
  - lib/ffwd/core/interface.rb
121
- - lib/ffwd/core/reporter.rb
122
127
  - lib/ffwd/core/emitter.rb
123
- - lib/ffwd/handler.rb
124
- - lib/ffwd/version.rb
128
+ - lib/ffwd/core/processor.rb
129
+ - lib/ffwd/core/reporter.rb
125
130
  - lib/ffwd/core.rb
126
- - lib/ffwd/processor/rate.rb
131
+ - lib/ffwd/plugin_channel.rb
132
+ - lib/ffwd/plugin_loader.rb
133
+ - lib/ffwd/reporter.rb
134
+ - lib/ffwd/metric_emitter.rb
135
+ - lib/ffwd/statistics.rb
136
+ - lib/ffwd/schema/spotify100.rb
137
+ - lib/ffwd/schema/default.rb
138
+ - lib/ffwd/retrier.rb
139
+ - lib/ffwd/tunnel.rb
127
140
  - lib/ffwd/processor/count.rb
128
141
  - lib/ffwd/processor/histogram.rb
129
- - lib/ffwd/debug.rb
130
- - lib/ffwd/retrier.rb
131
- - lib/ffwd/logging.rb
132
- - lib/ffwd/plugin_channel.rb
133
- - lib/ffwd/tunnel/tcp.rb
134
- - lib/ffwd/tunnel/udp.rb
135
- - lib/ffwd/tunnel/plugin.rb
136
- - lib/ffwd/plugin.rb
137
- - lib/ffwd/metric.rb
142
+ - lib/ffwd/processor/rate.rb
143
+ - lib/ffwd/event_emitter.rb
144
+ - lib/ffwd/connection.rb
145
+ - lib/ffwd.rb
138
146
  - lib/em/protocols/frame_object_protocol.rb
139
147
  - lib/em/all.rb
148
+ - lib/fwc.rb
140
149
  homepage: https://github.com/spotify/ffwd
141
150
  licenses:
142
151
  - Apache 2.0
143
- metadata: {}
144
152
  post_install_message:
145
153
  rdoc_options: []
146
154
  require_paths:
147
155
  - lib
148
156
  required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
149
158
  requirements:
150
- - - '>='
159
+ - - ! '>='
151
160
  - !ruby/object:Gem::Version
152
161
  version: '0'
153
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
154
164
  requirements:
155
- - - '>='
165
+ - - ! '>='
156
166
  - !ruby/object:Gem::Version
157
167
  version: '0'
158
168
  requirements: []
159
169
  rubyforge_project:
160
- rubygems_version: 2.0.3
170
+ rubygems_version: 1.8.23
161
171
  signing_key:
162
- specification_version: 4
172
+ specification_version: 3
163
173
  summary: Core framework for the FastForward Daemon.
164
174
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 51775a59c73dd9be7d21c447c82b07114e9d8873
4
- data.tar.gz: 0ea15ca035581520ede8c982abba0b91693b9faf
5
- SHA512:
6
- metadata.gz: 0eed13b83347cf1bec2d5b31b1a3a91d453d7108dc04a1f7e86910ec1751fb31f9b82f92343a8a25728a0c8da63740e36bfb8b1a488d7d42d95d2762fa29b410
7
- data.tar.gz: de52f3fa7891f164f457683cd5536f07c5ed9a1ffe098198605a3a8c51660966c19ddc0adb8037472d03ff645b0230fc97f132f2fe9c64b6c9acd88a7e6a699c