aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/storage/mod_storage.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-11-27 19:47:35 +0000
committerMatthew Wild <mwild1@gmail.com>2010-11-27 19:47:35 +0000
commitffa8381db1b9bc79ac02f82faad09571f065bc2d (patch)
tree6e1ddd3518fff2a89849145e46ce598addadeba2 /plugins/storage/mod_storage.lua
parent7eaa58567d6c5c195e7a833e00ee6a5c230d997a (diff)
downloadprosody-ffa8381db1b9bc79ac02f82faad09571f065bc2d.tar.gz
prosody-ffa8381db1b9bc79ac02f82faad09571f065bc2d.zip
storage/mod_storage: Remove, obsolete
Diffstat (limited to 'plugins/storage/mod_storage.lua')
-rw-r--r--plugins/storage/mod_storage.lua83
1 files changed, 0 insertions, 83 deletions
diff --git a/plugins/storage/mod_storage.lua b/plugins/storage/mod_storage.lua
deleted file mode 100644
index e9f5f923..00000000
--- a/plugins/storage/mod_storage.lua
+++ /dev/null
@@ -1,83 +0,0 @@
-
-module:set_global();
-
-local cache = { data = {} };
-function cache:get(key) return self.data[key]; end
-function cache:set(key, val) self.data[key] = val; return val; end
-
-local _,DBI = pcall(require, "DBI");
-function get_database(driver, db, ...)
- local uri = "dbi:"..driver..":"..db;
- return cache:get(uri) or cache:set(uri, (function(...)
- module:log("debug", "Opening database: %s", uri);
- prosody.unlock_globals();
- local dbh = assert(DBI.Connect(...));
- prosody.lock_globals();
- dbh:autocommit(true)
- return dbh;
- end)(driver, db, ...));
-end
-
-local st = require "util.stanza";
-local _parse_xml = module:require("xmlparse");
-parse_xml_real = _parse_xml;
-function parse_xml(str)
- local s = _parse_xml(str);
- if s and not s.gsub then
- return st.preserialize(s);
- end
-end
-function unparse_xml(s)
- return tostring(st.deserialize(s));
-end
-
-local drivers = {};
-
---local driver = module:require("sqlbasic").new("SQLite3", "hello.sqlite");
-local option_datastore = module:get_option("datastore");
-local option_datastore_params = module:get_option("datastore_params") or {};
-if option_datastore then
- local driver = module:require(option_datastore).new(unpack(option_datastore_params));
- table.insert(drivers, driver);
-end
-
-local datamanager = require "util.datamanager";
-local olddm = {};
-local dm = {};
-for key,val in pairs(datamanager) do olddm[key] = val; end
-
-do -- driver based on old datamanager
- local dmd = {};
- dmd.__index = dmd;
- function dmd:open(host, datastore)
- return setmetatable({ host = host, datastore = datastore }, dmd);
- end
- function dmd:get(user) return olddm.load(user, self.host, self.datastore); end
- function dmd:set(user, data) return olddm.store(user, self.host, self.datastore, data); end
- table.insert(drivers, dmd);
-end
-
-local function open(...)
- for _,driver in pairs(drivers) do
- local ds = driver:open(...);
- if ds then return ds; end
- end
-end
-
-local _data_path;
---function dm.set_data_path(path) _data_path = path; end
---function dm.add_callback(...) end
---function dm.remove_callback(...) end
---function dm.getpath(...) end
-function dm.load(username, host, datastore)
- local x = open(host, datastore);
- return x:get(username);
-end
-function dm.store(username, host, datastore, data)
- return open(host, datastore):set(username, data);
-end
---function dm.list_append(...) return driver:list_append(...); end
---function dm.list_store(...) return driver:list_store(...); end
---function dm.list_load(...) return driver:list_load(...); end
-
-for key,val in pairs(dm) do datamanager[key] = val; end