Git Product home page Git Product logo

lwtarantool's Introduction

LWTarantool - Ruby client for Tarantool 1.7+

Build Status Gem Version

About

A Ruby client for Tarantool 1.7+.

It doesn't support all tarantool protocol features, the only function calls, but allow work with tarantool in async paradigm.

Based on official tarantool-c connector.

Getting started

Install

$ gem install lwtarantool

Connect

require 'lwtarantool'
tnt = LWTarantool.new(url: '127.0.0.1:3301')

Pipelining

reqs = []
reqs << conn.call('box.slab.info', [])
reqs << conn.call('box.runtime.info', [])

reqs.each(&:wait)

if reqs[0].result
  puts "req0 result: #{reqs[0].result.inspect}"
else
  puts "req0 error: #{reqs[0].error}"
end

if reqs[1].result
  puts "req1 result: #{reqs[1].result.inspect}"
else
  puts "req1 error: #{reqs[1].error}"
end

Async requests

slab_req = conn.call('box.slab.info', [])
runtime_req = conn.call('box.runtime.info', [])

2.times do
  req = conn.read
  case req
  when slab_req
    if req.result
      puts "slab info: #{req.result.inspect}"
    else
      puts "slab info error: #{req.error}"
    end
  when runtime_req
    if req.result
      puts "runtime info: #{req.result.inspect}"
    else
      puts "runtime info error: #{req.error}"
    end
  end
end

Error handling

Testing

This library is tested against recent Ruby versions. Check Semaphore CI for the exact versions supported.

Contributing

Fork the project and send pull requests.

lwtarantool's People

Contributors

0xbf avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nikita-sysoyev

lwtarantool's Issues

A LWTarantool::UnknownError when receive TNT_EBIG (Buffer is too big) error from Tarantool

Getting this error when trying to make a big amount of requests with high intensity to the database and it does not have time to process them before I send another request.

Tarantool: 1.9.1, Ruby: 2.4
Trace:

"exception":{"name":"LWTarantool::UnknownError",
"message":"buffer is too big",
"stack_trace":["/opt/***/vendor/bundle/ruby/2.4.0/gems/lwtarantool-0.0.2/lib/lwtarantool/connection.rb:31:in `_call'",
"/opt/***/vendor/bundle/ruby/2.4.0/gems/lwtarantool-0.0.2/lib/lwtarantool/connection.rb:31:in `block in call'",
"/opt/***/vendor/bundle/ruby/2.4.0/gems/lwtarantool-0.0.2/lib/lwtarantool/connection.rb:29:in `synchronize'",
"/opt/***/vendor/bundle/ruby/2.4.0/gems/lwtarantool-0.0.2/lib/lwtarantool/connection.rb:29:in `call'"

Custom timeout interval on LWTarantool initialization

Hello once again!

It would be great to have an opportunity to set the custom timeout interval value in seconds when LWtarantool initializes:

LWTarantool.new(url: '127.0.0.1:3301', timeout:1)

It should help with customizing tarantool connection a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.