Software /
code /
prosody
Diff
core/storagemanager.lua @ 6791:e813e8cf6046
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Aug 2015 13:05:22 +0200 |
parent | 6666:42fdc8dddf04 |
parent | 6779:6236668da30a |
child | 6792:8b284787fe26 |
line wrap: on
line diff
--- a/core/storagemanager.lua Mon Aug 17 01:58:53 2015 +0200 +++ b/core/storagemanager.lua Thu Aug 20 13:05:22 2015 +0200 @@ -11,11 +11,10 @@ local prosody = prosody; -module("storagemanager") +local _ENV = nil; local olddm = {}; -- maintain old datamanager, for backwards compatibility for k,v in pairs(datamanager) do olddm[k] = v; end -_M.olddm = olddm; local null_storage_method = function () return false, "no data storage active"; end local null_storage_driver = setmetatable( @@ -31,7 +30,7 @@ local stores_available = multitable.new(); -function initialize_host(host) +local function initialize_host(host) local host_session = hosts[host]; host_session.events.add_handler("item-added/storage-provider", function (event) local item = event.item; @@ -45,7 +44,7 @@ end prosody.events.add_handler("host-activated", initialize_host, 101); -function load_driver(host, driver_name) +local function load_driver(host, driver_name) if driver_name == "null" then return null_storage_driver; end @@ -58,7 +57,7 @@ return stores_available:get(host, driver_name); end -function get_driver(host, store) +local function get_driver(host, store) local storage = config.get(host, "storage"); local driver_name; local option_type = type(storage); @@ -109,7 +108,7 @@ }, map_shim_mt); end -function open(host, store, typ) +local function open(host, store, typ) local driver, driver_name = get_driver(host, store); local ret, err = driver:open(store, typ); if not ret then @@ -127,7 +126,7 @@ return ret, err; end -function purge(user, host) +local function purge(user, host) local storage = config.get(host, "storage"); if type(storage) == "table" then -- multiple storage backends in use that we need to purge @@ -165,4 +164,11 @@ return purge(username, host); end -return _M; +return { + initialize_host = initialize_host; + load_driver = load_driver; + get_driver = get_driver; + open = open; + + olddm = olddm; +};