GithubHelp home page GithubHelp logo

aerospike / aerospike-mod-lua Goto Github PK

View Code? Open in Web Editor NEW
12.0 58.0 21.0 2.16 MB

Lua Interface Module for Aerospike Server and C Client

Home Page: http://aerospike.com

Makefile 6.02% C 87.45% Lua 6.53%

aerospike-mod-lua's Introduction

aerospike-mod-lua

Aeospike Mod Lua provides support for executing Lua language functions using the Aerospike data types. This module is used by both the Aerospike Server and the Aerospike C Client as a git submodule.

Dependencies

Linux Dependencies

Building Aerospike Mod Lua requires the development resources for the Lua language version 5.4. The installation instructions for common Linux distributions are as follows:

Build

Build Linux and MacOS

To build the test app:

$ make test

To build a static archive libmod_lua.a:

$ make libmod_lua.a

To build a dynamic library libmod_lua.so:

$ make libmod_lua.so

Build MacOS XCode

  • Double click xcode/aerospike-mod-lua.xcworkspace
  • Click Product -> Build

Build Windows Visual Studio 2022+

  • Double click vs/aerospike-mod-lua.sln
  • Click Build -> Build Solution

Install

All generated files are placed in ./target/{arch}, where:

  • {arch} is the target architecture, e.g., Linux-x86_64.
  • The lib subdirectory contains all libraries.
  • The bin subdirectory contains all executables.

libmod_lua.so

You will want to either:

  1. Move the libmod_lua.so to a location your program can access.
  2. Add the path to libmod_lua.so to your LD_LIBRARY_PATH.

Test

To test, you can run the following:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:target/Linux-x86_64/lib
$ target/Linux-x86_64/bin/test record test1.record a b c d

aerospike-mod-lua's People

Contributors

arrowplum avatar bbulkow avatar bhuvanramk avatar briannichols avatar bwhisler avatar citrusraj avatar cstivers78 avatar dwelch-spike avatar gayathrikaliyamoorthy avatar gooding470 avatar kportertx avatar ksedgwic avatar pratyyy avatar sumitjindal avatar sunanda avatar sunilvirus avatar wchu-citrusleaf avatar xorphox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aerospike-mod-lua's Issues

bytes() are initialized to nil not to 0

Hello,

In the docs http://www.aerospike.com/docs/udf/api/bytes.html is told that

> local b = bytes(18)
Bytes()
> b[1]
0

but when I do

function test(rec, bin)
    local a = bytes(10)
    return a[1]
end

and

aql> register module 'bytes_test.lua'
OK, 1 module added.

aql> execute bytes_test.test() on scan.b_test where PK = 1
+------+
| test |
+------+
|      |
+------+
1 row in set (0.000 secs)

I get nil

I looked to the code, and https://github.com/aerospike/aerospike-common/blob/master/src/main/aerospike/as_bytes.c#L33 calls wrapped calloc https://github.com/aerospike/aerospike-common/blob/9c595786295be4a9396abed37d61d65e4a89a89d/src/main/citrusleaf/cf_alloc.c#L32 which should initialize memory to 0.
But I think that when pushing memory to lua this function is used

void * mod_lua_box_value(mod_lua_box * box) {
which sets values to NULL == nil in lua. But it just a suggestion, I am not sure.

Doubts about record.bin_names and geojson.

Client: Python 3.7.2
Server: 3.16


When saving records, we have the option to mark a bin as None (in which case, the bin is not stored). Other option is to mark the bin value as aerospike.null(). The client gets back aerospike.null() as the value for the bin. This clearly distinguishes omitted bins vs null bins.
The bin is also stored in the server when using aerospike.null().

This cannot be done with a udf, since _record[bin] always results in nil and record.bin_names also does not return name for this bin. This is sort of inconsistent. If record.bin_names returns the bin name, we can do the above mentioned check in udf too.

Is there any way short of passing expected bin names to udf and checking against that to solve this issue? Or, if viable this be made a feature request.

This seems to be because for these bins as_bin_inuse returns false, if I understand the code correct.
https://github.com/aerospike/aerospike-server/blob/2b99c53f71d2da4782d4c5111243b7db395ea618/as/src/base/udf_record.c#L886


Also, does aerospike plan to expose geojson's in udf with geo query feature?

Please let me know, if this issue does not belong in this repo and should be moved to aerospike-server repo.

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.