summaryrefslogtreecommitdiff
path: root/server/db.lua
blob: 4208aebd5334dea7ee15697eb0a9972b24113dac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
local lmdb = require'lmdb'
local env = lmdb.open('data',{maxdbs=16})
local function get_db(dbname, writeable)
	-- shortcut
	if writeable == nil then writeable = false end
	local txn = assert(env:txn_begin(writeable),"couldn't begin txn")
	local the_db = assert(txn:open(dbname), "couldn't open db")
	return txn,the_db
end

	
return {
	env=env,
	get_db=get_db,
}