riakpb 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,3 +3,5 @@
3
3
  pkg
4
4
  *.gem
5
5
  .bundle
6
+
7
+ /riak-pbclient.tmproj
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- riakpb (0.2.3)
4
+ riakpb (0.3.0)
5
5
  activesupport (~> 3.0.0)
6
- ruby_protobuf (~> 0.4.8)
6
+ ruby_protobuf (~> 0.4.9)
7
7
  yard (~> 0.6.4)
8
8
 
9
9
  GEM
@@ -12,24 +12,21 @@ GEM
12
12
  activesupport (3.0.3)
13
13
  diff-lcs (1.1.2)
14
14
  i18n (0.5.0)
15
- rspec (2.3.0)
16
- rspec-core (~> 2.3.0)
17
- rspec-expectations (~> 2.3.0)
18
- rspec-mocks (~> 2.3.0)
19
- rspec-core (2.3.1)
20
- rspec-expectations (2.3.0)
15
+ rspec (2.4.0)
16
+ rspec-core (~> 2.4.0)
17
+ rspec-expectations (~> 2.4.0)
18
+ rspec-mocks (~> 2.4.0)
19
+ rspec-core (2.4.0)
20
+ rspec-expectations (2.4.0)
21
21
  diff-lcs (~> 1.1.2)
22
- rspec-mocks (2.3.0)
23
- ruby_protobuf (0.4.8)
22
+ rspec-mocks (2.4.0)
23
+ ruby_protobuf (0.4.9)
24
24
  yard (0.6.4)
25
25
 
26
26
  PLATFORMS
27
27
  ruby
28
28
 
29
29
  DEPENDENCIES
30
- activesupport (~> 3.0.0)
31
30
  i18n (~> 0.5.0)
32
31
  riakpb!
33
- rspec (~> 2.3.0)
34
- ruby_protobuf (~> 0.4.8)
35
- yard (~> 0.6.4)
32
+ rspec (~> 2.4.0)
data/Rakefile CHANGED
@@ -4,41 +4,18 @@ Bundler::GemHelper.install_tasks
4
4
 
5
5
  require 'rspec/core'
6
6
  require 'rspec/core/rake_task'
7
-
8
-
9
- # task :release => :spec
10
-
11
- desc "Run Specs"
12
- Rspec::Core::RakeTask.new(:spec) do |spec|
13
- spec.pattern = "spec/**/*_spec.rb"
14
- spec.verbose = true
15
- spec.rspec_opts = ['--color']
16
- end
17
-
18
7
  require 'yard'
19
8
 
9
+ task :release => :spec
10
+
20
11
  desc "Generate YARD docs"
21
12
  YARD::Rake::YardocTask.new(:yard) do |t|
22
13
  t.files += ['lib/**/*.rb']
23
14
  end
24
15
 
25
- desc "Run Unit Specs Only"
16
+ desc "Run Specs"
26
17
  Rspec::Core::RakeTask.new(:spec) do |spec|
27
- spec.pattern = "spec/riakpb/**/*_spec.rb"
28
- end
29
-
30
- namespace :spec do
31
- desc "Run Integration Specs Only"
32
- Rspec::Core::RakeTask.new(:integration) do |spec|
33
- spec.pattern = "spec/integration/**/*_spec.rb"
34
- end
35
-
36
- desc "Run All Specs"
37
- Rspec::Core::RakeTask.new(:all) do |spec|
38
- spec.pattern = Rake::FileList["spec/**/*_spec.rb"]
39
- end
18
+ spec.pattern = "spec/**/*_spec.rb"
19
+ spec.verbose = true
20
+ spec.rspec_opts = ['--color']
40
21
  end
41
-
42
- # TODO - want other tests/tasks run by default? Add them to the list
43
- # remove_task :default
44
- # task :default => [:spec, :features]
@@ -16,7 +16,7 @@ module Riakpb
16
16
 
17
17
  RECV_LIMIT=1073741824
18
18
 
19
- attr_reader :req_message, :response, :resp_message_codes, :resp_message, :status
19
+ attr_reader :req_message, :response, :resp_message_codes, :resp_message, :status, :socket
20
20
 
