GithubHelp home page GithubHelp logo

buptlida / aerospike-client-c Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aerospike/aerospike-client-c

0.0 1.0 0.0 9.27 MB

Aerospike C Client

License: Other

Shell 0.75% Makefile 1.83% C 85.49% HTML 0.12% CSS 2.48% C++ 7.83% DTrace 0.06% Lua 0.97% Python 0.48%

aerospike-client-c's Introduction

Aerospike C Client

The Aerospike C client provides a C interface for interacting with the Aerospike Database. The client can be built on 64-bit distributions of Linux, MacOS or Windows. Unit tests, examples and benchmarks are also included.

Build Prerequisites

Debian 7+ and Ubuntu 12+

$ sudo apt-get install libc6-dev libssl-dev autoconf automake libtool g++

[Also do on Ubuntu 12+:]
$ sudo apt-get install ncurses-dev

[Optional:]
$ sudo apt-get install liblua5.1-dev

Red Hat Enterprise Linux or CentOS 6+

$ sudo yum install openssl-devel glibc-devel autoconf automake libtool

[Optional:]
$ sudo yum install lua-devel
$ sudo yum install gcc-c++ graphviz rpm-build 

Fedora 20+

$ sudo yum install openssl-devel glibc-devel autoconf automake libtool

[Optional:]
$ sudo yum install compat-lua-devel-5.1.5
$ sudo yum install gcc-c++ graphviz rpm-build 

MacOS 10.9+

Run this script after installing XCode and Brew:

$ xcode/prepare_xcode

Windows 7+

See Windows Build.

Event Library (Optional)

An event library is required when C client asynchronous functionality is used. On Linux and MacOS, the event library must be installed independently of the C client. Install one of the supported event libraries:

libuv has excellent performance and supports all platforms. The client does not support async TLS (SSL) sockets when using libuv. Use install_libuv to install on Linux/MacOS. See Windows Build for libuv configuration on Windows.

libev has excellent performance on Linux/MacOS, but its Windows implementation is suboptimal. Therefore, the C client supports libev on Linux/MacOS only. The client does support async TLS (SSL) sockets when using libev. Use install_libev to install.

libevent is less performant than the other two options, but it does support all platforms. The client also supports async TLS (SSL) sockets when using libevent. Use install_libevent to install on Linux/MacOS. See Windows Build for libevent configuration on Windows.

Event Library Notes

Event libraries usually install into /usr/local/lib on Linux/MacOS. Most operating systems do not search /usr/local/lib by default. Therefore, the following LD_LIBRARY_PATH setting may be necessary.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

When compiling your async applications with aerospike header files, the event library must be defined (-DAS_USE_LIBEV, -DAS_USE_LIBUV or -DAS_USE_LIBEVENT) on the command line or in an IDE. Example:

$ gcc -DAS_USE_LIBEV -o myapp myapp.c -laerospike -lev -lssl -lcrypto -lpthread -lm -lz

Build

The remaining sections are applicable to Linux/MacOS platforms. See Windows Build for Windows build instructions.

Before building, please ensure you have the prerequisites installed. This project uses git submodules, so you will need to initialize and update submodules before building this project.

$ git submodule update --init

Build default library:

$ make [EVENT_LIB=libev|libuv|libevent]

Build examples:

$ make
$ make EVENT_LIB=libev    # Support asynchronous functions with libev
$ make EVENT_LIB=libuv    # Support asynchronous functions with libuv
$ make EVENT_LIB=libevent # Support asynchronous functions with libevent

The build adheres to the _GNU_SOURCE API level. The build will generate the following files:

  • target/{target}/include – header files
  • target/{target}/lib/libaerospike.a – static archive
  • target/{target}/lib/libaerospike.so – dynamic shared library (for Linux) or
  • target/{target}/lib/libaerospike.dylib – dynamic shared library (for MacOS)

Static linking with the .a prevents you from having to install the libraries on your target platform. Dynamic linking with the .so avoids a client rebuild if you upgrade the client. Choose the option that is right for you.

Build alias:

If always building with the same asynchronous framework, creating an alias is recommended.

$ alias make="make EVENT_LIB=libev"

Clean

To clean up build products:

$ make clean

This will remove all files in the target directory.

Test

To run unit tests:

$ make [EVENT_LIB=libev|libuv|libevent] [AS_HOST=<hostname>] test

or with valgrind:

$ make [EVENT_LIB=libev|libuv|libevent] [AS_HOST=<hostname>] test-valgrind

Lua

The C client requires Lua 5.1 support for the client-side portion of User Defined Function (UDF) query aggregation. By default, the C client builds with Lua support provided by the included lua submodule.

Optionally, Lua support may be provided by either the included luajit submodule or by the build environment.

To enable LuaJIT 2.0.3, the build must be performed with the USE_LUAJIT=1 option passed on all relevant make command lines (i.e., the C client itself, the benchmarks sample application, and the API examples.) [Note that on some platforms, Valgrind may not function out-of-the-box on applications built with the C client when LuaJIT is enabled without using an unreleased version of LuaJIT built with additional options.]

To use Lua provided by the development environment, either the lua5.1 development package may be installed (on platforms that have it), or else Lua 5.1.5 may be built from the source release and installed into the standard location (usually /usr/local/.) In either of these two cases, the build must be performed with the option USE_LUAMOD=0 passed on all relevant make command lines.

Package

Installer packages can be created for RedHat (rpm), Debian (deb), Mac OS X (pkg). These packages contain C client libraries, header files, online docs, examples and benchmarks. Package creation requires doxygen 1.8 or greater and its dependencies (including graphviz). Doxygen is used to create online HTML documentation.

Build the client package on the current platform:

$ make package

The generated packages are located in target/packages.

aerospike-client-c's People

Contributors

briannichols avatar cstivers78 avatar wchu-citrusleaf avatar gooding470 avatar sunanda avatar bbulkow avatar xorphox avatar sunilvirus avatar bhuvanramk avatar ksedgwic avatar bwhisler avatar gayathrikaliyamoorthy avatar pratyyy avatar sumitjindal avatar mukulagg avatar jhecking avatar rbotzer avatar kportertx avatar uncle-betty avatar mah0x211 avatar jtraver avatar suzanne-aerospike avatar helix avatar msempere avatar minting avatar aminer avatar ashishshinde avatar jatinn avatar

Watchers

James Cloos 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.