Large List Lua


#1

Hi guys,

Hope someone can help me out with some concepts. I am pretty clear with the normal Aerospike without LDT. Am now venturing into LDTs.

Am I right to say?

  1. LDTs are ‘sub-records’ associated with normal records? ie, at face-value, they look like any other Bin names?
  2. If so, how do I create a LDT sub-record in Lua itself? and associate it with the main record? I am used to rec[“bin”]= map() or rec[“bin”]= list(); How do I declare a large list or map in Lua itself?

#2

Gotcha…

Declare first > local llist_lib = require(‘ldt/lib_llist’);

Then add LDT element to your record > llist_lib.add(rec, “abc”, “def”, nil)


#3

yes !!

That is they way you would use the LDT api from inside UDF functions.

LDTs are ‘sub-records’ associated with normal records? ie, at face-value, they look like any other Bin names?

LDT are made of records and subRecords. They are like any other bins but internal chunked up. Please refer to documentation for higher details.

If so, how do I create a LDT sub-record in Lua itself? and associate it with the main record? I am used to rec[“bin”]= map() or rec[“bin”]= list(); How do I declare a large list or map in Lua itself?

function create_rec(rec, normal_bin, map_bin, llist_bin)
    rec[normal_bin] = 10
    local m = map()
    m['key'] = 'val'
    rec[map_bin] = m
    llist_lib.add(rec, llist_bin, "value")
    if (aerospike:exists(rec)) then
        aerospike.update(rec)
    else
        aerospike.create(rec)
    end
end

HTH – R


#4

@Zhongcai_Ng,

Thank you for posting about LDTs in our forum. Please see the LDT Feature Guide for current LDT recommendations and best practices.


#5

@Zhongcai_Ng,

Effective immediately, we will no longer actively support the LDT feature and will eventually remove the API. The exact deprecation and removal timeline will depend on customer and community requirements. Instead of LDTs, we advise that you use our newer List and SortedMap APIs, which are now available in all Aerospike-supported clients at the General Availability level. Read our blog post for details.