21
21
  # Establishes a Client ID with the Riakpb node, for the life of the RPC connection.
22
22
  # @param [Client] client the Riakpb::Client object in which this Rpc instance lives
@@ -50,25 +50,26 @@ module Riakpb
50
50
  # Opens a TCPSocket connection with the riak host/node
51
51
  # @yield [TCPSocket] hands off the socket connection
52
52
  # @return [TCPSocket] data that was exchanged with the host/node
53
- def with_socket(&block)
54
- socket = TCPSocket.open(@client.host, @client.port)
55
- set_client_id(socket) if @set_client_id
53
+ def with_socket
54
+ set_client_id unless @set_client_id.nil?
56
55
 
57
- out = yield(socket)
58
- socket.close
56
+ yield(socket)
57
+ end
59
58
 
60
- return(out)
59
+ # @return [TCPSocket] The TCPSocket of the remote riak node
60
+ def socket
61
+ @socket ||= TCPSocket.open(@client.host, @client.port)
61
62
  end
62
63
 
63
64
  # Sets the Client ID for the TCPSocket session
64
65
  # @param [TCPSocket] socket connection for which the Client ID will be set
65
66
  # @return [True/False] whether or not the set client id request succeeded
66
- def set_client_id(socket)
67
+ def set_client_id
67
68
  @set_c_id_req ||= assemble_request( Util::MessageCode::SET_CLIENT_ID_REQUEST,
68
69
  @set_client_id.serialize_to_string)
69
70
 
70
71
  socket.write(@set_c_id_req)
71
- set_c_id_resp = socket.sysread(@limit)
72
+ set_c_id_resp = socket.sysread(@limit)
72
73
 
73
74
  resp_code, resp_msg = decode_message(set_c_id_resp)
74
75
 
@@ -112,8 +113,6 @@ module Riakpb
112
113
 
113
114
  value = @buffer + value
114
115
 
115
- # return {:done => false} if message_remaining?(@resp_message)
116
-
117
116
  response_chunk, @resp_message_codes, @buffer = decode_message(value)
118
117
 
119
118
  @resp_message_codes.each do |resp_mc|
@@ -1,3 +1,3 @@
1
1
  module Riakpb
2
- VERSION = '0.2.3'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -12,7 +12,7 @@ client = Riakpb::Client.new
12
12
  bucket = client["goog"]
13
13
 
14
14
  CSV.foreach('goog.csv', :headers => true) do |row|
15
- @noisy && puts(row.first[1].to_s)
15
+ puts(row.first[1].to_s) if @noisy
16
16
 
17
17
  key = bucket[row.first[1].to_s]
18
18
  key.content.value = Hash[row.to_a]
@@ -19,10 +19,10 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency 'activesupport', '~> 3.0.0'
22
- s.add_dependency 'ruby_protobuf', '~> 0.4.8'
22
+ s.add_dependency 'ruby_protobuf', '~> 0.4.9'
23
23
 
24
24
  s.add_dependency 'yard', '~> 0.6.4'
25
25
 
26
- s.add_development_dependency 'rspec', '~> 2.3.0'
26
+ s.add_development_dependency 'rspec', '~> 2.4.0'
27
27
  s.add_development_dependency 'i18n', '~> 0.5.0'
28
28
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
7
  - 3
9
- version: 0.2.3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Scott Gonyea
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-02 00:00:00 -08:00
17
+ date: 2011-01-23 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -43,8 +43,8 @@ dependencies:
43
43
  segments:
44
44
  - 0
45
45
  - 4
46
- - 8
47
- version: 0.4.8
46
+ - 9
47
+ version: 0.4.9
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
@@ -72,9 +72,9 @@ dependencies:
72
72
  - !ruby/object:Gem::Version
73
73
  segments:
74
74
  - 2
75
- - 3
75
+ - 4
76
76
  - 0
77
- version: 2.3.0
77
+ version: 2.4.0
78
78
  type: :development
79
79
  version_requirements: *id004
80
80
  - !ruby/object:Gem::Dependency