tarantool16 0.0.12 → 0.1.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1e48342e0d480e5d5083e9c2d606e801867a302
4
- data.tar.gz: 14efa0034189d0f8810fecc010353a4de1e60da7
3
+ metadata.gz: a32fa448b9f723a683ca2eed5fcdcffb978684ae
4
+ data.tar.gz: cf785fd5ad492f3a7f0b2c845e84648958df2ea7
5
5
  SHA512:
6
- metadata.gz: 78a6cdd4aad5a4494f0b769fffd92ea51c44f567a76cfd9d1b293399115c7a21854fb9b21d56eeb7548266f4c30e218b2e32e8e8afb6f3784dd78be353a2afe8
7
- data.tar.gz: b2176218401af3c9eba21b2699f0b3441a89ef7f27f63dede6fb48767a061893699584e6357688107339e0c29ba71cf78605f1ac58adc822962418c7df309ccd
6
+ metadata.gz: e7d3f686ea033c9cad8e6fe6bfc66d031b52ba25732413c467fde64bf3bca3e465f2fb347ad4ab8c9ec2662f23db5cfcf4e8fc407c6e73a6c281e0a37f675672
7
+ data.tar.gz: 73758e4cc1a1d447d90b8b81320ba2eae5ca71fc06394d92892ecdfdec29c3ac0e27e3f3497c297ec648025d26bef3d07279070731cc68727b89dbe3748dbd90
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tarantool16
2
2
 
