Skip to content

Instantly share code, notes, and snippets.

View sharonovd's full-sized avatar
🙀
where are you jon

Dmitry Sharonov sharonovd

🙀
where are you jon
View GitHub Profile
#!/usr/bin/env tarantool
-- Sets common rocks paths so that the app can be started from any
-- directory
--
-- By default, when you do require('mymodule'), tarantool looks into
-- the current working directory and whatever is specified in
-- package.path and package.cpath. If you run your app while in the
-- root directory of that app, everything goes fine, but if you try to
-- start your app with "tarantool myapp/init.lua", it will fail to load
-- its modules, and modules from myapp/.rocks.
@sharonovd
sharonovd / demo-data
Last active June 4, 2020 11:32
TDG demo-data
[
{
"name": "Account",
"type": "record",
"logicalType": "Aggregate",
"fields": [
{"name": "id", "type": "int"},
{"name": "name", "type": ["null", "string"], "default": null}
],
"indexes": ["id", "name"],
--- RSA bindings for Tarantool
--- Carefully adapted from https://github.com/spacewander/lua-resty-rsa
local bit = require "bit"
local band = bit.band
local ffi = require "ffi"
local ffi_new = ffi.new
local ffi_gc = ffi.gc
local ffi_copy = ffi.copy
local ffi_str = ffi.string
#!/usr/bin/env tarantool
local net_box = require('net.box')
local fiber = require('fiber')
local clock = require('clock')
local CONN_STRING = 'localhost:3301' -- SET UP CONECTION STRING TO YOUR ROUTER / PLAIN TARANTOOL
local WORKER_COUNT = 256 -- SET UP NUMBER OF PARALLEL REQUESTS HERE
local conn = assert(net_box.connect(CONN_STRING))