C API (v0.9)

From Native Big Data Documentation
Jump to: navigation, search


Like OP, nbd offers a reduced but powerful C API.

Why C

Programs developed in C are fastest. In some cases 10-100 x faster than the same code implemented in other languages. Treat with a great volume of data can be done is seconds/minutes/hours in C or in hours/days/months with other languages.

What can I do in NBD using C

NDB allow develop modules. Modules are dynamic libraries that can be loaded by NDB and add new functionalities:

How can I create a native module

The main distribution of NBD comes with a "SDK" folder. Inside the folder a file template named template.c and a script named "compile.bat" can be found.

  • Download and install mingw-w64 version > 8, for example from [[1]]
  • Copy your template.c to the name of your module. For example template.c -> nbd_odbc.c
  • Develop your module.
  • Configure the "compile.bat" script with the path of the installed gcc compiler and the name of your c file.
  • Compile it with compile.bat
  • Copy the dll generated file to the modules folder on any NBD in your cluster.
  • Reboot your NBD servers or press the reload nbd modules button in the web management application.


About NBD free version

NBD is free for 3 machines and can load 3 native modules. If you need bigger clusters (more machines) or you need to load more modules you must buy licenses. Every license allows one additional machine and allows to load one additional module in every server.


C API

MACROS

NBD native interface offers a powerful set of MACROS. MACROS allows develop native modules in a easy way. It is known that C is the most powerful computer language but developing in C is hard and difficult. NBD macros allows developing in C in a easy way.

Often NBD macros are polymorphic and variadics. This means that a macro will adapt its semantics to the parameters and the number of parameters you provide to it. In order to identify a NBD MACRO, all NBD macros begins with $.

FUNCTIONS

NBD exports all API functions as function pointers in a struct. All these functions are available from MACROS.