File

plugins/mod_storage_internal.lua @ 8020:342ce07836de

mod_storage_internal: Ignore unused 'self' argument [luacheck]
author Kim Alvefur <zash@zash.se>
date Fri, 31 Mar 2017 17:39:41 +0200
parent 8019:925098aad268
child 8021:83f18982bcfd
line wrap: on
line source

local datamanager = require "core.storagemanager".olddm;

local host = module.host;

local driver = {};

function driver:open(store, typ)
	local mt = self[typ or "keyval"]
	if not mt then
		return nil, "unsupported-store";
	end
	return setmetatable({ store = store, type = typ }, mt);
end

function driver:stores(username) -- luacheck: ignore 212/self
	return datamanager.stores(username, host);
end

function driver:purge(user) -- luacheck: ignore 212/self
	return datamanager.purge(user, host);
end

local keyval = { };
driver.keyval = { __index = keyval };

function keyval:get(user)
	return datamanager.load(user, host, self.store);
end

function keyval:set(user, data)
	return datamanager.store(user, host, self.store, data);
end

function keyval:users()
	return datamanager.users(host, self.store, self.type);
end

module:provides("storage", driver);