Comparison

core/moduleapi.lua @ 6556:74253c7beb9c

moduleapi: Module API for statsmanager
author Matthew Wild <mwild1@gmail.com>
date Wed, 21 Jan 2015 01:28:12 +0000
parent 6422:6d4d87a89026
child 6557:8aa967c81cbc
child 6639:3003d041c159
comparison
equal deleted inserted replaced
6555:7b2d16c14659 6556:74253c7beb9c
12 local set = require "util.set"; 12 local set = require "util.set";
13 local logger = require "util.logger"; 13 local logger = require "util.logger";
14 local pluginloader = require "util.pluginloader"; 14 local pluginloader = require "util.pluginloader";
15 local timer = require "util.timer"; 15 local timer = require "util.timer";
16 local resolve_relative_path = require"util.paths".resolve_relative_path; 16 local resolve_relative_path = require"util.paths".resolve_relative_path;
17 local measure = require "core.statsmanager".measure;
17 18
18 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; 19 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
19 local error, setmetatable, type = error, setmetatable, type; 20 local error, setmetatable, type = error, setmetatable, type;
20 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack; 21 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack;
21 local tonumber, tostring = tonumber, tostring; 22 local tonumber, tostring = tonumber, tostring;
368 369
369 function api:open_store(name, type) 370 function api:open_store(name, type)
370 return require"core.storagemanager".open(self.host, name or self.name, type); 371 return require"core.storagemanager".open(self.host, name or self.name, type);
371 end 372 end
372 373
374 function api:measure(name, type)
375 return measure(type, "/"..self.host.."/mod_"..self.name.."/"..name);
376 end
377
373 function api.init(mm) 378 function api.init(mm)
374 modulemanager = mm; 379 modulemanager = mm;
375 return api; 380 return api;
376 end 381 end
377 382