In Tarantool, thanks to being able to access indexes directly from Lua, supporting sequences is just a few lines of code, wrapping the standard INSERT command:
function box.auto_increment(spaceno, ...)
max_tuple = box.space[spaceno].index.idx:max()
if max_tuple ~= nil then
max = box.unpack('i', max_tuple)
max = -1
return box.insert(spaceno, max + 1, ...)
(You can see a syntax-highlighted source with comments here.)
There is no need for locks, mutexes or alike: a stored procedure is atomic. There is also no lying and no mystery implementation to support auto_increment for HASH keys: HASH isn't an ordered data structure, and :max() method for it simply throws an exception.
To make sure there is good code reuse, we created an open source repository with various data structures and algorithms for Tarantool in Lua.