garru-ruby_scribe_client 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.1.0 added scribe server
1
2
  v0.0.9 requiring timeout
2
3
  v0.0.8 also adding timeout to socket open
3
4
  v0.0.7 adding timeout
data/Manifest CHANGED
@@ -9,6 +9,7 @@ lib/ruby_scribe_client/fb303_types.rb
9
9
  lib/ruby_scribe_client/reflection_limited_types.rb
10
10
  lib/ruby_scribe_client/scribe.rb
11
11
  lib/ruby_scribe_client/scribe_mgmt.rb
12
+ lib/ruby_scribe_client/scribe_server.rb
12
13
  lib/ruby_scribe_client/scribe_types.rb
13
14
  lib/ruby_scribe_client.rb
14
15
  LICENSE
@@ -36,6 +36,7 @@ module Scribe
36
36
  def process_Log(seqid, iprot, oprot)
37
37
  args = read_args(iprot, Log_args)
38
38
  result = Log_result.new()
39
+ puts result
39
40
  result.success = @handler.Log(args.messages)
40
41
  write_result(result, oprot, 'Log', seqid)
41
42
  end
@@ -0,0 +1,29 @@
1
+ require File.join([File.dirname(__FILE__), 'scribe'])
2
+ #
3
+ # class ScribeHandler
4
+ # def Log(messages)
5
+ # messages.each do |x|
6
+ # puts "#{x.inspect}"
7
+ # end
8
+ # return ResultCode::OK
9
+ # end
10
+ # end
11
+ #
12
+ # handler = ScribeHandler.new
13
+ #
14
+ # puts "Starting the server..."
15
+ # server.serve()
16
+ # puts "done."
17
+ class ScribeServer
18
+ def initialize(port, handler)
19
+ handler
20
+ processor = Scribe::Processor.new(handler)
21
+ transport = Thrift::ServerSocket.new(port)
22
+ transportFactory = Thrift::FramedTransportFactory.new
23
+ @server = Thrift::SimpleServer.new(processor, transport, transportFactory)
24
+ end
25
+
26
+ def run
27
+ @server.serve()
28
+ end
29
+ end
@@ -23,7 +23,7 @@ class ScribeLogger
23
23
  # @transport.flush
24
24
  return result
25
25
  rescue Thrift::Exception => tx
26
-
26
+ raise tx
27
27
  end
28
28
  end
29
29
 
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ruby_scribe_client}
5
- s.version = "0.0.9"
5
+ s.version = "0.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Gary Tsang"]
9
9
  s.date = %q{2009-04-13}
10
10
  s.description = %q{Ruby Scribe Client. Package and Wrapper for generated ruby interfaces}
11
11
  s.email = %q{}
