Module: Tarantool16

Defined in:
lib/tarantool16.rb,
lib/tarantool16/db.rb,
lib/tarantool16/query.rb,
lib/tarantool16/consts.rb,
lib/tarantool16/errors.rb,
lib/tarantool16/dumb_db.rb,
lib/tarantool16/version.rb,
lib/tarantool16/response.rb,
lib/tarantool16/connection/dumb.rb,
lib/tarantool16/connection/common.rb,
lib/tarantool16/connection/response.rb

Defined Under Namespace

Modules: Connection Classes: ConnectionError, DB, DBError, DumbDB, Error, Option, Query, SchemaError

Constant Summary collapse

IPROTO_CODE =
0x00
IPROTO_SYNC =
0x01
IPROTO_SPACE_ID =
0x10
IPROTO_INDEX_ID =
0x11
IPROTO_LIMIT =
0x12
IPROTO_OFFSET =
0x13
IPROTO_ITERATOR =
0x14
IPROTO_KEY =
0x20
IPROTO_TUPLE =
0x21
IPROTO_FUNCTION_NAME =
0x22
IPROTO_USER_NAME =
0x23
IPROTO_EXPR =
0x27
IPROTO_DEF_DUPLE =
0x28
IPROTO_DATA =
0x30
IPROTO_ERROR =
0x31
IPROTO_GREETING_SIZE =
128
REQUEST_TYPE_OK =
0
REQUEST_TYPE_PING =
64
REQUEST_TYPE_SELECT =
1
REQUEST_TYPE_INSERT =
2
REQUEST_TYPE_REPLACE =
3
REQUEST_TYPE_UPDATE =
4
REQUEST_TYPE_DELETE =
5
REQUEST_TYPE_CALL =
6
REQUEST_TYPE_AUTHENTICATE =
7
REQUEST_TYPE_EVAL =
8
REQUEST_TYPE_UPSERT =
9
REQUEST_TYPE_ERROR =
1 << 15
SPACE_SCHEMA =
272
SPACE_SPACE =
280
SPACE_VSPACE =
281
SPACE_INDEX =
288
SPACE_VINDEX =
289
SPACE_FUNC =
296
SPACE_USER =
304
SPACE_PRIV =
312
SPACE_CLUSTER =
320
INDEX_SPACE_PRIMARY =
0
INDEX_SPACE_NAME =
2
INDEX_INDEX_PRIMARY =
0
INDEX_INDEX_NAME =
2
ITERATOR_EQ =
0
ITERATOR_REQ =
1
ITERATOR_ALL =
2
ITERATOR_LT =
3
ITERATOR_LE =
4
ITERATOR_GE =
5
ITERATOR_GT =
6
ITERATOR_BITS_ALL_SET =
7
ITERATOR_BITS_ANY_SET =
8
ITERATOR_BITS_ALL_NOT_SET =
9
ITERATOR_RTREE_OVERLAPS =
10
ITERATOR_RTREE_NEIGHBOR =
11
Iterators =
{}
SOCKET_TIMEOUT =

Default value for socket timeout (seconds)

nil
RECONNECT_MAX_ATTEMPTS =

Default maximum number of attempts to reconnect

10
RECONNECT_DELAY =

Default delay between attempts to reconnect (seconds)

0.1
RETRY_MAX_ATTEMPTS =

Number of reattempts in case of server return completion_status == 1 (try again)

10
DBErrors =
{}
VERSION =
"0.0.12"

Class Method Summary collapse

Class Method Details

.iter(iter) ⇒ Object



84
85
86
87
88
89
# File 'lib/tarantool16/consts.rb', line 84

def self.iter(iter)
  unless it = Iterators[iter]
    raise "Unknown iterator #{iter.inspect}"
  end
  it
end

.new(opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tarantool16.rb', line 6

def self.new(opts = {})
  opts = opts.dup
  if opts[:unix] && opts[:host]
      raise "`:host` and `:unix` options are mutually exclusive"
  elsif opts[:unix]
    hosts = ["unix", opts[:unix]]
  elsif opts[:host]
    host = opts[:host]
    if Array === host
      hosts = host
    else
      host = [host, opts[:port]].compact.join(':')
      hosts = ["tcp", host]
    end
  end
  type = opts[:type] && opts[:type].to_s || 'dumb'
  case type
  when 'dumb'
    DumbDB.new hosts, opts
  else
    raise "Unknown DB type"
  end
end