3
- This is adapter for [tarantool](http://tarantool.org) version 1.6.
3
+ This is adapter for [tarantool](http://tarantool.org) version 1.6 and 1.7.
4
4
 
5
5
  (adapter for version <=1.5 is called [tarantool](https://github.org/tarantoool/tarantool-ruby))
6
6
 
@@ -74,6 +74,9 @@ tar.update(:_space, {name: 'test'}, {format: [:=, [{name: :id, type: :num}, {nam
74
74
 
75
75
  ## Changelog
76
76
 
77
+ 0.1.0 - breaking change: call now issues request in Tarantool17 format.
78
+ use call16 to issue `call` request to Tarantool16.
79
+ see tests for difference in returned results.
77
80
  0.0.11 - change a way of unix socket option.
78
81
  since previos scheme were introduced 12 hours ago,
79
82
  i think it is still safe to change it.
@@ -217,7 +217,13 @@ module Tarantool16
217
217
  def _call(name, args, cb)
218
218
  req = {IPROTO_FUNCTION_NAME => name,
219
219
  IPROTO_TUPLE => args}
220
- send_request(REQUEST_TYPE_CALL, req, cb)
220
+ send_request(REQUEST_TYPE_CALL17, req, cb)
221
+ end
222
+
223
+ def _call16(name, args, cb)
224
+ req = {IPROTO_FUNCTION_NAME => name,
225
+ IPROTO_TUPLE => args}
226
+ send_request(REQUEST_TYPE_CALL16, req, cb)
221
227
  end
222
228
 
223
229
  def _eval(expr, args, cb)
@@ -24,10 +24,11 @@ module Tarantool16
24
24
  REQUEST_TYPE_REPLACE = 3
25
25
  REQUEST_TYPE_UPDATE = 4
26
26
  REQUEST_TYPE_DELETE = 5
27
- REQUEST_TYPE_CALL = 6
27
+ REQUEST_TYPE_CALL16 = 6
28
28
  REQUEST_TYPE_AUTHENTICATE = 7
29
29
  REQUEST_TYPE_EVAL = 8
30
30
  REQUEST_TYPE_UPSERT = 9
31
+ REQUEST_TYPE_CALL17 = 10
31
32
  REQUEST_TYPE_ERROR = 1 << 15
32
33
 
33
34
 
@@ -211,6 +211,10 @@ module Tarantool16
211
211
  conn._call(name, args, cb)
212
212
  end
213
213
 
214
+ def _call16(name, args, cb)
215
+ conn._call16(name, args, cb)
216
+ end
217
+
214
218
  def _eval(expr, args, cb)
215
219
  conn._eval(expr, args, cb)
216
220
  end
@@ -69,6 +69,10 @@ module Tarantool16
69
69
  _call(name, args, RETURN_OR_RAISE)
70
70
  end
71
71
 
72
+ def call16(name, args)
73
+ _call16(name, args, RETURN_OR_RAISE)
74
+ end
75
+
72
76
  def eval(expr, args)
73
77
  _eval(expr, args, RETURN_OR_RAISE)
74
78
  end
@@ -1,3 +1,3 @@
1
1
  module Tarantool16
2
- VERSION = "0.0.12"
2
+ VERSION = "0.1.0"
3
3
  end
data/test/config.lua CHANGED
@@ -3,18 +3,16 @@ box.cfg{
3
3
  listen = 33013,
4
4
  wal_dir='.',
5
5
  snap_dir='.',
6
+ wal_mode='none',
6
7
  }
7
- if not box.space.test then
8
- local s1 = box.schema.space.create('test', {id = 513, if_not_exists = true})
9
- local ip = s1:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})
10
- local iname = s1:create_index('name', {type = 'tree', parts = {2, 'STR'}, if_not_exists = true})
11
- local irtree = s1:create_index('point', {type = 'rtree', unique=false, parts = {3, 'ARRAY'}, if_not_exists = true})
12
- local ipname = s1:create_index('id_name', {type = 'tree', parts = {1, 'NUM', 2, 'STR'}})
13
- end
14
- if not box.space.test1 then
15
- local s2 = box.schema.space.create('test1', {id = 514, if_not_exists = true})
16
- local ip = s2:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})
17
- end
8
+ box.once('initbox', function()
9
+ local s1 = box.schema.space.create('test', {id = 513, if_not_exists = true})
10
+ local ip = s1:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})
11
+ local iname = s1:create_index('name', {type = 'tree', parts = {2, 'STR'}, if_not_exists = true})
12
+ local irtree = s1:create_index('point', {type = 'rtree', unique=false, parts = {3, 'ARRAY'}, if_not_exists = true})
13
+ local ipname = s1:create_index('id_name', {type = 'tree', parts = {1, 'NUM', 2, 'STR'}})
14
+ local s2 = box.schema.space.create('test1', {id = 514, if_not_exists = true})
15
+ local ip = s2:create_index('primary', {type = 'hash', parts = {1, 'NUM'}, if_not_exists = true})
18
16
 
19
17
  function reseed()
20
18
  local s1 = box.space.test
@@ -27,15 +25,15 @@ function reseed()
27
25
  s2:insert{2, "world", {3, 4}, 200}
28
26
  end
29
27
 
30
- pcall(function()
28
+ function func1(i)
29
+ return i+1
30
+ end
31
+
31
32
  box.schema.user.grant('guest', 'read,write,execute', 'universe')
33
+ box.schema.user.create('tester', {password='testpass'})
34
+ box.schema.user.grant('tester', 'read,write,execute', 'universe')
32
35
  end)
33
36
 
34
- if not box.schema.user.exists('tester') then
35
- box.schema.user.create('tester', {password='testpass'})
36
- box.schema.user.grant('tester', 'read,write,execute', 'universe')
37
- end
38
-
39
37
  local console = require 'console'
40
38
  console.listen '0.0.0.0:33015'
41
39
 
data/test/test_dumb.rb CHANGED
@@ -71,6 +71,11 @@ describe 'DumbConnection' do
71
71
  db.delete(:test, "world", index: 1).must_equal [r2]
72
72
  end
73
73
 
74
+ it "should call" do
75
+ db.call("func1", [1]).must_equal [2]
76
+ db.call16("func1", [1]).must_equal [[2]]
77
+ end
78
+
74
79
  it "should eval" do
75
80
  db.eval("local a, b = ... ; return a + b", [1, 2]).must_equal [3]
76
81
  end
@@ -118,7 +123,7 @@ describe 'DumbConnection' do
118
123
  Spawn.with_pause do
119
124
  proc {
120
125
  db.get(:test, 1)
121
- }.must_raise Tarantool16::Connection::CouldNotConnect
126
+ }.must_raise ::Tarantool16::Connection::CouldNotConnect
122
127
  end
123
128
  end
124
129
 
@@ -127,7 +132,7 @@ describe 'DumbConnection' do
127
132
  Spawn.with_pause do
128
133
  proc {
129
134
  db.get(:test, 1)
130
- }.must_raise Tarantool16::Connection::Timeout
135
+ }.must_raise ::Tarantool16::Connection::Timeout
131
136
  end
132
137
  end
133
138
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarantool16
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sokolov Yura aka funny_falcon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-06 00:00:00.000000000 Z
11
+ date: 2016-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.4.8
104
+ rubygems_version: 2.5.1
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: adapter for Tarantool 1.6