Skip to content

Commit

Permalink
iproto updated
Browse files Browse the repository at this point in the history
  • Loading branch information
prepor committed Jan 27, 2012
1 parent 802c475 commit 8f5744c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Expand Up @@ -3,7 +3,7 @@ PATH
specs:
tarantool (0.2)
activemodel (>= 3.1, < 4.0)
iproto (>= 0.1)
iproto (>= 0.2)

GEM
remote: http://rubygems.org/
Expand All @@ -23,7 +23,7 @@ GEM
eventmachine (>= 1.0.0.beta.1)
eventmachine (1.0.0.beta.4)
i18n (0.6.0)
iproto (0.1)
iproto (0.2)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
multi_json (1.0.3)
Expand Down
2 changes: 1 addition & 1 deletion lib/tarantool.rb
Expand Up @@ -2,7 +2,7 @@
require 'iproto'

class Tarantool
VERSION = '0.2'
VERSION = '0.2.1'

require 'tarantool/space'
require 'tarantool/requests'
Expand Down
13 changes: 2 additions & 11 deletions lib/tarantool/request.rb
Expand Up @@ -47,25 +47,16 @@ def initialize(space, *args)
end

def perform
data = connection.send_packet request_id, make_packet(make_body)
data = connection.send_request self.class.request_type, make_body
make_response data
end

def parse_args

end

def request_id
@request_id ||= connection.next_request_id
end

def make_packet(body)
[self.class.request_type, body.size, request_id].pack('LLL') +
body
end

def make_response(data)
return_code, = data[0,4].unpack('L')
return_code, = data[0,4].unpack('L')
if return_code == 0
Response.new(data[4, data.size], response_params)
else
Expand Down
11 changes: 0 additions & 11 deletions spec/tarantool/request_spec.rb
Expand Up @@ -31,17 +31,6 @@ def space
end
end

describe "instance" do
let(:request) { Tarantool::Requests::Insert.new space }

it "should make packet with right request type, body size and next request id + body" do
body = 'hi'
expect = [Tarantool::Requests::REQUEST_TYPES[:insert], body.bytesize, request.request_id].pack('LLL') + body
request.make_packet(body).must_equal expect
end

end

describe "requests" do
include Helpers::Truncate
describe "insert and select" do
Expand Down
6 changes: 3 additions & 3 deletions tarantool.gemspec
Expand Up @@ -4,8 +4,8 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5'

s.name = 'tarantool'
s.version = '0.2'
s.date = '2012-01-23'
s.version = '0.2.1'
s.date = '2012-01-27'
s.rubyforge_project = 'tarantool'

s.summary = "Tarantool KV-storage client."
Expand All @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.md LICENSE]

s.add_dependency('iproto', [">= 0.1"])
s.add_dependency('iproto', [">= 0.2"])
s.add_dependency('activemodel', [">= 3.1", "< 4.0"])


Expand Down

0 comments on commit 8f5744c

Please sign in to comment.