Aerospike Announces an Early Adopter Release of the SortedMap Feature (May 25, 2016)


#1

Aerospike is announcing to the Community that it is making available an Early Adopter release of the SortedMap feature.

This will allow you to:

  • Store and retrieve SortedMap data (along with the existing List and Map data structures)
  • Manipulate the SortedMap on the server with the following operations:
    • add(k, [v]), add_items
    • remove(k), remove_items
    • remove_range(min,max)
    • find(k)
    • find_first(count)
    • find_last(count)
    • exists(k)
    • range(min,max)
    • size()
  • Create a Secondary Index on Sorted Maps
  • Query via a Secondary Index on SortedMap entries

Clients supported for the following languages include:

  • Java
  • C / C++
  • Node.js
  • Go

If you want to be included in the Early Adopter program for SortedMap, please drop me an email at alvin@aerospike.com.

@Alvin_Richards VP of Product


#2

#3

Nice addition to the already feature rich api set. For sortedMap need we currently use UDF. Based on a “count” field in the Map we sort and take in topN.

I couldn’t see in the api on which field (in the map) the sorting is based on ?


#4

My mistake, I did not include the “get” apis in the list. To be complete these are:

  • getByKey
  • getByKeyRange
  • getByValue
  • getByValueRange
  • getByIndex
  • getByIndexRangeToEnd
  • getByIndexRange
  • getByRank
  • getByRankRangeToEnd
  • getByRankRange

So you would do something like this (in pseudo code) for a leaderboard

insert entries with key="username", value = count
getByRankRange(-10, 10)

#5

Is it planned to have a getKeys() query to fetch only map keys? So we could store data related to a key but also be able to load all keys without loading that data and emulating Set behaviour?


#6

You could emulate Set behavior by storing all keys with some unused value (nil or 0 cost only 1 byte so those are best).

Use return_type of AS_MAP_RETURN_KEY for your ops and you’ll only get back keys. You can get all keys by as_operations_add_map_get_by_index_range_to_end(&ops, bin_name, 0, AS_MAP_RETURN_KEY) or as_operations_add_map_get_by_key_range(&ops, bin_name, &as_nil, NULL, AS_MAP_RETURN_KEY) for example.