Giter Site home page Giter Site logo

siddharthrai / tarantool-c Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tarantool/tarantool-c

0.0 2.0 0.0 7.65 MB

A new C client for Tarantool 1.6+

Home Page: http://tarantool.org/

License: Other

CMake 3.41% Shell 0.88% C 94.67% Python 0.26% Lua 0.78%

tarantool-c's Introduction

Tarantool C client libraries

https://travis-ci.org/tarantool/tarantool-c.svg?branch=master

About

Tarantool-c is a client library written in C for Tarantool. The current version is 1.0

Tarantool-c depends on msgpuck.

For documentation, please, visit github pages.

It consinsts of:

  • tnt - tarantool IProto/networking library

Compilation/Installation

This project using CMake for generating Makefiles:

$ cmake .
$ make
#### For testing against installed tarantool
$ make test
#### For building documentation using Doxygen
$ make doc
#### For installing into system (headers+libraries)
$ make install

Or you can install it using yum/apt into your favorite linux distribution from tarantool's repository

Examples

Start tarantool at port 3301 using this command:

box.cfg{ listen = '3301' }

After you've installed tarantool-c build and execute this code:

#include <stdlib.h>
#include <stdio.h>

#include <tarantool/tarantool.h>
#include <tarantool/tnt_net.h>
#include <tarantool/tnt_opt.h>

int main() {
    const char * uri = "localhost:3301";
    struct tnt_stream * tnt = tnt_net(NULL); // Allocating stream
    tnt_set(tnt, TNT_OPT_URI, uri); // Setting URI
    tnt_set(tnt, TNT_OPT_SEND_BUF, 0); // Disable buffering for send
    tnt_set(tnt, TNT_OPT_RECV_BUF, 0); // Disable buffering for recv
    tnt_connect(tnt); // Initialize stream and connect to Tarantool
    tnt_ping(tnt); // Send ping request
    struct tnt_reply * reply = tnt_reply_init(NULL); // Initialize reply
    tnt->read_reply(tnt, reply); // Read reply from server
    tnt_reply_free(reply); // Free reply
    tnt_close(tnt); tnt_stream_free(tnt); // Close connection and free stream object
}

For more examples, please, visit test/cli/tarantool_tcp.c or test/tarantool_unix.c files.

For RPM/DEB packages - use instructions from http://tarantool.org/download.html to add repositories.

tarantool-c's People

Contributors

bigbes avatar amdrozdov avatar totktonada avatar rtsisyk avatar alg1973 avatar laserphaser avatar kostja avatar rtokarev avatar thekvs avatar zloidemon avatar lenkis avatar nekipelov avatar asierguti avatar gerold103 avatar

Watchers

James Cloos avatar sidrai avatar

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.