12
- s.extra_rdoc_files = ["CHANGELOG", "lib/ruby_scribe_client/FacebookService.rb", "lib/ruby_scribe_client/fb303_client.rb", "lib/ruby_scribe_client/fb303_types.rb", "lib/ruby_scribe_client/reflection_limited_types.rb", "lib/ruby_scribe_client/scribe.rb", "lib/ruby_scribe_client/scribe_mgmt.rb", "lib/ruby_scribe_client/scribe_types.rb", "lib/ruby_scribe_client.rb", "LICENSE", "README"]
13
- s.files = ["CHANGELOG", "etc/scribe_cat.rb", "etc/scribe_munin.rb", "etc/scribe_net", "etc/test.rb", "lib/ruby_scribe_client/FacebookService.rb", "lib/ruby_scribe_client/fb303_client.rb", "lib/ruby_scribe_client/fb303_types.rb", "lib/ruby_scribe_client/reflection_limited_types.rb", "lib/ruby_scribe_client/scribe.rb", "lib/ruby_scribe_client/scribe_mgmt.rb", "lib/ruby_scribe_client/scribe_types.rb", "lib/ruby_scribe_client.rb", "LICENSE", "Manifest", "Rakefile", "README", "ruby_scribe_client.gemspec", "vendor/thrift/client.rb", "vendor/thrift/deprecation.rb", "vendor/thrift/exceptions.rb", "vendor/thrift/processor.rb", "vendor/thrift/protocol/binaryprotocol.rb", "vendor/thrift/protocol/binaryprotocolaccelerated.rb", "vendor/thrift/protocol/tbinaryprotocol.rb", "vendor/thrift/protocol/tprotocol.rb", "vendor/thrift/protocol.rb", "vendor/thrift/serializer.rb", "vendor/thrift/server/httpserver.rb", "vendor/thrift/server/nonblockingserver.rb", "vendor/thrift/server/thttpserver.rb", "vendor/thrift/server/tserver.rb", "vendor/thrift/server.rb", "vendor/thrift/struct.rb", "vendor/thrift/thrift.rb", "vendor/thrift/transport/httpclient.rb", "vendor/thrift/transport/socket.rb", "vendor/thrift/transport/thttpclient.rb", "vendor/thrift/transport/tsocket.rb", "vendor/thrift/transport/ttransport.rb", "vendor/thrift/transport/unixsocket.rb", "vendor/thrift/transport.rb", "vendor/thrift/types.rb", "vendor/thrift.rb"]
12
+ s.extra_rdoc_files = ["CHANGELOG", "lib/ruby_scribe_client/FacebookService.rb", "lib/ruby_scribe_client/fb303_client.rb", "lib/ruby_scribe_client/fb303_types.rb", "lib/ruby_scribe_client/reflection_limited_types.rb", "lib/ruby_scribe_client/scribe.rb", "lib/ruby_scribe_client/scribe_mgmt.rb", "lib/ruby_scribe_client/scribe_server.rb", "lib/ruby_scribe_client/scribe_types.rb", "lib/ruby_scribe_client.rb", "LICENSE", "README"]
13
+ s.files = ["CHANGELOG", "etc/scribe_cat.rb", "etc/scribe_munin.rb", "etc/scribe_net", "etc/test.rb", "lib/ruby_scribe_client/FacebookService.rb", "lib/ruby_scribe_client/fb303_client.rb", "lib/ruby_scribe_client/fb303_types.rb", "lib/ruby_scribe_client/reflection_limited_types.rb", "lib/ruby_scribe_client/scribe.rb", "lib/ruby_scribe_client/scribe_mgmt.rb", "lib/ruby_scribe_client/scribe_server.rb", "lib/ruby_scribe_client/scribe_types.rb", "lib/ruby_scribe_client.rb", "LICENSE", "Manifest", "Rakefile", "README", "ruby_scribe_client.gemspec", "vendor/thrift/client.rb", "vendor/thrift/deprecation.rb", "vendor/thrift/exceptions.rb", "vendor/thrift/processor.rb", "vendor/thrift/protocol/binaryprotocol.rb", "vendor/thrift/protocol/binaryprotocolaccelerated.rb", "vendor/thrift/protocol/tbinaryprotocol.rb", "vendor/thrift/protocol/tprotocol.rb", "vendor/thrift/protocol.rb", "vendor/thrift/serializer.rb", "vendor/thrift/server/httpserver.rb", "vendor/thrift/server/nonblockingserver.rb", "vendor/thrift/server/thttpserver.rb", "vendor/thrift/server/tserver.rb", "vendor/thrift/server.rb", "vendor/thrift/struct.rb", "vendor/thrift/thrift.rb", "vendor/thrift/transport/httpclient.rb", "vendor/thrift/transport/socket.rb", "vendor/thrift/transport/thttpclient.rb", "vendor/thrift/transport/tsocket.rb", "vendor/thrift/transport/ttransport.rb", "vendor/thrift/transport/unixsocket.rb", "vendor/thrift/transport.rb", "vendor/thrift/types.rb", "vendor/thrift.rb"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://github.com/garru/ruby_scribe_client}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ruby_scribe_client", "--main", "README"]
@@ -17,7 +17,7 @@ module Thrift
17
17
 
18
18
  attr_reader :strict_read, :strict_write
19
19
 
20
- def initialize(trans, strict_read=true, strict_write=true)
20
+ def initialize(trans, strict_read=false, strict_write=true)
21
21
  super(trans)
22
22
  @strict_read = strict_read
23
23
  @strict_write = strict_write
@@ -35,7 +35,7 @@ module Thrift
35
35
  loop do
36
36
  @processor.process(prot, prot)
37
37
  end
38
- rescue Thrift::TransportException, Thrift::ProtocolException
38
+ rescue Thrift::TransportException, Thrift::ProtocolException => e
39
39
  ensure
40
40
  trans.close
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garru-ruby_scribe_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Tsang
@@ -27,6 +27,7 @@ extra_rdoc_files:
27
27
  - lib/ruby_scribe_client/reflection_limited_types.rb
28
28
  - lib/ruby_scribe_client/scribe.rb
29
29
  - lib/ruby_scribe_client/scribe_mgmt.rb
30
+ - lib/ruby_scribe_client/scribe_server.rb
30
31
  - lib/ruby_scribe_client/scribe_types.rb
31
32
  - lib/ruby_scribe_client.rb
32
33
  - LICENSE
@@ -43,6 +44,7 @@ files:
43
44
  - lib/ruby_scribe_client/reflection_limited_types.rb
44
45
  - lib/ruby_scribe_client/scribe.rb
45
46
  - lib/ruby_scribe_client/scribe_mgmt.rb
47
+ - lib/ruby_scribe_client/scribe_server.rb
46
48
  - lib/ruby_scribe_client/scribe_types.rb
47
49
  - lib/ruby_scribe_client.rb
48
50
  - LICENSE