ffwd 0.1.5 → 0.1.6

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDVjYzRkYTc0NTYwNTJmMTBlOWM1ZDU1YWRjODM2ODQ1ZjMxMGEzOA==
5
- data.tar.gz: !binary |-
6
- ZDFiNGFkOTM3NmZmZGYyMTEwZDc5YmI2NDNjYTMwNGMwNDg0ZDk4Yw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NDY3YmI4NjJiMTRjZDAxZmNjMWYxZTg2NGUxM2VhYzhkOWI0OThiZDA1MTdm
10
- NjBjNTk0YjZmZWFhMjI1ZmUwMjJmMDI0ZmExNmU0OTE3MjM2OWNkMWNiNzkz
11
- ZWMyNWNmOWJkMjMzZDhkODllMjdmMzVhZjc4MWQ2NTE5YTIwNGY=
12
- data.tar.gz: !binary |-
13
- ZWQ1NDRjOTljNTE3ZWY0NzNjMTNjNTM2NmUzYTE2NjE5YmRiNWY3NjkxZWYx
14
- MDczNmViZTBlYjVjNjA2Mjg5Y2VjZDNjNGFkODI2NDU4MjE5Yjk3NTBmNjMy
15
- OWZjODA0NGQ5ZmQ1OTFkM2U4ZjEzZGMwYTcyYmMxOWI3ZWYyMWU=
2
+ SHA1:
3
+ metadata.gz: 51775a59c73dd9be7d21c447c82b07114e9d8873
4
+ data.tar.gz: 0ea15ca035581520ede8c982abba0b91693b9faf
5
+ SHA512:
6
+ metadata.gz: 0eed13b83347cf1bec2d5b31b1a3a91d453d7108dc04a1f7e86910ec1751fb31f9b82f92343a8a25728a0c8da63740e36bfb8b1a488d7d42d95d2762fa29b410
7
+ data.tar.gz: de52f3fa7891f164f457683cd5536f07c5ed9a1ffe098198605a3a8c51660966c19ddc0adb8037472d03ff645b0230fc97f132f2fe9c64b6c9acd88a7e6a699c
@@ -0,0 +1,78 @@
1
+ # $LICENSE
2
+ # Copyright 2013-2014 Spotify AB. All rights reserved.
3
+ #
4
+ # The contents of this file are licensed under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with the
6
+ # License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ module EventMachine
17
+ module Protocols
18
+ # FrameObjectProtocol is a reimplementation of ObjectProtocol suitable for UDP
19
+ #
20
+ # module RubyServer
21
+ # include EM::P::FrameObjectProtocol
22
+ #
23
+ # def receive_object obj
24
+ # send_object({'you said' => obj})
25
+ # end
26
+ # end
27
+ #
28
+ module FrameObjectProtocol
29
+ # By default returns Marshal, override to return JSON or YAML, or any
30
+ # other serializer/deserializer responding to #dump and #load.
31
+ def serializer
32
+ Marshal
33
+ end
34
+
35
+ # @private
36
+ def receive_data data
37
+ p data
38
+
39
+ begin
40
+ if data.size < 4
41
+ raise "Received invalid datagram, datagram way too small"
42
+ end
43
+
44
+ size=data.unpack('N').first
45
+
46
+ if data.size != 4+size
47
+ actual_size = data.size-4
48
+ raise "Received invalid datagram: expected size=#{size}, actual size=#{actual_size}"
49
+ end
50
+
51
+ obj = serializer.load data[4..-1]
52
+ rescue => e
53
+ handle_exception(data, e)
54
+ return
55
+ end
56
+
57
+ p obj
58
+ receive_object obj
59
+ end
60
+
61
+ # Invoked with ruby objects received over the network
62
+ def receive_object obj
63
+ # stub
64
+ end
65
+
66
+ # Sends a ruby object over the network
67
+ def send_object obj
68
+ data = serializer.dump(obj)
69
+ send_data [data.respond_to?(:bytesize) ? data.bytesize : data.size, data].pack('Na*')
70
+ end
71
+
72
+ # Invoked whenever FrameObjectProtocol fails to deserialize an object
73
+ def handle_exception datagram, e
74
+ # stub
75
+ end
76
+ end
77
+ end
78
+ end
@@ -209,7 +209,7 @@ module FFWD
209
209
  puts ""
210
210
  puts " 2) Are your plugins loaded?"
211
211
  puts " Check with:"
212
- puts " ffwd -c .. --list-plugins"
212
+ puts " ffwd -c .. --plugins"
213
213
  puts ""
214
214
  puts " 3) Did any errors happen when loading the plugins?"
215
215
  puts " Check with:"
@@ -86,6 +86,10 @@ module FFWD
86
86
  @progname = klass.name
87
87
  end
88
88
 
89
+ def debug?
90
+ FFWD.log.debug?
91
+ end
92
+
89
93
  def debug message
90
94
  FFWD.log.debug(@progname){message}
91
95
  end
@@ -43,4 +43,8 @@ module FFWD
43
43
  stop = Time.now
44
44
  ((stop - start) * 1000).round(3)
45
45
  end
46
+
47
+ def self.dump2hex data
48
+ data.bytes.map { |byte| byte.to_s(16) }.join
49
+ end
46
50
  end
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module FFWD
17
- VERSION = "0.1.5"
17
+ VERSION = "0.1.6"
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffwd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - John-John Tedro
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-22 00:00:00.000000000 Z
12
+ date: 2014-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ! '>='
25
+ - - '>='
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rspec
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec-mocks
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ! '>='
46
+ - - '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: autoversion
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ! '>='
60
+ - - '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ! '>='
67
+ - - '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  description:
@@ -79,63 +79,64 @@ extra_rdoc_files: []
79
79
  files:
80
80
  - bin/fwc
81
81
  - bin/ffwd
82
+ - lib/fwc.rb
82
83
  - lib/ffwd.rb
83
- - lib/em/all.rb
84
- - lib/ffwd/processor/count.rb
85
- - lib/ffwd/processor/histogram.rb
86
- - lib/ffwd/processor/rate.rb
87
- - lib/ffwd/event.rb
88
- - lib/ffwd/plugin_channel.rb
89
- - lib/ffwd/core/reporter.rb
90
- - lib/ffwd/core/processor.rb
91
- - lib/ffwd/core/emitter.rb
92
- - lib/ffwd/core/interface.rb
93
- - lib/ffwd/debug/monitor_session.rb
94
- - lib/ffwd/debug/tcp.rb
95
- - lib/ffwd/debug/connection.rb
96
- - lib/ffwd/utils.rb
97
- - lib/ffwd/reporter.rb
98
- - lib/ffwd/producing_client.rb
84
+ - lib/ffwd/statistics.rb
99
85
  - lib/ffwd/processor.rb
100
- - lib/ffwd/retrier.rb
101
- - lib/ffwd/debug.rb
86
+ - lib/ffwd/producing_client.rb
87
+ - lib/ffwd/tunnel.rb
102
88
  - lib/ffwd/protocol.rb
103
- - lib/ffwd/metric.rb
104
- - lib/ffwd/core.rb
105
- - lib/ffwd/statistics/collector.rb
106
- - lib/ffwd/statistics/system_statistics.rb
107
- - lib/ffwd/version.rb
108
- - lib/ffwd/circular_buffer.rb
109
89
  - 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
110
94
  - lib/ffwd/plugin/json.rb
111
95
  - lib/ffwd/plugin/log/writer.rb
112
96
  - lib/ffwd/plugin/log.rb
113
97
  - lib/ffwd/plugin/json/connection.rb
114
- - lib/ffwd/logging.rb
115
- - lib/ffwd/schema.rb
98
+ - lib/ffwd/circular_buffer.rb
99
+ - lib/ffwd/event.rb
100
+ - lib/ffwd/statistics/system_statistics.rb
101
+ - lib/ffwd/statistics/collector.rb
102
+ - lib/ffwd/connection.rb
103
+ - lib/ffwd/utils.rb
104
+ - lib/ffwd/protocol/tcp.rb
116
105
  - lib/ffwd/protocol/tcp/bind.rb
117
106
  - lib/ffwd/protocol/tcp/plain_connect.rb
118
107
  - lib/ffwd/protocol/tcp/flushing_connect.rb
119
108
  - lib/ffwd/protocol/tcp/connection.rb
120
- - lib/ffwd/protocol/udp.rb
121
- - lib/ffwd/protocol/udp/connect.rb
122
109
  - lib/ffwd/protocol/udp/bind.rb
123
- - lib/ffwd/protocol/tcp.rb
124
- - lib/ffwd/channel.rb
110
+ - lib/ffwd/protocol/udp/connect.rb
111
+ - lib/ffwd/protocol/udp.rb
112
+ - lib/ffwd/reporter.rb
125
113
  - lib/ffwd/plugin_loader.rb
126
- - lib/ffwd/schema/default.rb
127
114
  - lib/ffwd/schema/spotify100.rb
128
- - lib/ffwd/plugin.rb
115
+ - lib/ffwd/schema/default.rb
116
+ - lib/ffwd/metric_emitter.rb
117
+ - lib/ffwd/schema.rb
129
118
  - lib/ffwd/event_emitter.rb
119
+ - lib/ffwd/core/processor.rb
120
+ - lib/ffwd/core/interface.rb
121
+ - lib/ffwd/core/reporter.rb
122
+ - lib/ffwd/core/emitter.rb
130
123
  - lib/ffwd/handler.rb
131
- - lib/ffwd/tunnel.rb
132
- - lib/ffwd/metric_emitter.rb
133
- - lib/ffwd/statistics.rb
134
- - lib/ffwd/connection.rb
135
- - lib/ffwd/tunnel/udp.rb
124
+ - lib/ffwd/version.rb
125
+ - lib/ffwd/core.rb
126
+ - lib/ffwd/processor/rate.rb
127
+ - lib/ffwd/processor/count.rb
128
+ - 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
136
133
  - lib/ffwd/tunnel/tcp.rb
134
+ - lib/ffwd/tunnel/udp.rb
137
135
  - lib/ffwd/tunnel/plugin.rb
138
- - lib/fwc.rb
136
+ - lib/ffwd/plugin.rb
137
+ - lib/ffwd/metric.rb
138
+ - lib/em/protocols/frame_object_protocol.rb
139
+ - lib/em/all.rb
139
140
  homepage: https://github.com/spotify/ffwd
140
141
  licenses:
141
142
  - Apache 2.0
@@ -146,12 +147,12 @@ require_paths:
146
147
  - lib
147
148
  required_ruby_version: !ruby/object:Gem::Requirement
148
149
  requirements:
149
- - - ! '>='
150
+ - - '>='
150
151
  - !ruby/object:Gem::Version
151
152
  version: '0'
152
153
  required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  requirements:
154
- - - ! '>='
155
+ - - '>='
155
156
  - !ruby/object:Gem::Version
156
157
  version: '0'
157
158
  requirements: []