waterfall-client-rb 1.0.0 → 1.0.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 +4 -4
- data/lib/waterfall/client.rb +24 -8
- data/lib/waterfall/version.rb +1 -1
- data/waterfall-client-rb.gemspec +1 -0
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74844ef19dc3422fdd945d0306aea818a298e30e
|
4
|
+
data.tar.gz: 74ff9c7a83fd5800ab0e57983c723b639186783f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57183436c0ae39a9f25cafd0ad95f824bbd4747d0fe0e5cea2fbd4987b79c15f23efa095889fb36e195d3fd4a3d3433952ba0e07cc877fcf481c495f9a2b5b7d
|
7
|
+
data.tar.gz: 858aa941af39d12940055b624a23da09ca159211377e797a1fa9088a74b467d955a1d812c3e282a0a67888685a19f808f9d1d8a47b454f44b039041f6becc820
|
data/lib/waterfall/client.rb
CHANGED
@@ -1,24 +1,40 @@
|
|
1
1
|
require 'waterfall/version'
|
2
2
|
require 'waterfall/client/thrift/waterfall_service'
|
3
|
+
require 'connection_pool'
|
3
4
|
|
4
5
|
module Waterfall
|
5
6
|
class Client
|
6
7
|
def initialize(options = {})
|
7
8
|
settings = {host: 'localhost', port: 5290}.merge(options)
|
8
|
-
|
9
|
-
@transport = ::Thrift::FramedTransport.new(::Thrift::Socket.new(settings[:host], settings[:port]))
|
10
|
-
protocol = ::Thrift::BinaryProtocol.new(@transport)
|
11
|
-
@client = Thrift::WaterfallService::Client.new(protocol)
|
12
|
-
|
13
|
-
@transport.open
|
9
|
+
@pool = ConnectionPool.new { ClientWrapper.new(settings) }
|
14
10
|
end
|
15
11
|
|
16
12
|
def next_id
|
17
|
-
@client
|
13
|
+
@pool.with do |client|
|
14
|
+
client.next_id
|
15
|
+
end
|
18
16
|
end
|
19
17
|
|
18
|
+
|
20
19
|
def close
|
21
|
-
@
|
20
|
+
@pool.shutdown { |client| client.close }
|
21
|
+
end
|
22
|
+
|
23
|
+
class ClientWrapper
|
24
|
+
def initialize(options)
|
25
|
+
@transport = ::Thrift::FramedTransport.new(::Thrift::Socket.new(options[:host], options[:port]))
|
26
|
+
protocol = ::Thrift::BinaryProtocol.new(@transport)
|
27
|
+
@client = Thrift::WaterfallService::Client.new(protocol)
|
28
|
+
@transport.open
|
29
|
+
end
|
30
|
+
|
31
|
+
def next_id
|
32
|
+
@client.nextId
|
33
|
+
end
|
34
|
+
|
35
|
+
def close
|
36
|
+
@transport.close
|
37
|
+
end
|
22
38
|
end
|
23
39
|
end
|
24
40
|
end
|
data/lib/waterfall/version.rb
CHANGED
data/waterfall-client-rb.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waterfall-client-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Herrmann
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.8.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: connection_pool
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.2.0
|
55
69
|
description:
|
56
70
|
email:
|
57
71
|
- sven.herrmann@thatscalaguy.de
|
@@ -70,7 +84,6 @@ files:
|
|
70
84
|
- lib/waterfall/client/thrift/waterfall_types.rb
|
71
85
|
- lib/waterfall/version.rb
|
72
86
|
- waterfall-client-rb.gemspec
|
73
|
-
- waterfall-client-rb.iml
|
74
87
|
homepage: https://github.com/ThatScalaGuy/waterfall-client-rb
|
75
88
|
licenses:
|
76
89
|
- MIT
|