class Tarantool16::DumbDB

Constants

Connection
HUGE_LIMIT
RETURN_ONE_OR_RAISE
RETURN_OR_RAISE

Public Instance Methods

_norm_key(key) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 84
def _norm_key(key)
  case key
  when Array
    key
  when Hash
    key
  else
    [key]
  end
end
_synchronized() { || ... } click to toggle source
# File lib/tarantool16/dumb_db.rb, line 80
def _synchronized
  yield
end
call(name, args) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 68
def call(name, args)
  _call(name, args, RETURN_OR_RAISE)
end
call16(name, args) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 72
def call16(name, args)
  _call16(name, args, RETURN_OR_RAISE)
end
delete(sno, key, opts = {}) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 46
def delete(sno, key, opts = {})
  key_hash = Hash === key
  ino = opts[:index] || (key_hash ? nil : 0)
  need_hash = opts.fetch(:hash, key_hash)
  key = _norm_key(key)
  _delete(sno, ino, key, need_hash, RETURN_OR_RAISE)
end
eval(expr, args) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 76
def eval(expr, args)
  _eval(expr, args, RETURN_OR_RAISE)
end
get(sno, key, opts={}) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 28
def get(sno, key, opts={})
  ino = opts[:index]
  iterator = opts[:iterator]
  need_hash = opts.fetch(:hash, Hash === key)
  key = _norm_key(key)
  _select(sno, ino, key, 0, 1, iterator, need_hash, RETURN_ONE_OR_RAISE)
end
insert(sno, tuple, opts = {}) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 36
def insert(sno, tuple, opts = {})
  need_hash = opts[:hash] || tuple.is_a?(Hash)
  _insert(sno, tuple, need_hash, RETURN_OR_RAISE)
end
replace(sno, tuple, opts = {}) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 41
def replace(sno, tuple, opts = {})
  need_hash = opts[:hash] || tuple.is_a?(Hash)
  _replace(sno, tuple, need_hash, RETURN_OR_RAISE)
end
select(sno, key, opts={}) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 18
def select(sno, key, opts={})
  ino = opts[:index]
  offset = opts[:offset] || 0
  limit = opts[:limit] || 2**30
  iterator = opts[:iterator]
  need_hash = opts.fetch(:hash, Hash === key)
  key = _norm_key(key)
  _select(sno, ino, key, offset, limit, iterator, need_hash, RETURN_OR_RAISE)
end
update(sno, key, ops, opts = {}) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 54
def update(sno, key, ops, opts = {})
  key_hash = Hash === key
  ino = opts[:index] || (key_hash ? nil : 0)
  need_hash = opts.fetch(:hash, key_hash)
  key = _norm_key(key)
  _update(sno, ino, key, ops, need_hash, RETURN_OR_RAISE)
end
upsert(sno, tuple_key, ops, opts = {}) click to toggle source
# File lib/tarantool16/dumb_db.rb, line 62
def upsert(sno, tuple_key, ops, opts = {})
  ino = opts[:index] || 0
  need_hash = opts.fetch(:hash, Hash === tuple_key)
  _upsert(sno, ino, tuple_key, ops, need_hash, RETURN_OR_RAISE)
end